- Get the win32k beast tamed by msvc.
Modified: trunk/reactos/include/ndk/extypes.h
Modified: trunk/reactos/subsys/win32k/dib/dib16bpp.c
Modified: trunk/reactos/subsys/win32k/dib/dib1bpp.c
Modified: trunk/reactos/subsys/win32k/dib/dib24bpp.c
Modified: trunk/reactos/subsys/win32k/dib/dib32bpp.c
Modified: trunk/reactos/subsys/win32k/dib/dib8bpp.c
Modified: trunk/reactos/subsys/win32k/eng/bitblt.c
Modified: trunk/reactos/subsys/win32k/eng/gradient.c
Modified: trunk/reactos/subsys/win32k/include/gdifloat.h
Modified: trunk/reactos/subsys/win32k/ntddraw/ddraw.c
Modified: trunk/reactos/subsys/win32k/ntuser/cursoricon.c
Modified: trunk/reactos/subsys/win32k/ntuser/desktop.c
Modified: trunk/reactos/subsys/win32k/ntuser/focus.c
Modified: trunk/reactos/subsys/win32k/ntuser/hook.c
Modified: trunk/reactos/subsys/win32k/ntuser/input.c
Modified: trunk/reactos/subsys/win32k/ntuser/keyboard.c
Modified: trunk/reactos/subsys/win32k/ntuser/message.c
Modified: trunk/reactos/subsys/win32k/ntuser/misc.c
Modified: trunk/reactos/subsys/win32k/ntuser/msgqueue.c
Modified: trunk/reactos/subsys/win32k/ntuser/painting.c
Modified: trunk/reactos/subsys/win32k/ntuser/windc.c
Modified: trunk/reactos/subsys/win32k/ntuser/winpos.c
Modified: trunk/reactos/subsys/win32k/objects/bitmaps.c
Modified: trunk/reactos/subsys/win32k/objects/fillshap.c
Modified: trunk/reactos/subsys/win32k/objects/pen.c
Modified: trunk/reactos/subsys/win32k/objects/polyfill.c
Modified: trunk/reactos/subsys/win32k/objects/region.c
Modified: trunk/reactos/subsys/win32k/w32k.h
Modified: trunk/reactos/subsys/win32k/win32k.xml

Modified: trunk/reactos/include/ndk/extypes.h
--- trunk/reactos/include/ndk/extypes.h	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/include/ndk/extypes.h	2006-01-08 23:26:03 UTC (rev 20742)
@@ -43,6 +43,8 @@
 //
 // Kernel Exported Object Types
 //
+extern POBJECT_TYPE NTSYSAPI ExDesktopObjectType;
+extern POBJECT_TYPE NTSYSAPI ExWindowStationObjectType;
 extern POBJECT_TYPE NTSYSAPI ExIoCompletionType;
 extern POBJECT_TYPE NTSYSAPI ExMutantObjectType;
 extern POBJECT_TYPE NTSYSAPI ExTimerType;

Modified: trunk/reactos/subsys/win32k/dib/dib16bpp.c
--- trunk/reactos/subsys/win32k/dib/dib16bpp.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/dib/dib16bpp.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -45,8 +45,7 @@
 {
   PDWORD addr = (PDWORD)((PWORD)((PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta) + x1);
 
- 
-#ifdef _M_IX86
+#if defined(_M_IX86) && !defined(_MSC_VER)
   /* This is about 10% faster than the generic C code below */
   LONG Count = x2 - x1;
 
@@ -97,7 +96,7 @@
 VOID
 DIB_16BPP_VLine(SURFOBJ *SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
 {
-#ifdef _M_IX86
+#if defined(_M_IX86) && !defined(_MSC_VER)
   asm volatile(
     "   testl %2, %2"       "\n\t"
     "   jle   2f"           "\n\t"
@@ -129,7 +128,7 @@
       "r"(SurfObj->lDelta), "r"(y2 - y1), "a"(c)
     : "cc", "memory", "%ecx");
 #else
-  PBYTE byteaddr = SurfObj->pvScan0 + y1 * SurfObj->lDelta;
+  PBYTE byteaddr = (ULONG_PTR)SurfObj->pvScan0 + y1 * SurfObj->lDelta;
   PWORD addr = (PWORD)byteaddr + x;
   LONG lDelta = SurfObj->lDelta;
 
@@ -342,7 +341,7 @@
 {
   ULONG DestY;	
 
-#ifdef _M_IX86
+#if defined(_M_IX86) && !defined(_MSC_VER)
   /* This is about 10% faster than the generic C code below */ 
   ULONG delta = DestSurface->lDelta;
   ULONG width = (DestRect->right - DestRect->left) ;
@@ -865,13 +864,13 @@
    } col;
 } NICEPIXEL16;
 
-STATIC inline UCHAR
+static __inline UCHAR
 Clamp5(ULONG val)
 {
    return (val > 31) ? 31 : val;
 }
 
-STATIC inline UCHAR
+static __inline UCHAR
 Clamp6(ULONG val)
 {
    return (val > 63) ? 63 : val;

Modified: trunk/reactos/subsys/win32k/dib/dib1bpp.c
--- trunk/reactos/subsys/win32k/dib/dib1bpp.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/dib/dib1bpp.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -88,6 +88,7 @@
 	int dy2; // dest y end
 	int sy1; // src y start
 
+    int dx;
 	int shift;
 	BYTE srcmask, dstmask;
 
@@ -142,7 +143,7 @@
 		pd = d;
 		ps = s;
 		srcmask = 0xff;
-		int dx = dwx; /* dest x for this pass */
+		dx = dwx; /* dest x for this pass */
 		if ( dwx < dl )
 		{
 			int diff = dl-dwx;

Modified: trunk/reactos/subsys/win32k/dib/dib24bpp.c
--- trunk/reactos/subsys/win32k/dib/dib24bpp.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/dib/dib24bpp.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -43,7 +43,7 @@
 {
   PBYTE addr = (PBYTE)SurfObj->pvScan0 + y * SurfObj->lDelta + (x1 << 1) + x1;
   ULONG Count = x2 - x1;
-#ifndef _M_IX86
+#if !defined(_M_IX86) || defined(_MSC_VER)
   ULONG MultiCount;
   ULONG Fill[3];
 #endif
@@ -78,7 +78,7 @@
        *
        * So, taking endianness into account again, we need to fill with these
        * ULONGs: CABC BCAB ABCA */
-#ifdef _M_IX86
+#if defined(_M_IX86) && !defined(_MSC_VER)
        /* This is about 30% faster than the generic C code below */
        __asm__ __volatile__ (
 "      movl %1, %%ecx\n"
@@ -396,7 +396,7 @@
 {
   ULONG DestY;	
 
-#ifdef _M_IX86
+#if defined(_M_IX86) && !defined(_MSC_VER)
   PBYTE xaddr = (PBYTE)DestSurface->pvScan0 + DestRect->top * DestSurface->lDelta + (DestRect->left << 1) + DestRect->left;
   PBYTE addr;
   ULONG Count;
@@ -678,7 +678,7 @@
    } col;
 } NICEPIXEL32;
 
-STATIC inline UCHAR
+static __inline UCHAR
 Clamp8(ULONG val)
 {
    return (val > 255) ? 255 : val;

Modified: trunk/reactos/subsys/win32k/dib/dib32bpp.c
--- trunk/reactos/subsys/win32k/dib/dib32bpp.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/dib/dib32bpp.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -41,8 +41,7 @@
   return (ULONG)(*addr);
 }
 
-
-#ifdef _M_IX86
+#if defined(_M_IX86) && !defined(_MSC_VER)
 VOID
 DIB_32BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
 {      
@@ -78,7 +77,7 @@
 VOID
 DIB_32BPP_HLine(SURFOBJ *SurfObj, LONG x1, LONG x2, LONG y, ULONG c)
 {
-  PBYTE byteaddr = SurfObj->pvScan0 + y * SurfObj->lDelta;  
+  PBYTE byteaddr = (ULONG_PTR)SurfObj->pvScan0 + y * SurfObj->lDelta;  
   PDWORD addr = (PDWORD)byteaddr + x1;		
   LONG cx = x1;
   while(cx < x2) 
@@ -744,7 +743,7 @@
    } col;
 } NICEPIXEL32;
 
-STATIC inline UCHAR
+static __inline UCHAR
 Clamp8(ULONG val)
 {
    return (val > 255) ? 255 : val;

Modified: trunk/reactos/subsys/win32k/dib/dib8bpp.c
--- trunk/reactos/subsys/win32k/dib/dib8bpp.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/dib/dib8bpp.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -681,7 +681,7 @@
    } col;
 } NICEPIXEL16;
 
-STATIC inline UCHAR
+static __inline UCHAR
 Clamp8(ULONG val)
 {
    return (val > 255) ? 255 : val;

Modified: trunk/reactos/subsys/win32k/eng/bitblt.c
--- trunk/reactos/subsys/win32k/eng/bitblt.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/eng/bitblt.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -32,7 +32,7 @@
 #define NDEBUG
 #include <debug.h>
 
-typedef BOOLEAN STDCALL (*PBLTRECTFUNC)(SURFOBJ* OutputObj,
+typedef BOOLEAN (STDCALL *PBLTRECTFUNC)(SURFOBJ* OutputObj,
                                         SURFOBJ* InputObj,
                                         SURFOBJ* Mask,
                                         XLATEOBJ* ColorTranslation,
@@ -42,7 +42,7 @@
                                         BRUSHOBJ* Brush,
                                         POINTL* BrushOrigin,
                                         ROP4 Rop4);
-typedef BOOLEAN STDCALL (*PSTRETCHRECTFUNC)(SURFOBJ* OutputObj,
+typedef BOOLEAN (STDCALL *PSTRETCHRECTFUNC)(SURFOBJ* OutputObj,
                                             SURFOBJ* InputObj,
                                             SURFOBJ* Mask,
                                             CLIPOBJ* ClipRegion,
@@ -246,7 +246,7 @@
    return Result;
 }
 
-INT abs(INT nm);
+INT __cdecl abs(INT nm);
 
 /*
  * @implemented

Modified: trunk/reactos/subsys/win32k/eng/gradient.c
--- trunk/reactos/subsys/win32k/eng/gradient.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/eng/gradient.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -452,7 +452,7 @@
 }
 
 
-BOOL FASTCALL STATIC
+BOOL static
 IntEngIsNULLTriangle(TRIVERTEX  *pVertex, GRADIENT_TRIANGLE *gt)
 {
   if(COMPAREVERTEX(VERTEX(Vertex1), VERTEX(Vertex2)))

Modified: trunk/reactos/subsys/win32k/include/gdifloat.h
--- trunk/reactos/subsys/win32k/include/gdifloat.h	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/include/gdifloat.h	2006-01-08 23:26:03 UTC (rev 20742)
@@ -15,7 +15,7 @@
  * transformation process is done in floating point internally. This function
  * is then used to round these coordinates to integer values.
  */
-static inline INT GDI_ROUND(FLOAT val)
+static __inline INT GDI_ROUND(FLOAT val)
 {
    return (int)floor(val + 0.5);
 }
@@ -23,7 +23,7 @@
 /* Performs a world-to-viewport transformation on the specified point (which
  * is in floating point format).
  */
-static inline void INTERNAL_LPTODP_FLOAT(DC *dc, FLOAT_POINT *point)
+static __inline void INTERNAL_LPTODP_FLOAT(DC *dc, FLOAT_POINT *point)
 {
     FLOAT x, y;
 
@@ -42,7 +42,7 @@
  * is in integer format). Returns TRUE if successful, else FALSE.
  */
 #if 0
-static inline BOOL INTERNAL_DPTOLP(DC *dc, LPPOINT point)
+static __inline BOOL INTERNAL_DPTOLP(DC *dc, LPPOINT point)
 {
     FLOAT_POINT floatPoint;
 
@@ -62,7 +62,7 @@
 /* Performs a world-to-viewport transformation on the specified point (which
  * is in integer format).
  */
-static inline void INTERNAL_LPTODP(DC *dc, LPPOINT point)
+static __inline void INTERNAL_LPTODP(DC *dc, LPPOINT point)
 {
     FLOAT_POINT floatPoint;
 

Modified: trunk/reactos/subsys/win32k/ntddraw/ddraw.c
--- trunk/reactos/subsys/win32k/ntddraw/ddraw.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/ntddraw/ddraw.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -49,6 +49,10 @@
 	DD_CALLBACKS callbacks;
 	DD_SURFACECALLBACKS surface_callbacks;
 	DD_PALETTECALLBACKS palette_callbacks;
+    DC *pDC;
+    BOOL success;
+    HANDLE hDirectDraw;
+    PDD_DIRECTDRAW pDirectDraw;
 #ifdef DX_DEBUG
 	DPRINT1("NtGdiDdCreateDirectDrawObject\n");
 #endif
@@ -67,7 +71,7 @@
 	    return NULL;
     }
     
-	DC *pDC = DC_LockDc(hdc);
+	pDC = DC_LockDc(hdc);
 	if (!pDC)
 		return NULL;
 
@@ -78,7 +82,7 @@
 		return NULL;
 	}
 	
-	BOOL success = pDC->DriverFunctions.EnableDirectDraw(
+	success = pDC->DriverFunctions.EnableDirectDraw(
 		pDC->PDev, &callbacks, &surface_callbacks, &palette_callbacks);
 
 	if (!success)
@@ -91,7 +95,7 @@
 		return NULL;
 	}
 
-	HANDLE hDirectDraw = GDIOBJ_AllocObj(GDI_OBJECT_TYPE_DIRECTDRAW);
+	hDirectDraw = GDIOBJ_AllocObj(GDI_OBJECT_TYPE_DIRECTDRAW);
 	if (!hDirectDraw)
 	{
 		/* No more memmory */
@@ -102,7 +106,7 @@
 		return NULL;
 	}
 
-	PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDraw, GDI_OBJECT_TYPE_DIRECTDRAW);
+	pDirectDraw = GDIOBJ_LockObj(hDirectDraw, GDI_OBJECT_TYPE_DIRECTDRAW);
 	if (!pDirectDraw)
 	{
 		/* invalid handle */
@@ -160,6 +164,8 @@
 )
 {
 #ifdef DX_DEBUG
+    PDD_DIRECTDRAW pDirectDraw;
+    BOOL success;
     DPRINT1("NtGdiDdQueryDirectDrawObject\n");
 #endif
 
@@ -195,7 +201,7 @@
     }
    
     
-	PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);
+	pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);
 	
 	
 	if (!pDirectDraw)
@@ -207,7 +213,7 @@
 		return FALSE;
     }
 
-	BOOL success = pDirectDraw->DrvGetDirectDrawInfo(
+	success = pDirectDraw->DrvGetDirectDrawInfo(
 		pDirectDraw->Global.dhpdev,
 		pHalInfo,
 		puNumHeaps,
@@ -413,12 +419,13 @@
 )
 {
 	DWORD  ddRVal = DDHAL_DRIVER_NOTHANDLED;
+    PDD_DIRECTDRAW pDirectDraw;
 	PDD_DIRECTDRAW_GLOBAL lgpl;
 #ifdef DX_DEBUG
 	DPRINT1("NtGdiDdCreateSurface\n");
 #endif
 
-	PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);
+	pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);
 	if (pDirectDraw == NULL) 
 	{
 #ifdef DX_DEBUG
@@ -460,12 +467,13 @@
 {
 	DWORD  ddRVal;
 	PDD_DIRECTDRAW_GLOBAL lgpl;
+    PDD_DIRECTDRAW pDirectDraw;
 #ifdef DX_DEBUG
 	DPRINT1("NtGdiDdWaitForVerticalBlank\n");
 #endif
 
 
-	PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);
+	pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);
 	if (pDirectDraw == NULL) 
 		return DDHAL_DRIVER_NOTHANDLED;
 
@@ -978,6 +986,7 @@
 )
 {
 	PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);
+    PDD_SURFACE pSurface;
 #ifdef DX_DEBUG
 	DPRINT1("NtGdiDdCreateSurfaceObject\n");
 #endif
@@ -987,7 +996,7 @@
 	if (!hSurface)
 		hSurface = GDIOBJ_AllocObj(GDI_OBJECT_TYPE_DD_SURFACE);
 
-	PDD_SURFACE pSurface = GDIOBJ_LockObj(hSurface, GDI_OBJECT_TYPE_DD_SURFACE);
+	pSurface = GDIOBJ_LockObj(hSurface, GDI_OBJECT_TYPE_DD_SURFACE);
         /* FIXME - Handle pSurface == NULL!!!! */
 
 	RtlMoveMemory(&pSurface->Local, puSurfaceLocal, sizeof(DD_SURFACE_LOCAL));

Modified: trunk/reactos/subsys/win32k/ntuser/cursoricon.c
--- trunk/reactos/subsys/win32k/ntuser/cursoricon.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/ntuser/cursoricon.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -113,6 +113,7 @@
    SURFOBJ *soMask = NULL, *soColor = NULL;
    XLATEOBJ *XlateObj = NULL;
    HDC Screen;
+   PDC dc;
 
    CurInfo = IntGetSysCursorInfo(WinSta);
    OldCursor = CurInfo->CurrentCursorObject;
@@ -132,7 +133,7 @@
          return (HCURSOR)0;
       }
       /* FIXME use the desktop's HDC instead of using ScreenDeviceContext */
-      PDC dc = DC_LockDc(Screen);
+      dc = DC_LockDc(Screen);
 
       if (!dc)
       {
@@ -772,6 +773,7 @@
    PWINSTATION_OBJECT WinSta;
    NTSTATUS Status;
    PCURICON_OBJECT CurIcon;
+   HDC hDC;
    DECLARE_RETURN(BOOL);
 
    DPRINT("Enter NtUserGetCursorInfo\n");
@@ -779,7 +781,6 @@
 
 #if 1
 
-   HDC hDC;
 
    /* FIXME - get the screen dc from the window station or desktop */
    if (!(hDC = IntGetScreenDC()))

Modified: trunk/reactos/subsys/win32k/ntuser/desktop.c
--- trunk/reactos/subsys/win32k/ntuser/desktop.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/ntuser/desktop.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -1196,12 +1196,15 @@
    BOOL doPatBlt = TRUE;
    PWINDOW_OBJECT WndDesktop;
    int len;
+   COLORREF color_old;
+   UINT align_old;
+   int mode_old;
+   PWINSTATION_OBJECT WinSta = PsGetWin32Thread()->Desktop->WindowStation;
    DECLARE_RETURN(BOOL);
-   
+
    UserEnterExclusive();
    DPRINT("Enter NtUserPaintDesktop\n");
 
-   PWINSTATION_OBJECT WinSta = PsGetWin32Thread()->Desktop->WindowStation;
 
    IntGdiGetClipBox(hDC, &Rect);
 
@@ -1359,9 +1362,9 @@
             rect.bottom = UserGetSystemMetrics(SM_CYSCREEN);
          }
 
-         COLORREF color_old = NtGdiSetTextColor(hDC, RGB(255,255,255));
-         UINT align_old = NtGdiSetTextAlign(hDC, TA_RIGHT);
-         int mode_old = NtGdiSetBkMode(hDC, TRANSPARENT);
+         color_old = NtGdiSetTextColor(hDC, RGB(255,255,255));
+         align_old = NtGdiSetTextAlign(hDC, TA_RIGHT);
+         mode_old = NtGdiSetBkMode(hDC, TRANSPARENT);
 
          NtGdiTextOut(hDC, rect.right-16, rect.bottom-48, s_wszVersion, len);
 

Modified: trunk/reactos/subsys/win32k/ntuser/focus.c
--- trunk/reactos/subsys/win32k/ntuser/focus.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/ntuser/focus.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -138,7 +138,7 @@
    return NULL;
 }
 
-STATIC BOOL FASTCALL
+static BOOL FASTCALL
 co_IntSetForegroundAndFocusWindow(PWINDOW_OBJECT Window, PWINDOW_OBJECT FocusWindow, BOOL MouseActivate)
 {
    HWND hWnd = Window->hSelf;
@@ -438,12 +438,12 @@
 HWND STDCALL
 NtUserGetCapture(VOID)
 {
+   PUSER_MESSAGE_QUEUE ThreadQueue;
    DECLARE_RETURN(HWND);
 
    DPRINT("Enter NtUserGetCapture\n");
    UserEnterShared();
 
-   PUSER_MESSAGE_QUEUE ThreadQueue;
    ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetWin32Thread()->MessageQueue;
    RETURN( ThreadQueue ? ThreadQueue->CaptureWindow : 0);
 

Modified: trunk/reactos/subsys/win32k/ntuser/hook.c
--- trunk/reactos/subsys/win32k/ntuser/hook.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/ntuser/hook.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -36,10 +36,10 @@
 
 #define HOOKID_TO_INDEX(HookId) (HookId - WH_MINHOOK)
 
-STATIC PHOOKTABLE GlobalHooks;
+static PHOOKTABLE GlobalHooks;
 
 /* create a new hook table */
-STATIC FASTCALL PHOOKTABLE
+static PHOOKTABLE
 IntAllocHookTable(void)
 {
    PHOOKTABLE Table;
@@ -86,7 +86,7 @@
 
 
 /* create a new hook and add it to the specified table */
-STATIC FASTCALL PHOOK
+static PHOOK
 IntAddHook(PETHREAD Thread, int HookId, BOOLEAN Global, PWINSTATION_OBJECT WinStaObj)
 {
    PHOOK Hook;
@@ -127,7 +127,7 @@
 }
 
 /* get the hook table that a given hook belongs to */
-STATIC PHOOKTABLE FASTCALL
+static PHOOKTABLE FASTCALL
 IntGetTable(PHOOK Hook)
 {
    if (NULL == Hook->Thread || WH_KEYBOARD_LL == Hook->HookId ||
@@ -140,7 +140,7 @@
 }
 
 /* get the first hook in the chain */
-STATIC PHOOK FASTCALL
+static PHOOK FASTCALL
 IntGetFirstHook(PHOOKTABLE Table, int HookId)
 {
    PLIST_ENTRY Elem = Table->Hooks[HOOKID_TO_INDEX(HookId)].Flink;
@@ -149,7 +149,7 @@
 }
 
 /* find the first non-deleted hook in the chain */
-STATIC PHOOK FASTCALL
+static PHOOK FASTCALL
 IntGetFirstValidHook(PHOOKTABLE Table, int HookId)
 {
    PHOOK Hook;
@@ -167,7 +167,7 @@
 }
 
 /* find the next hook in the chain, skipping the deleted ones */
-STATIC PHOOK FASTCALL
+static PHOOK FASTCALL
 IntGetNextHook(PHOOK Hook)
 {
    PHOOKTABLE Table = IntGetTable(Hook);
@@ -193,7 +193,7 @@
 }
 
 /* free a hook, removing it from its chain */
-STATIC VOID FASTCALL
+static VOID FASTCALL
 IntFreeHook(PHOOKTABLE Table, PHOOK Hook, PWINSTATION_OBJECT WinStaObj)
 {
    RemoveEntryList(&Hook->Chain);
@@ -210,7 +210,7 @@
 }
 
 /* remove a hook, freeing it if the chain is not in use */
-STATIC FASTCALL VOID
+static VOID
 IntRemoveHook(PHOOK Hook, PWINSTATION_OBJECT WinStaObj, BOOL TableAlreadyLocked)
 {
    PHOOKTABLE Table = IntGetTable(Hook);
@@ -232,7 +232,7 @@
 }
 
 /* release a hook chain, removing deleted hooks if the use count drops to 0 */
-STATIC VOID FASTCALL
+static VOID FASTCALL
 IntReleaseHookChain(PHOOKTABLE Table, int HookId, PWINSTATION_OBJECT WinStaObj)
 {
    PLIST_ENTRY Elem;

Modified: trunk/reactos/subsys/win32k/ntuser/input.c
--- trunk/reactos/subsys/win32k/ntuser/input.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/ntuser/input.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -233,7 +233,7 @@
 /* Returns a value that indicates if the key is a modifier key, and
  * which one.
  */
-STATIC UINT STDCALL
+static UINT STDCALL
 IntKeyboardGetModifiers(KEYBOARD_INPUT_DATA *InputData)
 {
    if (InputData->Flags & KEY_E1)
@@ -280,7 +280,7 @@
 /* Asks the keyboard driver to send a small table that shows which
  * lights should connect with which scancodes
  */
-STATIC NTSTATUS STDCALL
+static NTSTATUS STDCALL
 IntKeyboardGetIndicatorTrans(HANDLE KeyboardDeviceHandle,
                              PKEYBOARD_INDICATOR_TRANSLATION *IndicatorTrans)
 {
@@ -333,7 +333,7 @@
 
 /* Sends the keyboard commands to turn on/off the lights.
  */
-STATIC NTSTATUS STDCALL
+static NTSTATUS STDCALL
 IntKeyboardUpdateLeds(HANDLE KeyboardDeviceHandle,
                       PKEYBOARD_INPUT_DATA KeyInput,
                       PKEYBOARD_INDICATOR_TRANSLATION IndicatorTrans)
@@ -374,7 +374,7 @@
    return STATUS_SUCCESS;
 }
 
-STATIC VOID STDCALL
+static VOID STDCALL
 IntKeyboardSendWinKeyMsg()
 {
    PWINDOW_OBJECT Window;
@@ -395,13 +395,13 @@
    MsqPostMessage(Window->MessageQueue, &Mesg, FALSE, QS_HOTKEY);
 }
 
-STATIC VOID STDCALL
+static VOID STDCALL
 co_IntKeyboardSendAltKeyMsg()
 {
    co_MsqPostKeyboardMessage(WM_SYSCOMMAND,SC_KEYMENU,0);
 }
 
-STATIC VOID STDCALL
+static VOID STDCALL
 KeyboardThreadMain(PVOID StartContext)
 {
    UNICODE_STRING KeyboardDeviceName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass0");

Modified: trunk/reactos/subsys/win32k/ntuser/keyboard.c
--- trunk/reactos/subsys/win32k/ntuser/keyboard.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/ntuser/keyboard.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -1043,6 +1043,7 @@
    UINT ScanCode = (lParam >> 16) & 0xff;
    BOOL ExtKey = lParam & (1<<24) ? TRUE : FALSE;
    PKBDTABLES keyLayout;
+   VSC_LPWSTR *KeyNames;
    DECLARE_RETURN(DWORD);
    
    DPRINT("Enter NtUserGetKeyNameText\n");
@@ -1069,7 +1070,7 @@
       VkCode = ScanToVk( ScanCode, ExtKey, keyLayout );
    }
 
-   VSC_LPWSTR *KeyNames = 0;
+   KeyNames = 0;
 
    if( CareVk != VkCode )
       ScanCode = VkToScan( VkCode, ExtKey, keyLayout );

Modified: trunk/reactos/subsys/win32k/ntuser/message.c
--- trunk/reactos/subsys/win32k/ntuser/message.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/ntuser/message.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -177,7 +177,7 @@
    return Size;
 }
 
-static FASTCALL NTSTATUS
+static NTSTATUS
 PackParam(LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam)
 {
    NCCALCSIZE_PARAMS *UnpackedNcCalcsize;
@@ -260,7 +260,7 @@
    return STATUS_SUCCESS;
 }
 
-static FASTCALL NTSTATUS
+static NTSTATUS
 UnpackParam(LPARAM lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam)
 {
    NCCALCSIZE_PARAMS *UnpackedParams;
@@ -670,6 +670,7 @@
    PUSER_MESSAGE Message;
    BOOL Present, RemoveMessages;
    USER_REFERENCE_ENTRY Ref;
+   USHORT HitTest;
 
    /* The queues and order in which they are checked are documented in the MSDN
       article on GetMessage() */
@@ -817,7 +818,6 @@
          return TRUE;
       }
 
-      USHORT HitTest;
       if((Msg->Msg.hwnd && Msg->Msg.message >= WM_MOUSEFIRST && Msg->Msg.message <= WM_MOUSELAST) &&
             co_IntTranslateMouseMessage(ThreadQueue, &Msg->Msg, &HitTest, FALSE))
          /* FIXME - check message filter again, if the message doesn't match anymore,

Modified: trunk/reactos/subsys/win32k/ntuser/misc.c
--- trunk/reactos/subsys/win32k/ntuser/misc.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/ntuser/misc.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -176,6 +176,7 @@
    DWORD Routine)
 {
    DECLARE_RETURN(DWORD);
+   PDC dc;
 
    DPRINT("Enter NtUserCallOneParam\n");
 
@@ -198,7 +199,7 @@
         return showpointer; /* No mouse */
       }
                        
-      PDC dc = DC_LockDc(Screen);
+      dc = DC_LockDc(Screen);
 
       if (!dc)
       {
@@ -1019,7 +1020,6 @@
                         the bitmap. We'll change it's ownership to system and replace it with
                         the current wallpaper bitmap */
                      HBITMAP hOldBitmap, hNewBitmap;
-                     ASSERT(pvParam);
                      UNICODE_STRING Key = RTL_CONSTANT_STRING(L"Control Panel\\Desktop"); 
                      UNICODE_STRING Tile = RTL_CONSTANT_STRING(L"TileWallpaper"); 
                      UNICODE_STRING Style = RTL_CONSTANT_STRING(L"WallpaperStyle");
@@ -1034,7 +1034,8 @@
                      ULONG ResLength = 0;
                      ULONG TileNum = 0;
                      ULONG StyleNum = 0;
-                     
+                     ASSERT(pvParam);
+
                      hNewBitmap = *(HBITMAP*)pvParam;
                      if(hNewBitmap != NULL)
                      {

Modified: trunk/reactos/subsys/win32k/ntuser/msgqueue.c
--- trunk/reactos/subsys/win32k/ntuser/msgqueue.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/ntuser/msgqueue.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -259,7 +259,7 @@
    return Res;
 }
 
-BOOL STATIC STDCALL
+BOOL static STDCALL
 co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, HWND hWnd, UINT FilterLow, UINT FilterHigh,
                             PUSER_MESSAGE Message, BOOL Remove, PBOOL Freed,
                             PWINDOW_OBJECT ScopeWin, PPOINT ScreenPoint, BOOL FromGlobalQueue)

Modified: trunk/reactos/subsys/win32k/ntuser/painting.c
--- trunk/reactos/subsys/win32k/ntuser/painting.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/ntuser/painting.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -218,7 +218,7 @@
  * Internal function used by IntRedrawWindow.
  */
 
-STATIC VOID FASTCALL
+static VOID FASTCALL
 co_IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags)
 {
    HDC hDC;

Modified: trunk/reactos/subsys/win32k/ntuser/windc.c
--- trunk/reactos/subsys/win32k/ntuser/windc.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/ntuser/windc.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -155,7 +155,7 @@
    return(Dce);
 }
 
-VOID STATIC STDCALL
+VOID static STDCALL
 DceSetDrawable(PWINDOW_OBJECT Window OPTIONAL, HDC hDC, ULONG Flags,
                BOOL SetClipOrigin)
 {
@@ -185,7 +185,7 @@
 }
 
 
-STATIC VOID FASTCALL
+static VOID FASTCALL
 DceDeleteClipRgn(DCE* Dce)
 {
    Dce->DCXFlags &= ~(DCX_EXCLUDERGN | DCX_INTERSECTRGN);
@@ -205,7 +205,7 @@
    Dce->DCXFlags |= DCX_DCEDIRTY;
 }
 
-STATIC INT FASTCALL
+static INT FASTCALL
 DceReleaseDC(DCE* dce, BOOL EndPaint)
 {
    if (DCX_DCEBUSY != (dce->DCXFlags & (DCX_DCEEMPTY | DCX_DCEBUSY)))
@@ -241,7 +241,7 @@
    return 1;
 }
 
-STATIC VOID FASTCALL
+static VOID FASTCALL
 DceUpdateVisRgn(DCE *Dce, PWINDOW_OBJECT Window, ULONG Flags)
 {
    HANDLE hRgnVisible = NULL;

Modified: trunk/reactos/subsys/win32k/ntuser/winpos.c
--- trunk/reactos/subsys/win32k/ntuser/winpos.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/ntuser/winpos.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -248,7 +248,7 @@
 }
 
 
-VOID STATIC FASTCALL
+VOID static FASTCALL
 WinPosFindIconPos(PWINDOW_OBJECT Window, POINT *Pos)
 {
    /* FIXME */

Modified: trunk/reactos/subsys/win32k/objects/bitmaps.c
--- trunk/reactos/subsys/win32k/objects/bitmaps.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/objects/bitmaps.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -159,7 +159,7 @@
 			SetLastWin32Error(ERROR_INVALID_HANDLE);
 			return FALSE;
 		}
-		BrushOrigin = BrushObj->ptOrigin;
+		BrushOrigin = *((PPOINTL)&BrushObj->ptOrigin);
 		IntGdiInitBrushInstance(&BrushInst, BrushObj, DCDest->XlateBrush);
 	}
 	else
@@ -400,7 +400,7 @@
   return Ret;
 }
 
-static FASTCALL HBITMAP
+static HBITMAP
 IntCreateBitmapIndirect(CONST BITMAP *BM)
 {
    PBITMAPOBJ bmp;
@@ -655,6 +655,7 @@
 	SURFOBJ *SurfaceObject;
 	HPALETTE Pal = 0;
 	XLATEOBJ *XlateObj;
+    HBITMAP hBmpTmp;
 
 	dc = DC_LockDc (hDC);
 
@@ -707,7 +708,7 @@
 			static const BITMAPINFOHEADER bih = { sizeof(BITMAPINFOHEADER), 1, 1, 1, 32, BI_RGB, 0, 0, 0, 0, 0 };
 			BITMAPINFO bi;
 			RtlMoveMemory ( &(bi.bmiHeader), &bih, sizeof(bih) );
-			HBITMAP hBmpTmp = NtGdiCreateDIBitmap ( hDC, &bi.bmiHeader, 0, NULL, &bi, DIB_RGB_COLORS );
+			hBmpTmp = NtGdiCreateDIBitmap ( hDC, &bi.bmiHeader, 0, NULL, &bi, DIB_RGB_COLORS );
 			//HBITMAP hBmpTmp = NtGdiCreateBitmap ( 1, 1, 1, 32, NULL);
 			if ( hBmpTmp )
 			{
@@ -1349,8 +1350,9 @@
 	RECTL DestRect, SourceRect;
 	BOOL Status;
 	XLATEOBJ *XlateObj;
-	BLENDOBJ BlendObj = {BlendFunc};
+	BLENDOBJ BlendObj;
 	HPALETTE SourcePalette = 0, DestPalette = 0;
+    BlendObj.BlendFunction = BlendFunc;
 
 	DCDest = DC_LockDc(hDCDest);
 	if (NULL == DCDest)

Modified: trunk/reactos/subsys/win32k/objects/fillshap.c
--- trunk/reactos/subsys/win32k/objects/fillshap.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/objects/fillshap.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -1176,6 +1176,7 @@
   PGDIBRUSHOBJ   PenBrushObj, FillBrushObj;
   GDIBRUSHINST FillBrushInst, PenBrushInst;
   RECTL      RectBounds;
+  int potential_steps;
   int i, col, row, width, height, x1, x1start, x2, x2start, y1, y2;
   int xradius, yradius;
   //float aspect_square;
@@ -1338,7 +1339,7 @@
       d -= ddec;
     }
 
-    int potential_steps = ( a_square * row ) / b_square - col + 1;
+    potential_steps = ( a_square * row ) / b_square - col + 1;
     while ( d < 0 && potential_steps-- )
     {
       d += dinc; /* two_b_square * (3 + (col << 1)); */

Modified: trunk/reactos/subsys/win32k/objects/pen.c
--- trunk/reactos/subsys/win32k/objects/pen.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/objects/pen.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -136,10 +136,10 @@
    IN BOOL bOldStylePen,
    IN OPTIONAL HBRUSH hbrush)
 {
+    LOGPEN LogPen;
    /* NOTE: This is HACK! */
     DPRINT1("FIXME: FIX CALLERS FIRST!\n");
     KEBUGCHECK(0);
-   LOGPEN LogPen;
 
    if (PenStyle & PS_USERSTYLE)
       PenStyle = (PenStyle & ~PS_STYLE_MASK) | PS_SOLID;

Modified: trunk/reactos/subsys/win32k/objects/polyfill.c
--- trunk/reactos/subsys/win32k/objects/polyfill.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/objects/polyfill.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -32,7 +32,7 @@
 #define NDEBUG
 #include <debug.h>
 
-INT abs(INT nm);
+INT __cdecl abs(INT nm);
 
 #define FILL_EDGE_ALLOC_TAG 0x45465044
 
@@ -562,8 +562,7 @@
   int ScanLine;
 
   void
-  STDCALL
-  (*FillScanLine)(
+  (STDCALL *FillScanLine)(
     PDC dc,
     int ScanLine,
     FILL_EDGE* ActiveHead,

Modified: trunk/reactos/subsys/win32k/objects/region.c
--- trunk/reactos/subsys/win32k/objects/region.c	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/objects/region.c	2006-01-08 23:26:03 UTC (rev 20742)
@@ -427,8 +427,8 @@
 
 #define MEMCHECK(reg, rect, firstrect) xmemcheck(reg,&(rect),(LPRECT *)&(firstrect))
 
-typedef void FASTCALL (*overlapProcp)(PROSRGNDATA, PRECT, PRECT, PRECT, PRECT, INT, INT);
-typedef void FASTCALL (*nonOverlapProcp)(PROSRGNDATA, PRECT, PRECT, INT, INT);
+typedef void (FASTCALL *overlapProcp)(PROSRGNDATA, PRECT, PRECT, PRECT, PRECT, INT, INT);
+typedef void (FASTCALL *nonOverlapProcp)(PROSRGNDATA, PRECT, PRECT, INT, INT);
 
 // Number of points to buffer before sending them off to scanlines() :  Must be an even number
 #define NUMPTSTOBUFFER 200

Modified: trunk/reactos/subsys/win32k/w32k.h
--- trunk/reactos/subsys/win32k/w32k.h	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/w32k.h	2006-01-08 23:26:03 UTC (rev 20742)
@@ -24,12 +24,15 @@
 #define STARTF_USEPOSITION 4
 #include <stdarg.h>
 #include <windef.h>
+#include <winerror.h>
 #include <wingdi.h>
 #include <winddi.h>
 #include <winuser.h>
 #include <prntfont.h>
 #include <dde.h>
 #include <wincon.h>
+#define _NOCSECT_TYPE
+#include <ddrawi.h>
 
 /* SEH Support with PSEH */
 #include <pseh/pseh.h>
@@ -57,3 +60,11 @@
 /* Internal Win32K Header */
 #include "include/win32k.h"
 
+/* Undocumented stuff */
+typedef DRIVEROBJ *PDRIVEROBJ;
+#define WM_SYSTIMER 280
+#ifndef M_PI
+#define M_PI 3.14159265358979323846f
+#define M_PI_2 1.57079632679489661923
+#endif
+

Modified: trunk/reactos/subsys/win32k/win32k.xml
--- trunk/reactos/subsys/win32k/win32k.xml	2006-01-08 23:24:43 UTC (rev 20741)
+++ trunk/reactos/subsys/win32k/win32k.xml	2006-01-08 23:26:03 UTC (rev 20742)
@@ -63,6 +63,13 @@
 			<file>math.c</file>
 			<file>copy.c</file>
 		</compilationunit>
+		<directory name="i386">
+            <file>cos_asm.s</file>
+            <file>sin_asm.s</file>
+            <file>atan2_asm.s</file>
+            <file>floor_asm.s</file>
+            <file>ceil_asm.s</file>
+        </directory>
 	</directory>
 	<directory name="ntddraw">
 		<compilationunit name="ntddraw.c">