Commit in reactos on MAIN
include/napi/win32.h+2-21.19 -> 1.20
include/win32k/bitmaps.h+4-41.25 -> 1.26
              /brush.h+3-41.17 -> 1.18
              /dc.h+3-31.38 -> 1.39
              /gdiobj.h+24-421.25 -> 1.26
              /pen.h+3-31.10 -> 1.11
              /region.h+4-31.24 -> 1.25
              /text.h+4-41.22 -> 1.23
lib/user32/include/user32.h+9-231.30 -> 1.31
                  /window.h+4-271.11 -> 1.12
lib/user32/misc/dllmain.c-11.44 -> 1.45
               /stubs.c+16-11.66 -> 1.67
lib/user32/windows/defwnd.c+143-721.145 -> 1.146
+219-189
13 modified files
revert the changes i accidently committed to HEAD

reactos/include/napi
win32.h 1.19 -> 1.20
diff -u -r1.19 -r1.20
--- win32.h	12 Sep 2004 19:21:05 -0000	1.19
+++ win32.h	12 Sep 2004 19:47:48 -0000	1.20
@@ -34,8 +34,8 @@
   struct _WINSTATION_OBJECT* WindowStation;
   HANDLE hWindowStation;
   ULONG Flags;
-  LONG GDIObjects;
-  LONG UserObjects;
+  WORD GDIObjects;
+  WORD UserObjects;
 } W32PROCESS, *PW32PROCESS;
 
 PW32THREAD STDCALL

reactos/include/win32k
bitmaps.h 1.25 -> 1.26
diff -u -r1.25 -r1.26
--- bitmaps.h	12 Sep 2004 19:21:05 -0000	1.25
+++ bitmaps.h	12 Sep 2004 19:47:48 -0000	1.26
@@ -26,12 +26,11 @@
 /*  Internal interface  */
 
 #define  BITMAPOBJ_AllocBitmap()  \
-  ((HBITMAP) GDIOBJ_AllocObj (GDI_OBJECT_TYPE_BITMAP))
+  ((HBITMAP) GDIOBJ_AllocObj (sizeof (BITMAPOBJ), GDI_OBJECT_TYPE_BITMAP, (GDICLEANUPPROC) Bitmap_InternalDelete))
 #define  BITMAPOBJ_FreeBitmap(hBMObj)  \
-  GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP)
+  GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP, GDIOBJFLAG_DEFAULT)
 #define  BITMAPOBJ_LockBitmap(hBMObj) GDIOBJ_LockObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP)
-#define  BITMAPOBJ_UnlockBitmap(BMObj) GDIOBJ_UnlockObj((PGDIOBJ) BMObj)
-BOOL FASTCALL BITMAP_Cleanup(PBITMAPOBJ pBmp);
+#define  BITMAPOBJ_UnlockBitmap(hBMObj) GDIOBJ_UnlockObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP)
 
 INT     FASTCALL BITMAPOBJ_GetWidthBytes (INT bmWidth, INT bpp);
 HBITMAP FASTCALL BITMAPOBJ_CopyBitmap (HBITMAP  hBitmap);
@@ -39,6 +38,7 @@
 int     STDCALL  DIB_GetDIBImageBytes (INT  width, INT  height, INT  depth);
 INT     FASTCALL DIB_BitmapInfoSize (const BITMAPINFO * info, WORD coloruse);
 INT     STDCALL  BITMAP_GetObject(BITMAPOBJ * bmp, INT count, LPVOID buffer);
+BOOL    FASTCALL Bitmap_InternalDelete( PBITMAPOBJ pBmp );
 HBITMAP FASTCALL BitmapToSurf(PBITMAPOBJ BitmapObj, HDEV GDIDevice);
 
 HBITMAP FASTCALL IntCreateCompatibleBitmap(PDC Dc, INT Width, INT Height);

reactos/include/win32k
brush.h 1.17 -> 1.18
diff -u -r1.17 -r1.18
--- brush.h	12 Sep 2004 19:21:05 -0000	1.17
+++ brush.h	12 Sep 2004 19:47:48 -0000	1.18
@@ -68,11 +68,10 @@
 #define GDIBRUSH_IS_MASKING		0x8000 /* Pattern bitmap is used as transparent mask (?) */
 #define GDIBRUSH_CACHED_IS_SOLID	0x80000000 
 
-#define  BRUSHOBJ_AllocBrush() ((HBRUSH) GDIOBJ_AllocObj (GDI_OBJECT_TYPE_BRUSH))
-#define  BRUSHOBJ_FreeBrush(hBrush) GDIOBJ_FreeObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH)
+#define  BRUSHOBJ_AllocBrush() ((HBRUSH) GDIOBJ_AllocObj (sizeof(GDIBRUSHOBJ), GDI_OBJECT_TYPE_BRUSH, (GDICLEANUPPROC) Brush_InternalDelete))
+#define  BRUSHOBJ_FreeBrush(hBrush) GDIOBJ_FreeObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH, GDIOBJFLAG_DEFAULT)
 #define  BRUSHOBJ_LockBrush(hBrush) ((PGDIBRUSHOBJ)GDIOBJ_LockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH))
-#define  BRUSHOBJ_UnlockBrush(BrushObj) GDIOBJ_UnlockObj((PGDIOBJ)BrushObj)
-BOOL FASTCALL BRUSH_Cleanup(PGDIBRUSHOBJ pBrush);
+#define  BRUSHOBJ_UnlockBrush(hBrush) GDIOBJ_UnlockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH)
 
 #ifdef __USE_W32API
 typedef struct _PATRECT {

reactos/include/win32k
dc.h 1.38 -> 1.39
diff -u -r1.38 -r1.39
--- dc.h	12 Sep 2004 19:21:05 -0000	1.38
+++ dc.h	12 Sep 2004 19:47:48 -0000	1.39
@@ -140,17 +140,17 @@
 
 #define  DC_LockDc(hDC)  \
   ((PDC) GDIOBJ_LockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC))
-#define  DC_UnlockDc(DC)  \
-  GDIOBJ_UnlockObj ((PGDIOBJ) DC)
+#define  DC_UnlockDc(hDC)  \
+  GDIOBJ_UnlockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC)
 
 HDC  FASTCALL RetrieveDisplayHDC(VOID);
 HDC  FASTCALL DC_AllocDC(PUNICODE_STRING  Driver);
 VOID FASTCALL DC_InitDC(HDC  DCToInit);
 HDC  FASTCALL DC_FindOpenDC(PUNICODE_STRING  Driver);
 VOID FASTCALL DC_FreeDC(HDC  DCToFree);
-BOOL FASTCALL DC_Cleanup(PDC pDc);
 HDC  FASTCALL DC_GetNextDC (PDC pDC);
 VOID FASTCALL DC_SetNextDC (PDC pDC, HDC hNextDC);
+BOOL FASTCALL DC_InternalDeleteDC( PDC DCToDelete );
 VOID FASTCALL DC_SetOwnership(HDC DC, PEPROCESS Owner);
 
 VOID FASTCALL DC_UpdateXforms(PDC  dc);

reactos/include/win32k
gdiobj.h 1.25 -> 1.26
diff -u -r1.25 -r1.26
--- gdiobj.h	12 Sep 2004 19:21:05 -0000	1.25
+++ gdiobj.h	12 Sep 2004 19:47:48 -0000	1.26
@@ -8,25 +8,6 @@
 
 #include <ddk/ntddk.h>
 
-/* base address where the handle table is mapped to */
-#define GDI_HANDLE_TABLE_BASE_ADDRESS (0x400000)
-
-/* gdi handle table can hold 0x4000 handles */
-#define GDI_HANDLE_COUNT 0x4000
-
-#define GDI_GLOBAL_PROCESS (0x0)
-
-#define GDI_HANDLE_INDEX_MASK (GDI_HANDLE_COUNT - 1)
-#define GDI_HANDLE_TYPE_MASK  0x007f0000
-#define GDI_HANDLE_STOCK_MASK 0x00800000
-
-#define GDI_HANDLE_CREATE(i, t)    ((HANDLE)(((i) & GDI_HANDLE_INDEX_MASK) | ((t) & GDI_HANDLE_TYPE_MASK)))
-#define GDI_HANDLE_GET_INDEX(h)    (((DWORD)(h)) & GDI_HANDLE_INDEX_MASK)
-#define GDI_HANDLE_GET_TYPE(h)     (((DWORD)(h)) & GDI_HANDLE_TYPE_MASK)
-#define GDI_HANDLE_IS_TYPE(h, t)   ((t) == (((DWORD)(h)) & GDI_HANDLE_TYPE_MASK))
-#define GDI_HANDLE_IS_STOCKOBJ(h)  (0 != (((DWORD)(h)) & GDI_HANDLE_STOCK_MASK))
-#define GDI_HANDLE_SET_STOCKOBJ(h) ((h) = (HANDLE)(((DWORD)(h)) | GDI_HANDLE_STOCK_MASK))
-
 /*! \defgroup GDI object types
  *
  *  GDI object types
@@ -56,18 +37,26 @@
 
 typedef BOOL (FASTCALL *GDICLEANUPPROC)(PGDIOBJ Obj);
 
+#define GDIOBJ_USE_FASTMUTEX
+
 /*!
  * GDI object header. This is a part of any GDI object
 */
 typedef struct _GDIOBJHDR
 {
-  LONG RefCount; /* reference count for the object */
-  struct _W32THREAD *LockingThread; /* only assigned if a thread is holding the lock! */
-  ULONG Type;
-  PPAGED_LOOKASIDE_LIST LookasideList; /* FIXME - remove this */
-#ifdef GDI_DEBUG
+  DWORD dwCount; 		/* reference count for the object */
+  HANDLE hProcessId;
+  GDICLEANUPPROC CleanupProc;
+  WORD wTableIndex;
+  WORD Magic;
   const char* lockfile;
   int lockline;
+#ifdef GDIOBJ_USE_FASTMUTEX
+  FAST_MUTEX Lock;
+  DWORD RecursiveLockCount;
+#else
+  DWORD LockTid;
+  DWORD LockCount;
 #endif
 } GDIOBJHDR, *PGDIOBJHDR;
 
@@ -78,39 +67,32 @@
   DWORD	ObjectType;
 } GDIMULTILOCK, *PGDIMULTILOCK;
 
-HGDIOBJ FASTCALL GDIOBJ_AllocObj(ULONG ObjectType);
-BOOL    FASTCALL GDIOBJ_FreeObj (HGDIOBJ Obj, DWORD ObjectType);
+HGDIOBJ FASTCALL GDIOBJ_AllocObj(WORD Size, DWORD ObjectType, GDICLEANUPPROC CleanupProcPtr);
+BOOL    STDCALL  GDIOBJ_FreeObj (HGDIOBJ Obj, DWORD ObjectType, DWORD Flag);
+PGDIOBJ FASTCALL GDIOBJ_LockObj (HGDIOBJ Obj, DWORD ObjectType);
 BOOL    FASTCALL GDIOBJ_LockMultipleObj(PGDIMULTILOCK pList, INT nObj);
+BOOL    FASTCALL GDIOBJ_UnlockObj (HGDIOBJ Obj, DWORD ObjectType);
 BOOL    FASTCALL GDIOBJ_UnlockMultipleObj(PGDIMULTILOCK pList, INT nObj);
+DWORD   FASTCALL GDIOBJ_GetObjectType(HGDIOBJ ObjectHandle);
 BOOL    FASTCALL GDIOBJ_OwnedByCurrentProcess(HGDIOBJ ObjectHandle);
 void    FASTCALL GDIOBJ_SetOwnership(HGDIOBJ ObjectHandle, PEPROCESS Owner);
 void    FASTCALL GDIOBJ_CopyOwnership(HGDIOBJ CopyFrom, HGDIOBJ CopyTo);
-BOOL    FASTCALL GDIOBJ_ConvertToStockObj(HGDIOBJ *hObj);
 BOOL    FASTCALL GDIOBJ_LockMultipleObj(PGDIMULTILOCK pList, INT nObj);
 
-#define GDIOBJ_GetObjectType(Handle) \
-  GDI_HANDLE_GET_TYPE(Handle)
-
-#ifdef GDI_DEBUG
-
 /* a couple macros for debugging GDIOBJ locking */
 #define GDIOBJ_LockObj(obj,ty) GDIOBJ_LockObjDbg(__FILE__,__LINE__,obj,ty)
-#define GDIOBJ_UnlockObj(obj) GDIOBJ_UnlockObjDbg(__FILE__,__LINE__,obj)
+#define GDIOBJ_UnlockObj(obj,ty) GDIOBJ_UnlockObjDbg(__FILE__,__LINE__,obj,ty)
 
+#ifdef GDIOBJ_LockObj
 PGDIOBJ FASTCALL GDIOBJ_LockObjDbg (const char* file, int line, HGDIOBJ Obj, DWORD ObjectType);
-BOOL FASTCALL GDIOBJ_UnlockObjDbg (const char* file, int line, PGDIOBJ Object);
-
-#else /* !GDI_DEBUG */
+#endif /* GDIOBJ_LockObj */
 
-PGDIOBJ FASTCALL GDIOBJ_LockObj (HGDIOBJ Obj, DWORD ObjectType);
-BOOL    FASTCALL GDIOBJ_UnlockObj (PGDIOBJ Object);
-
-#endif /* GDI_DEBUG */
+#ifdef GDIOBJ_UnlockObj
+BOOL FASTCALL GDIOBJ_UnlockObjDbg (const char* file, int line, HGDIOBJ Obj, DWORD ObjectType);
+#endif /* GDIOBJ_UnlockObj */
 
 #define GDIOBJFLAG_DEFAULT	(0x0)
 #define GDIOBJFLAG_IGNOREPID 	(0x1)
 #define GDIOBJFLAG_IGNORELOCK 	(0x2)
 
-PVOID   FASTCALL GDI_MapHandleTable(HANDLE hProcess);
-
 #endif

reactos/include/win32k
pen.h 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- pen.h	12 Sep 2004 19:21:05 -0000	1.10
+++ pen.h	12 Sep 2004 19:47:48 -0000	1.11
@@ -6,10 +6,10 @@
 
 /* Internal interface */
 
-#define PENOBJ_AllocPen() ((HPEN)GDIOBJ_AllocObj(GDI_OBJECT_TYPE_PEN))
-#define PENOBJ_FreePen(hBMObj) GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN)
+#define PENOBJ_AllocPen() ((HPEN)GDIOBJ_AllocObj(sizeof(GDIBRUSHOBJ), GDI_OBJECT_TYPE_PEN, NULL))
+#define PENOBJ_FreePen(hBMObj) GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN, GDIOBJFLAG_DEFAULT)
 #define PENOBJ_LockPen(hBMObj) ((PGDIBRUSHOBJ)GDIOBJ_LockObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN))
-#define PENOBJ_UnlockPen(BMObj) GDIOBJ_UnlockObj((PGDIOBJ) BMObj)
+#define PENOBJ_UnlockPen(hBMObj) GDIOBJ_UnlockObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN)
 
 HPEN STDCALL
 NtGdiCreatePen(

reactos/include/win32k
region.h 1.24 -> 1.25
diff -u -r1.24 -r1.25
--- region.h	12 Sep 2004 19:21:05 -0000	1.24
+++ region.h	12 Sep 2004 19:47:48 -0000	1.25
@@ -11,11 +11,12 @@
 } ROSRGNDATA, *PROSRGNDATA, *LPROSRGNDATA;
 
 
-#define  RGNDATA_FreeRgn(hRgn)  GDIOBJ_FreeObj((HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION)
+#define  RGNDATA_FreeRgn(hRgn)  GDIOBJ_FreeObj((HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION, GDIOBJFLAG_DEFAULT)
 #define  RGNDATA_LockRgn(hRgn) ((PROSRGNDATA)GDIOBJ_LockObj((HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION))
-#define  RGNDATA_UnlockRgn(Rgn) GDIOBJ_UnlockObj((PGDIOBJ)Rgn)
+#define  RGNDATA_UnlockRgn(hRgn) GDIOBJ_UnlockObj((HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION)
 HRGN FASTCALL RGNDATA_AllocRgn(INT n);
-BOOL FASTCALL RGNDATA_Cleanup(PROSRGNDATA pRgn);
+
+BOOL FASTCALL RGNDATA_InternalDelete( PROSRGNDATA Obj );
 
 /*  User entry points */
 HRGN STDCALL

reactos/include/win32k
text.h 1.22 -> 1.23
diff -u -r1.22 -r1.23
--- text.h	12 Sep 2004 19:21:05 -0000	1.22
+++ text.h	12 Sep 2004 19:47:48 -0000	1.23
@@ -6,16 +6,16 @@
 typedef struct
 {
    LOGFONTW   logfont;
-   FONTOBJ    *Font;
+   HFONT      GDIFontHandle;
 } TEXTOBJ, *PTEXTOBJ;
 
 /*  Internal interface  */
 
 #define  TEXTOBJ_AllocText() \
-  ((HFONT) GDIOBJ_AllocObj (GDI_OBJECT_TYPE_FONT))
-#define  TEXTOBJ_FreeText(hBMObj)  GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT)
+  ((HFONT) GDIOBJ_AllocObj (sizeof (TEXTOBJ), GDI_OBJECT_TYPE_FONT, NULL))
+#define  TEXTOBJ_FreeText(hBMObj)  GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT, GDIOBJFLAG_DEFAULT)
 #define  TEXTOBJ_LockText(hBMObj) ((PTEXTOBJ) GDIOBJ_LockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT))
-#define  TEXTOBJ_UnlockText(BMObj) GDIOBJ_UnlockObj ((PGDIOBJ) BMObj)
+#define  TEXTOBJ_UnlockText(hBMObj) GDIOBJ_UnlockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT)
 
 NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle);
 NTSTATUS FASTCALL TextIntCreateFontIndirect(CONST LPLOGFONTW lf, HFONT *NewFont);

reactos/lib/user32/include
user32.h 1.30 -> 1.31
diff -u -r1.30 -r1.31
--- user32.h	12 Sep 2004 19:21:05 -0000	1.30
+++ user32.h	12 Sep 2004 19:47:49 -0000	1.31
@@ -30,21 +30,10 @@
   BYTE Showing;
 } THRDCARETINFO, *PTHRDCARETINFO;
 
-void InitStockObjects(void);
 VOID CreateFrameBrushes(VOID);
 VOID DeleteFrameBrushes(VOID);
 void DrawCaret(HWND hWnd, PTHRDCARETINFO CaretInfo);
 
-LONG WINAPI RegCloseKey(HKEY);
-LONG WINAPI RegOpenKeyExW(HKEY,LPCWSTR,DWORD,REGSAM,PHKEY);
-LONG WINAPI RegQueryValueExW(HKEY,LPCWSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
-
-#ifdef __USE_W32API
-NTSTATUS STDCALL ZwCallbackReturn(PVOID Result,
-				  ULONG ResultLength,
-				  NTSTATUS Status);
-#endif
-
 #define NtUserAnyPopup() \
   (BOOL)NtUserCallNoParam(NOPARAM_ROUTINE_ANYPOPUP)
 
@@ -72,18 +61,6 @@
 #define NtUserRegisterLogonProcess(hproc, x) \
   (BOOL)NtUserCallTwoParam((DWORD)hproc, (DWORD)x, TWOPARAM_ROUTINE_REGISTERLOGONPROC)
 
-#define NtUserGetSysColorBrushes(HBrushes, count) \
-  (BOOL)NtUserCallTwoParam((DWORD)(HBrushes), (DWORD)(count), TWOPARAM_ROUTINE_GETSYSCOLORBRUSHES)
-
-#define NtUserGetSysColorPens(HPens, count) \
-  (BOOL)NtUserCallTwoParam((DWORD)(HPens), (DWORD)(count), TWOPARAM_ROUTINE_GETSYSCOLORPENS)
-
-#define NtUserGetSysColors(ColorRefs, count) \
-  (BOOL)NtUserCallTwoParam((DWORD)(ColorRefs), (DWORD)(count), TWOPARAM_ROUTINE_GETSYSCOLORS)
-
-#define NtUserSetSysColors(ColorRefs, count) \
-  (BOOL)NtUserCallTwoParam((DWORD)(ColorRefs), (DWORD)(count), TWOPARAM_ROUTINE_SETSYSCOLORS)
-
 #define NtUserSetCaretBlinkTime(uMSeconds) \
   (BOOL)NtUserCallOneParam((DWORD)uMSeconds, ONEPARAM_ROUTINE_SETCARETBLINKTIME)
 
@@ -123,3 +100,12 @@
 #define NtUserEnableProcessWindowGhosting(bEnable) \
   NtUserCallOneParam((DWORD)bEnable, ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING)
 
+LONG WINAPI RegCloseKey(HKEY);
+LONG WINAPI RegOpenKeyExW(HKEY,LPCWSTR,DWORD,REGSAM,PHKEY);
+LONG WINAPI RegQueryValueExW(HKEY,LPCWSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
+
+#ifdef __USE_W32API
+NTSTATUS STDCALL ZwCallbackReturn(PVOID Result,
+				  ULONG ResultLength,
+				  NTSTATUS Status);
+#endif

reactos/lib/user32/include
window.h 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- window.h	12 Sep 2004 19:21:05 -0000	1.11
+++ window.h	12 Sep 2004 19:47:49 -0000	1.12
@@ -7,37 +7,14 @@
 #include <windows.h>
 #include <user32/wininternal.h>
 
-extern COLORREF SysColors[];
-extern HPEN SysPens[];
-extern HBRUSH SysBrushes[];
-
-#define NUM_SYSCOLORS 31
-
 #define IS_ATOM(x) \
   (((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000))
 
-#define UserHasAnyFrameStyle(Style, ExStyle)                                   \
-  (((Style) & (WS_THICKFRAME | WS_DLGFRAME | WS_BORDER)) ||                    \
-   ((ExStyle) & WS_EX_DLGMODALFRAME) ||                                        \
-   (!((Style) & (WS_CHILD | WS_POPUP))))
-
-#define UserHasDlgFrameStyle(Style, ExStyle)                                   \
- (((ExStyle) & WS_EX_DLGMODALFRAME) ||                                         \
-  (((Style) & WS_DLGFRAME) && (!((Style) & WS_THICKFRAME))))
-
-#define UserHasThickFrameStyle(Style, ExStyle)                                 \
-  (((Style) & WS_THICKFRAME) &&                                                \
-   (!(((Style) & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME)))
-
-#define UserHasThinFrameStyle(Style, ExStyle)                                  \
-  (((Style) & WS_BORDER) || (!((Style) & (WS_CHILD | WS_POPUP))))
-
-#define UserHasBigFrameStyle(Style, ExStyle)                                   \
-  (((Style) & (WS_THICKFRAME | WS_DLGFRAME)) ||                                \
-   ((ExStyle) & WS_EX_DLGMODALFRAME))
-
-
 BOOL UserDrawSysMenuButton( HWND hWnd, HDC hDC, LPRECT, BOOL down );
+ULONG
+UserHasDlgFrameStyle(ULONG Style, ULONG ExStyle);
+ULONG
+UserHasThickFrameStyle(ULONG Style, ULONG ExStyle);
 void
 UserGetFrameSize(ULONG Style, ULONG ExStyle, SIZE *Size);
 void

reactos/lib/user32/misc
dllmain.c 1.44 -> 1.45
diff -u -r1.44 -r1.45
--- dllmain.c	12 Sep 2004 19:21:05 -0000	1.44
+++ dllmain.c	12 Sep 2004 19:47:49 -0000	1.45
@@ -76,7 +76,6 @@
   InitializeCriticalSection(&gcsMPH);
 
   GdiDllInitialize(NULL, DLL_PROCESS_ATTACH, NULL);
-  InitStockObjects();
 }
 
 VOID

reactos/lib/user32/misc
stubs.c 1.66 -> 1.67
diff -u -r1.66 -r1.67
--- stubs.c	12 Sep 2004 19:21:05 -0000	1.66
+++ stubs.c	12 Sep 2004 19:47:49 -0000	1.67
@@ -1,4 +1,4 @@
-/* $Id: stubs.c,v 1.66 2004/09/12 19:21:05 weiden Exp $
+/* $Id: stubs.c,v 1.67 2004/09/12 19:47:49 weiden Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
@@ -190,6 +190,21 @@
  */
 BOOL
 STDCALL
+SetSysColors(
+  int cElements,
+  CONST INT *lpaElements,
+  CONST COLORREF *lpaRgbValues)
+{
+  UNIMPLEMENTED;
+  return FALSE;
+}
+
+
+/*
+ * @unimplemented
+ */
+BOOL
+STDCALL
 TrackMouseEvent(
   LPTRACKMOUSEEVENT lpEventTrack)
 {

reactos/lib/user32/windows
defwnd.c 1.145 -> 1.146
diff -u -r1.145 -r1.146
--- defwnd.c	12 Sep 2004 19:21:06 -0000	1.145
+++ defwnd.c	12 Sep 2004 19:47:49 -0000	1.146
@@ -1,4 +1,4 @@
-/* $Id: defwnd.c,v 1.145 2004/09/12 19:21:06 weiden Exp $
+/* $Id: defwnd.c,v 1.146 2004/09/12 19:47:49 weiden Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
@@ -41,46 +41,70 @@
 
 /* GLOBALS *******************************************************************/
 
-static COLORREF SysColors[NUM_SYSCOLORS] = {0};
-static HPEN SysPens[NUM_SYSCOLORS] = {0};
-static HBRUSH SysBrushes[NUM_SYSCOLORS] = {0};
+/* TODO:  widgets will be cached here.
+static HBITMAP hbClose;
+static HBITMAP hbCloseD;
+static HBITMAP hbMinimize;
+static HBITMAP hbMinimizeD;
+static HBITMAP hbRestore;
+static HBITMAP hbRestoreD;
+static HBITMAP hbMaximize;
+static HBITMAP hbScrUp;
+static HBITMAP hbScrDwn;
+static HBITMAP hbScrLeft;
+static HBITMAP hbScrRight;
+*/
+
+
+static COLORREF SysColors[] =
+{
+  RGB(212, 208, 200), /* COLOR_SCROLLBAR  */
+  RGB(58, 110, 165),  /* COLOR_BACKGROUND  */
+  RGB(10, 36, 106),   /* COLOR_ACTIVECAPTION  */
+  RGB(128, 128, 128), /* COLOR_INACTIVECAPTION  */
+  RGB(212, 208, 200), /* COLOR_MENU  */
+  RGB(255, 255, 255), /* COLOR_WINDOW  */
+  RGB(0, 0, 0),       /* COLOR_WINDOWFRAME  */
+  RGB(0, 0, 0),       /* COLOR_MENUTEXT  */
+  RGB(0, 0, 0),       /* COLOR_WINDOWTEXT  */
+  RGB(255, 255, 255), /* COLOR_CAPTIONTEXT  */
+  RGB(212, 208, 200), /* COLOR_ACTIVEBORDER  */
+  RGB(212, 208, 200), /* COLOR_INACTIVEBORDER  */
+  RGB(128, 128, 128), /* COLOR_APPWORKSPACE  */
+  RGB(10, 36, 106),   /* COLOR_HIGHLIGHT  */
+  RGB(255, 255, 255), /* COLOR_HIGHLIGHTTEXT  */
+  RGB(212, 208, 200), /* COLOR_BTNFACE  */
+  RGB(128, 128, 128), /* COLOR_BTNSHADOW  */
+  RGB(128, 128, 128), /* COLOR_GRAYTEXT  */
+  RGB(0, 0, 0),       /* COLOR_BTNTEXT  */
+  RGB(212, 208, 200), /* COLOR_INACTIVECAPTIONTEXT  */
+  RGB(255, 255, 255), /* COLOR_BTNHIGHLIGHT  */
+  RGB(64, 64, 64),    /* COLOR_3DDKSHADOW  */
+  RGB(212, 208, 200), /* COLOR_3DLIGHT  */
+  RGB(0, 0, 0),       /* COLOR_INFOTEXT  */
+  RGB(255, 255, 225), /* COLOR_INFOBK  */
+  RGB(181, 181, 181), /* COLOR_UNKNOWN  */
+  RGB(0, 0, 128),     /* COLOR_HOTLIGHT  */
+  RGB(166, 202, 240), /* COLOR_GRADIENTACTIVECAPTION  */
+  RGB(192, 192, 192), /* COLOR_GRADIENTINACTIVECAPTION  */
+  RGB(49, 106, 197),  /* COLOR_MENUHILIGHT  */
+  RGB(236, 233, 216)  /* COLOR_MENUBAR  */
+};
+
+#define NUM_SYSCOLORS (sizeof(SysColors) / sizeof(SysColors[0]))
 
 /* Bits in the dwKeyData */
 #define KEYDATA_ALT   0x2000
 
 /* FUNCTIONS *****************************************************************/
 
-void
-InitStockObjects(void)
-{
-  /* FIXME - Instead of copying the stuff to usermode we should map the tables to
-             userland. The current implementation has one big flaw: the system color
-             table doesn't get updated when another process changes them. That's why
-             we should rather map the table into usermode. But it only affects the
-             SysColors table - the pens, brushes and stock objects are not affected
-             as their handles never change. But it'd be faster to map them, too. */
-  if(SysBrushes[0] == NULL)
-  {
-    /* only initialize once */
-    NtUserGetSysColors(SysColors, NUM_SYSCOLORS);
-    NtUserGetSysColorPens(SysPens, NUM_SYSCOLORS);
-    NtUserGetSysColorBrushes(SysBrushes, NUM_SYSCOLORS);
-  }
-}
-
 /*
  * @implemented
  */
 DWORD STDCALL
 GetSysColor(int nIndex)
 {
-  if(nIndex >= 0 && nIndex <= NUM_SYSCOLORS)
-  {
     return SysColors[nIndex];
-  }
-  
-  SetLastError(ERROR_INVALID_PARAMETER);
-  return 0;
 }
 
 /*
@@ -89,13 +113,22 @@
 HPEN STDCALL
 GetSysColorPen(int nIndex)
 {
-  if(nIndex >= 0 && nIndex <= NUM_SYSCOLORS)
-  {
-    return SysPens[nIndex];
-  }
+  static HPEN SysPens[NUM_SYSCOLORS];
 
-  SetLastError(ERROR_INVALID_PARAMETER);
-  return NULL;
+  if (nIndex < 0 || NUM_SYSCOLORS < nIndex)
+    {
+      SetLastError(ERROR_INVALID_PARAMETER);
+      return NULL;
+    }
+
+  /* FIXME should register this object with DeleteObject() so it
+     can't be deleted */
+  if (NULL == SysPens[nIndex])
+    {
+      SysPens[nIndex] = CreatePen(PS_SOLID, 1, SysColors[nIndex]);
+    }
+
+  return SysPens[nIndex];
 }
 
 /*
@@ -104,51 +137,89 @@
 HBRUSH STDCALL
 GetSysColorBrush(int nIndex)
 {
-  if(nIndex >= 0 && nIndex <= NUM_SYSCOLORS)
-  {
-    return SysBrushes[nIndex];
-  }
+  static HBRUSH SysBrushes[NUM_SYSCOLORS];
 
-  SetLastError(ERROR_INVALID_PARAMETER);
-  return NULL;
+  if (nIndex < 0 || NUM_SYSCOLORS < nIndex)
+    {
+      SetLastError(ERROR_INVALID_PARAMETER);
+      return NULL;
+    }
+
+  /* FIXME should register this object with DeleteObject() so it
+     can't be deleted */
+  if (NULL == SysBrushes[nIndex])
+    {
+      SysBrushes[nIndex] = (HBRUSH) ((DWORD) CreateSolidBrush(SysColors[nIndex]) | 0x00800000);
+    }
+
+  return SysBrushes[nIndex];
 }
 
 /*
- * @implemented
+ * @unimplemented
  */
-BOOL
-STDCALL
-SetSysColors(
-  int cElements,
-  CONST INT *lpaElements,
-  CONST COLORREF *lpaRgbValues)
+/*
+LRESULT STDCALL
+DefFrameProcA( HWND hWnd,
+	      HWND hWndMDIClient,
+	      UINT uMsg,
+	      WPARAM wParam,
+	      LPARAM lParam )
 {
-  BOOL Ret;
-  struct
-  {
-    INT *Elements;
-    COLORREF *Colors;
-  } ChangeSysColors;
+    UNIMPLEMENTED;
+    return ((LRESULT)0);
+}
+*/
 
-  ChangeSysColors.Elements = (INT*)lpaElements;
-  ChangeSysColors.Colors = (COLORREF*)lpaRgbValues;
-  
-  if(cElements > 0)
-  {
-    Ret = NtUserSetSysColors(&ChangeSysColors, cElements);
-    if(Ret)
-    {
-      /* FIXME - just change it in the usermode structure, too, instead of asking win32k again */
-      NtUserGetSysColors(SysColors, NUM_SYSCOLORS);
-    }
-  }
-  else
-  {
-    SetLastError(ERROR_INVALID_PARAMETER);
-    Ret = FALSE;
-  }
-  
-  return Ret;
+/*
+ * @unimplemented
+ */
+/*
+LRESULT STDCALL
+DefFrameProcW(HWND hWnd,
+	      HWND hWndMDIClient,
+	      UINT uMsg,
+	      WPARAM wParam,
+	      LPARAM lParam)
+{
+    UNIMPLEMENTED;
+    return ((LRESULT)0);
+}
+*/
+
+ULONG
+UserHasAnyFrameStyle(ULONG Style, ULONG ExStyle)
+{
+    return ((Style & (WS_THICKFRAME | WS_DLGFRAME | WS_BORDER)) ||
+            (ExStyle & WS_EX_DLGMODALFRAME) ||
+            (!(Style & (WS_CHILD | WS_POPUP))));
+}
+
+ULONG
+UserHasDlgFrameStyle(ULONG Style, ULONG ExStyle)
+{
+    return ((ExStyle & WS_EX_DLGMODALFRAME) ||
+            ((Style & WS_DLGFRAME) && (!(Style & WS_THICKFRAME))));
+}
+
+ULONG
+UserHasThickFrameStyle(ULONG Style, ULONG ExStyle)
+{
+    return ((Style & WS_THICKFRAME) &&
+            (!((Style & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME)));
+}
+
+ULONG
+UserHasThinFrameStyle(ULONG Style, ULONG ExStyle)
+{
+    return ((Style & WS_BORDER) || (!(Style & (WS_CHILD | WS_POPUP))));
+}
+
+ULONG
+UserHasBigFrameStyle(ULONG Style, ULONG ExStyle)
+{
+    return ((Style & (WS_THICKFRAME | WS_DLGFRAME)) ||
+            (ExStyle & WS_EX_DLGMODALFRAME));
 }
 
 void
CVSspam 0.2.8