[ros-diffs] [tkreuzer] 32497: Bye, bye, GDIOBJ header! You've served us well, but now the time has come for you to make room for BASEOBJECT. Also bye, bye, HandleTable parameter. You've never done any reasonable job, so no one will be missing you.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Wed Feb 27 00:09:22 CET 2008


Author: tkreuzer
Date: Wed Feb 27 02:09:20 2008
New Revision: 32497

URL: http://svn.reactos.org/svn/reactos?rev=32497&view=rev
Log:
Bye, bye, GDIOBJ header! You've served us well, but now the time has come for you to make room for BASEOBJECT.
Also bye, bye, HandleTable parameter. You've never done any reasonable job, so no one will be missing you.

Modified:
    trunk/reactos/subsystems/win32/win32k/eng/palette.c
    trunk/reactos/subsystems/win32/win32k/eng/surface.c
    trunk/reactos/subsystems/win32/win32k/include/bitmaps.h
    trunk/reactos/subsystems/win32/win32k/include/brush.h
    trunk/reactos/subsystems/win32/win32k/include/dc.h
    trunk/reactos/subsystems/win32/win32k/include/gdiobj.h
    trunk/reactos/subsystems/win32/win32k/include/palette.h
    trunk/reactos/subsystems/win32/win32k/include/pen.h
    trunk/reactos/subsystems/win32/win32k/include/region.h
    trunk/reactos/subsystems/win32/win32k/include/text.h
    trunk/reactos/subsystems/win32/win32k/main/dllmain.c
    trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
    trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
    trunk/reactos/subsystems/win32/win32k/ntuser/painting.c
    trunk/reactos/subsystems/win32/win32k/ntuser/windc.c
    trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c
    trunk/reactos/subsystems/win32/win32k/objects/brush.c
    trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c
    trunk/reactos/subsystems/win32/win32k/objects/color.c
    trunk/reactos/subsystems/win32/win32k/objects/dc.c
    trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
    trunk/reactos/subsystems/win32/win32k/objects/palobj.c
    trunk/reactos/subsystems/win32/win32k/objects/region.c
    trunk/reactos/subsystems/win32/win32k/objects/stockobj.c

Modified: trunk/reactos/subsystems/win32/win32k/eng/palette.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng/palette.c?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/palette.c (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/palette.c Wed Feb 27 02:09:20 2008
@@ -68,7 +68,7 @@
    Palette = PALETTE_AllocPalette(Mode, NumColors, Colors, Red, Green, Blue);
    if (Palette != NULL)
    {
-      GDIOBJ_SetOwnership(GdiHandleTable, Palette, NULL);
+      GDIOBJ_SetOwnership(Palette, NULL);
    }
 
    return Palette;
@@ -80,7 +80,7 @@
 BOOL STDCALL
 EngDeletePalette(IN HPALETTE Palette)
 {
-   GDIOBJ_SetOwnership(GdiHandleTable, Palette, PsGetCurrentProcess());
+   GDIOBJ_SetOwnership(Palette, PsGetCurrentProcess());
 
    return PALETTE_FreePalette(Palette);
 }

Modified: trunk/reactos/subsystems/win32/win32k/eng/surface.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/eng/surface.c?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/surface.c (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/surface.c Wed Feb 27 02:09:20 2008
@@ -379,7 +379,7 @@
   if ( !NewBitmap )
 	  return 0;
 
-  GDIOBJ_SetOwnership(GdiHandleTable, NewBitmap, NULL);
+  GDIOBJ_SetOwnership(NewBitmap, NULL);
 
   return NewBitmap;
 }
@@ -400,7 +400,7 @@
   if (NewSurface == NULL)
 	return 0;
 
-  GDIOBJ_SetOwnership(GdiHandleTable, NewSurface, NULL);
+  GDIOBJ_SetOwnership(NewSurface, NULL);
 
   BitmapObj = BITMAPOBJ_LockBitmap(NewSurface);
   if (! BITMAPOBJ_InitBitsLock(BitmapObj))
@@ -512,7 +512,7 @@
 BOOL STDCALL
 EngDeleteSurface(IN HSURF Surface)
 {
-   GDIOBJ_SetOwnership(GdiHandleTable, Surface, PsGetCurrentProcess());
+   GDIOBJ_SetOwnership(Surface, PsGetCurrentProcess());
    BITMAPOBJ_FreeBitmap(Surface);
    return TRUE;
 }
@@ -550,7 +550,7 @@
 SURFOBJ * STDCALL
 EngLockSurface(IN HSURF Surface)
 {
-   BITMAPOBJ *bmp = GDIOBJ_ShareLockObj(GdiHandleTable, Surface, GDI_OBJECT_TYPE_BITMAP);
+   BITMAPOBJ *bmp = GDIOBJ_ShareLockObj(Surface, GDI_OBJECT_TYPE_BITMAP);
 
    if (bmp != NULL)
       return &bmp->SurfObj;
@@ -577,7 +577,7 @@
    if (Surface != NULL)
    {
       BITMAPOBJ *bmp = CONTAINING_RECORD(Surface, BITMAPOBJ, SurfObj);
-      GDIOBJ_UnlockObjByPtr(GdiHandleTable, bmp);
+      GDIOBJ_ShareUnlockObjByPtr((POBJ)bmp);
    }
 }
 

Modified: trunk/reactos/subsystems/win32/win32k/include/bitmaps.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/bitmaps.h?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/bitmaps.h (original)
+++ trunk/reactos/subsystems/win32/win32k/include/bitmaps.h Wed Feb 27 02:09:20 2008
@@ -27,14 +27,14 @@
 /*  Internal interface  */
 
 #define  BITMAPOBJ_AllocBitmap()  \
-  ((HBITMAP) GDIOBJ_AllocObj (GdiHandleTable, GDI_OBJECT_TYPE_BITMAP))
+  ((HBITMAP) GDIOBJ_AllocObj (GDI_OBJECT_TYPE_BITMAP))
 #define  BITMAPOBJ_FreeBitmap(hBMObj)  \
-  GDIOBJ_FreeObj(GdiHandleTable, (HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP)
+  GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP)
 /* NOTE: Use shared locks! */
 #define  BITMAPOBJ_LockBitmap(hBMObj) \
-  ((PBITMAPOBJ) GDIOBJ_ShareLockObj (GdiHandleTable, (HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP))
+  ((PBITMAPOBJ) GDIOBJ_ShareLockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_BITMAP))
 #define  BITMAPOBJ_UnlockBitmap(pBMObj)  \
-  GDIOBJ_UnlockObjByPtr (GdiHandleTable, pBMObj)
+  GDIOBJ_ShareUnlockObjByPtr ((POBJ)pBMObj)
 
 BOOL INTERNAL_CALL BITMAP_Cleanup(PVOID ObjectBody);
 

Modified: trunk/reactos/subsystems/win32/win32k/include/brush.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/brush.h?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/brush.h (original)
+++ trunk/reactos/subsystems/win32/win32k/include/brush.h Wed Feb 27 02:09:20 2008
@@ -72,10 +72,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 (GdiHandleTable, GDI_OBJECT_TYPE_BRUSH))
-#define  BRUSHOBJ_FreeBrush(hBrush) GDIOBJ_FreeObj(GdiHandleTable, (HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH)
-#define  BRUSHOBJ_LockBrush(hBrush) ((PGDIBRUSHOBJ)GDIOBJ_LockObj(GdiHandleTable, (HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH))
-#define  BRUSHOBJ_UnlockBrush(pBrush) GDIOBJ_UnlockObjByPtr(GdiHandleTable, pBrush)
+#define  BRUSHOBJ_AllocBrush() ((HBRUSH) GDIOBJ_AllocObj (GDI_OBJECT_TYPE_BRUSH))
+#define  BRUSHOBJ_FreeBrush(hBrush) GDIOBJ_FreeObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH)
+#define  BRUSHOBJ_LockBrush(hBrush) ((PGDIBRUSHOBJ)GDIOBJ_LockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH))
+#define  BRUSHOBJ_UnlockBrush(pBrush) GDIOBJ_UnlockObjByPtr((POBJ)pBrush)
 
 INT FASTCALL BRUSH_GetObject (PGDIBRUSHOBJ GdiObject, INT Count, LPLOGBRUSH Buffer);
 BOOL INTERNAL_CALL BRUSH_Cleanup(PVOID ObjectBody);

Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/dc.h?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/dc.h (original)
+++ trunk/reactos/subsystems/win32/win32k/include/dc.h Wed Feb 27 02:09:20 2008
@@ -150,9 +150,9 @@
 /* Internal functions *********************************************************/
 
 #define  DC_LockDc(hDC)  \
-  ((PDC) GDIOBJ_LockObj (GdiHandleTable, (HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC))
+  ((PDC) GDIOBJ_LockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC))
 #define  DC_UnlockDc(pDC)  \
-  GDIOBJ_UnlockObjByPtr (GdiHandleTable, pDC)
+  GDIOBJ_UnlockObjByPtr ((POBJ)pDC)
 
 NTSTATUS FASTCALL InitDcImpl(VOID);
 PGDIDEVICE FASTCALL IntEnumHDev(VOID);

Modified: trunk/reactos/subsystems/win32/win32k/include/gdiobj.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/gdiobj.h?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/gdiobj.h (original)
+++ trunk/reactos/subsystems/win32/win32k/include/gdiobj.h Wed Feb 27 02:09:20 2008
@@ -35,26 +35,8 @@
 
 typedef BOOL (INTERNAL_CALL *GDICLEANUPPROC)(PVOID ObjectBody);
 
-/*!
- * GDI object header. This is a part of any GDI object. ROS specific header!
-*/
-typedef struct _GDIOBJHDR
-{
-  PETHREAD LockingThread; /* only assigned if a thread is holding the lock! */
-  ULONG Locks;
-#ifdef GDI_DEBUG
-  const char* createdfile;
-  int createdline;
-  const char* lockfile;
-  int lockline;
-#endif
-} GDIOBJHDR, *PGDIOBJHDR;
-
-//
-// Every GDI Object must have this standard type of header.
-// It's for thread locking.
-// This header is standalone, used only in gdiobj.c.
-//
+/* Every GDI Object must have this standard type of header.
+ * It's for thread locking. */
 typedef struct _BASEOBJECT
 {
   HGDIOBJ     hHmgr;
@@ -64,22 +46,22 @@
   PW32THREAD  Tid;
 } BASEOBJECT, *POBJ;
 
-BOOL    INTERNAL_CALL GDIOBJ_OwnedByCurrentProcess(PGDI_HANDLE_TABLE HandleTable, HGDIOBJ ObjectHandle);
-void    INTERNAL_CALL GDIOBJ_SetOwnership(PGDI_HANDLE_TABLE HandleTable, HGDIOBJ ObjectHandle, PEPROCESS Owner);
-void    INTERNAL_CALL GDIOBJ_CopyOwnership(PGDI_HANDLE_TABLE HandleTable, HGDIOBJ CopyFrom, HGDIOBJ CopyTo);
-BOOL    INTERNAL_CALL GDIOBJ_ConvertToStockObj(PGDI_HANDLE_TABLE HandleTable, HGDIOBJ *hObj);
-VOID    INTERNAL_CALL GDIOBJ_UnlockObjByPtr(PGDI_HANDLE_TABLE HandleTable, PGDIOBJ Object);
+BOOL    INTERNAL_CALL GDIOBJ_OwnedByCurrentProcess(HGDIOBJ ObjectHandle);
+VOID    INTERNAL_CALL GDIOBJ_SetOwnership(HGDIOBJ ObjectHandle, PEPROCESS Owner);
+VOID    INTERNAL_CALL GDIOBJ_CopyOwnership(HGDIOBJ CopyFrom, HGDIOBJ CopyTo);
+BOOL    INTERNAL_CALL GDIOBJ_ConvertToStockObj(HGDIOBJ *hObj);
+VOID    INTERNAL_CALL GDIOBJ_UnlockObjByPtr(POBJ Object);
+VOID    INTERNAL_CALL GDIOBJ_ShareUnlockObjByPtr(POBJ Object);
+BOOL    INTERNAL_CALL GDIOBJ_ValidateHandle(HGDIOBJ hObj, ULONG ObjectType);
+HGDIOBJ INTERNAL_CALL GDIOBJ_AllocObj(ULONG ObjectType);
+BOOL    INTERNAL_CALL GDIOBJ_FreeObj (HGDIOBJ hObj, DWORD ObjectType);
+PGDIOBJ INTERNAL_CALL GDIOBJ_LockObj (HGDIOBJ hObj, DWORD ObjectType);
+PGDIOBJ INTERNAL_CALL GDIOBJ_ShareLockObj (HGDIOBJ hObj, DWORD ObjectType);
+
+PVOID   INTERNAL_CALL GDI_MapHandleTable(PSECTION_OBJECT SectionObject, PEPROCESS Process);
 
 #define GDIOBJ_GetObjectType(Handle) \
   GDI_HANDLE_GET_TYPE(Handle)
-
-BOOL    INTERNAL_CALL GDIOBJ_ValidateHandle(HGDIOBJ hObj, ULONG ObjectType);
-HGDIOBJ INTERNAL_CALL GDIOBJ_AllocObj(PGDI_HANDLE_TABLE HandleTable, ULONG ObjectType);
-BOOL    INTERNAL_CALL GDIOBJ_FreeObj (PGDI_HANDLE_TABLE HandleTable, HGDIOBJ hObj, DWORD ObjectType);
-PGDIOBJ INTERNAL_CALL GDIOBJ_LockObj (PGDI_HANDLE_TABLE HandleTable, HGDIOBJ hObj, DWORD ObjectType);
-PGDIOBJ INTERNAL_CALL GDIOBJ_ShareLockObj (PGDI_HANDLE_TABLE HandleTable, HGDIOBJ hObj, DWORD ObjectType);
-
-PVOID   INTERNAL_CALL GDI_MapHandleTable(PSECTION_OBJECT SectionObject, PEPROCESS Process);
 
 #define GDIOBJFLAG_DEFAULT	(0x0)
 #define GDIOBJFLAG_IGNOREPID 	(0x1)

Modified: trunk/reactos/subsystems/win32/win32k/include/palette.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/palette.h?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/palette.h (original)
+++ trunk/reactos/subsystems/win32/win32k/include/palette.h Wed Feb 27 02:09:20 2008
@@ -64,9 +64,9 @@
                                        ULONG Blue);
 HPALETTE FASTCALL PALETTE_AllocPaletteIndexedRGB(ULONG NumColors,
                                                  CONST RGBQUAD *Colors);
-#define  PALETTE_FreePalette(hPalette)  GDIOBJ_FreeObj(GdiHandleTable, (HGDIOBJ)hPalette, GDI_OBJECT_TYPE_PALETTE)
-#define  PALETTE_LockPalette(hPalette) ((PPALGDI)GDIOBJ_LockObj(GdiHandleTable, (HGDIOBJ)hPalette, GDI_OBJECT_TYPE_PALETTE))
-#define  PALETTE_UnlockPalette(pPalette) GDIOBJ_UnlockObjByPtr(GdiHandleTable, pPalette)
+#define  PALETTE_FreePalette(hPalette)  GDIOBJ_FreeObj((HGDIOBJ)hPalette, GDI_OBJECT_TYPE_PALETTE)
+#define  PALETTE_LockPalette(hPalette) ((PPALGDI)GDIOBJ_LockObj((HGDIOBJ)hPalette, GDI_OBJECT_TYPE_PALETTE))
+#define  PALETTE_UnlockPalette(pPalette) GDIOBJ_UnlockObjByPtr((POBJ)pPalette)
 BOOL INTERNAL_CALL PALETTE_Cleanup(PVOID ObjectBody);
 
 HPALETTE FASTCALL PALETTE_Init (VOID);

Modified: trunk/reactos/subsystems/win32/win32k/include/pen.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/pen.h?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/pen.h (original)
+++ trunk/reactos/subsystems/win32/win32k/include/pen.h Wed Feb 27 02:09:20 2008
@@ -6,13 +6,13 @@
 
 /* Internal interface */
 
-#define PENOBJ_AllocPen() ((HPEN)GDIOBJ_AllocObj(GdiHandleTable, GDI_OBJECT_TYPE_PEN))
-#define PENOBJ_FreePen(hBMObj) GDIOBJ_FreeObj(GdiHandleTable, (HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN)
-#define PENOBJ_LockPen(hBMObj) ((PGDIBRUSHOBJ)GDIOBJ_LockObj(GdiHandleTable, (HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN))
-#define PENOBJ_AllocExtPen() ((HPEN)GDIOBJ_AllocObj(GdiHandleTable, GDI_OBJECT_TYPE_EXTPEN))
-#define PENOBJ_FreeExtPen(hBMObj) GDIOBJ_FreeObj(GdiHandleTable, (HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_EXTPEN)
-#define PENOBJ_LockExtPen(hBMObj) ((PGDIBRUSHOBJ)GDIOBJ_LockObj(GdiHandleTable, (HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_EXTPEN))
-#define PENOBJ_UnlockPen(pPenObj) GDIOBJ_UnlockObjByPtr(GdiHandleTable, pPenObj)
+#define PENOBJ_AllocPen() ((HPEN)GDIOBJ_AllocObj(GDI_OBJECT_TYPE_PEN))
+#define PENOBJ_FreePen(hBMObj) GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN)
+#define PENOBJ_LockPen(hBMObj) ((PGDIBRUSHOBJ)GDIOBJ_LockObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_PEN))
+#define PENOBJ_AllocExtPen() ((HPEN)GDIOBJ_AllocObj(GDI_OBJECT_TYPE_EXTPEN))
+#define PENOBJ_FreeExtPen(hBMObj) GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_EXTPEN)
+#define PENOBJ_LockExtPen(hBMObj) ((PGDIBRUSHOBJ)GDIOBJ_LockObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_EXTPEN))
+#define PENOBJ_UnlockPen(pPenObj) GDIOBJ_UnlockObjByPtr((POBJ)pPenObj)
 
 INT STDCALL PEN_GetObject(PGDIBRUSHOBJ hPen, INT Count, PLOGPEN Buffer);
 

Modified: trunk/reactos/subsystems/win32/win32k/include/region.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/region.h?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/region.h (original)
+++ trunk/reactos/subsystems/win32/win32k/include/region.h Wed Feb 27 02:09:20 2008
@@ -21,9 +21,9 @@
 
 /* Functions ******************************************************************/
 
-#define  RGNDATA_FreeRgn(hRgn)  GDIOBJ_FreeObj(GdiHandleTable, (HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION)
-#define  RGNDATA_LockRgn(hRgn) ((PROSRGNDATA)GDIOBJ_LockObj(GdiHandleTable, (HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION))
-#define  RGNDATA_UnlockRgn(pRgn) GDIOBJ_UnlockObjByPtr(GdiHandleTable, pRgn)
+#define  RGNDATA_FreeRgn(hRgn)  GDIOBJ_FreeObj((HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION)
+#define  RGNDATA_LockRgn(hRgn) ((PROSRGNDATA)GDIOBJ_LockObj((HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION))
+#define  RGNDATA_UnlockRgn(pRgn) GDIOBJ_UnlockObjByPtr((POBJ)pRgn)
 
 HRGN FASTCALL RGNDATA_AllocRgn(INT n);
 BOOL INTERNAL_CALL RGNDATA_Cleanup(PVOID ObjectBody);

Modified: trunk/reactos/subsystems/win32/win32k/include/text.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/text.h?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/text.h (original)
+++ trunk/reactos/subsystems/win32/win32k/include/text.h Wed Feb 27 02:09:20 2008
@@ -69,10 +69,10 @@
 /*  Internal interface  */
 
 #define  TEXTOBJ_AllocText() \
-  ((HFONT) GDIOBJ_AllocObj (GdiHandleTable, GDI_OBJECT_TYPE_FONT))
-#define  TEXTOBJ_FreeText(hBMObj)  GDIOBJ_FreeObj(GdiHandleTable, (HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT)
-#define  TEXTOBJ_LockText(hBMObj) ((PTEXTOBJ) GDIOBJ_LockObj (GdiHandleTable, (HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT))
-#define  TEXTOBJ_UnlockText(pBMObj) GDIOBJ_UnlockObjByPtr (GdiHandleTable, pBMObj)
+  ((HFONT) GDIOBJ_AllocObj (GDI_OBJECT_TYPE_FONT))
+#define  TEXTOBJ_FreeText(hBMObj)  GDIOBJ_FreeObj((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT)
+#define  TEXTOBJ_LockText(hBMObj) ((PTEXTOBJ) GDIOBJ_LockObj ((HGDIOBJ) hBMObj, GDI_OBJECT_TYPE_FONT))
+#define  TEXTOBJ_UnlockText(pBMObj) GDIOBJ_UnlockObjByPtr ((POBJ)pBMObj)
 
 NTSTATUS FASTCALL TextIntRealizeFont(HFONT FontHandle);
 NTSTATUS FASTCALL TextIntCreateFontIndirect(CONST LPLOGFONTW lf, HFONT *NewFont);

Modified: trunk/reactos/subsystems/win32/win32k/main/dllmain.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/main/dllmain.c?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/main/dllmain.c (original)
+++ trunk/reactos/subsystems/win32/win32k/main/dllmain.c Wed Feb 27 02:09:20 2008
@@ -28,7 +28,7 @@
 #include <debug.h>
 
 PGDI_HANDLE_TABLE INTERNAL_CALL GDIOBJ_iAllocHandleTable(OUT PSECTION_OBJECT *SectionObject);
-BOOL INTERNAL_CALL GDI_CleanupForProcess (PGDI_HANDLE_TABLE HandleTable, struct _EPROCESS *Process);
+BOOL INTERNAL_CALL GDI_CleanupForProcess (struct _EPROCESS *Process);
 /* FIXME */
 PGDI_HANDLE_TABLE GdiHandleTable = NULL;
 PSECTION_OBJECT GdiTableSection = NULL;
@@ -136,7 +136,7 @@
       /* no process windows should exist at this point, or the function will assert! */
       DestroyProcessClasses(Win32Process);
 
-      GDI_CleanupForProcess(GdiHandleTable, Process);
+      GDI_CleanupForProcess(Process);
 
       co_IntGraphicsCheck(FALSE);
 

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c Wed Feb 27 02:09:20 2008
@@ -490,13 +490,13 @@
    /* delete bitmaps */
    if(bmpMask)
    {
-      GDIOBJ_SetOwnership(GdiHandleTable, bmpMask, PsGetCurrentProcess());
+      GDIOBJ_SetOwnership(bmpMask, PsGetCurrentProcess());
       NtGdiDeleteObject(bmpMask);
       CurIcon->IconInfo.hbmMask = NULL;
    }
    if(bmpColor)
    {
-      GDIOBJ_SetOwnership(GdiHandleTable, bmpColor, PsGetCurrentProcess());
+      GDIOBJ_SetOwnership(bmpColor, PsGetCurrentProcess());
       NtGdiDeleteObject(bmpColor);
       CurIcon->IconInfo.hbmColor = NULL;
    }
@@ -597,7 +597,7 @@
             CurIcon->Size.cx = bmp->SurfObj.sizlBitmap.cx;
             CurIcon->Size.cy = bmp->SurfObj.sizlBitmap.cy;
             BITMAPOBJ_UnlockBitmap(bmp);
-            GDIOBJ_SetOwnership(GdiHandleTable, CurIcon->IconInfo.hbmColor, NULL);
+            GDIOBJ_SetOwnership(CurIcon->IconInfo.hbmColor, NULL);
          }
          if(CurIcon->IconInfo.hbmMask &&
                (bmp = BITMAPOBJ_LockBitmap(CurIcon->IconInfo.hbmMask)))
@@ -608,7 +608,7 @@
                CurIcon->Size.cy = bmp->SurfObj.sizlBitmap.cy / 2;
             }
             BITMAPOBJ_UnlockBitmap(bmp);
-            GDIOBJ_SetOwnership(GdiHandleTable, CurIcon->IconInfo.hbmMask, NULL);
+            GDIOBJ_SetOwnership(CurIcon->IconInfo.hbmMask, NULL);
          }
       }
       else
@@ -1186,7 +1186,7 @@
       CurIcon->Size.cx = bmp->SurfObj.sizlBitmap.cx;
       CurIcon->Size.cy = bmp->SurfObj.sizlBitmap.cy;
       BITMAPOBJ_UnlockBitmap(bmp);
-      GDIOBJ_SetOwnership(GdiHandleTable, CurIcon->IconInfo.hbmColor, NULL);
+      GDIOBJ_SetOwnership(CurIcon->IconInfo.hbmColor, NULL);
    }
    else
    {
@@ -1198,7 +1198,7 @@
       CurIcon->Size.cy = bmp->SurfObj.sizlBitmap.cy / 2;
 
       BITMAPOBJ_UnlockBitmap(bmp);
-      GDIOBJ_SetOwnership(GdiHandleTable, CurIcon->IconInfo.hbmMask, NULL);
+      GDIOBJ_SetOwnership(CurIcon->IconInfo.hbmMask, NULL);
    }
 
    Ret = TRUE;

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/misc.c?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/misc.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/misc.c Wed Feb 27 02:09:20 2008
@@ -1277,7 +1277,7 @@
                         BITMAPOBJ_UnlockBitmap(bmp);
 
                         /* change the bitmap's ownership */
-                        GDIOBJ_SetOwnership(GdiHandleTable, hNewBitmap, NULL);
+                        GDIOBJ_SetOwnership(hNewBitmap, NULL);
                      }
                      hOldBitmap = (HBITMAP)InterlockedExchange((LONG*)&WinStaObject->hbmWallpaper, (LONG)hNewBitmap);
                      if(hOldBitmap != NULL)

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/painting.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/painting.c?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/painting.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/painting.c Wed Feb 27 02:09:20 2008
@@ -211,7 +211,7 @@
          if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion,
                              hRgnWindow, RGN_AND) == NULLREGION)
          {
-            GDIOBJ_SetOwnership(GdiHandleTable, Window->UpdateRegion, PsGetCurrentProcess());
+            GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess());
             NtGdiDeleteObject(Window->UpdateRegion);
             Window->UpdateRegion = NULL;
             if (!(Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT))
@@ -272,7 +272,7 @@
             if ((HANDLE) 1 != TempRegion && NULL != TempRegion)
             {
                /* NOTE: The region can already be deleted! */
-               GDIOBJ_FreeObj(GdiHandleTable, TempRegion, GDI_OBJECT_TYPE_REGION | GDI_OBJECT_TYPE_SILENT);
+               GDIOBJ_FreeObj(TempRegion, GDI_OBJECT_TYPE_REGION | GDI_OBJECT_TYPE_SILENT);
             }
          }
 
@@ -398,13 +398,13 @@
       if (Window->UpdateRegion == NULL)
       {
          Window->UpdateRegion = NtGdiCreateRectRgn(0, 0, 0, 0);
-         GDIOBJ_SetOwnership(GdiHandleTable, Window->UpdateRegion, NULL);
+         GDIOBJ_SetOwnership(Window->UpdateRegion, NULL);
       }
 
       if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion,
                           hRgn, RGN_OR) == NULLREGION)
       {
-         GDIOBJ_SetOwnership(GdiHandleTable, Window->UpdateRegion, PsGetCurrentProcess());
+         GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess());
          NtGdiDeleteObject(Window->UpdateRegion);
          Window->UpdateRegion = NULL;
       }
@@ -424,7 +424,7 @@
          if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion,
                              hRgn, RGN_DIFF) == NULLREGION)
          {
-            GDIOBJ_SetOwnership(GdiHandleTable, Window->UpdateRegion, PsGetCurrentProcess());
+            GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess());
             NtGdiDeleteObject(Window->UpdateRegion);
             Window->UpdateRegion = NULL;
          }
@@ -801,7 +801,7 @@
       if (hRgn != (HANDLE)1 && hRgn != NULL)
       {
          /* NOTE: The region can already by deleted! */
-         GDIOBJ_FreeObj(GdiHandleTable, hRgn, GDI_OBJECT_TYPE_REGION | GDI_OBJECT_TYPE_SILENT);
+         GDIOBJ_FreeObj(hRgn, GDI_OBJECT_TYPE_REGION | GDI_OBJECT_TYPE_SILENT);
       }
    }
 
@@ -833,7 +833,7 @@
       {
          IntGetClientRect(Window, &Ps.rcPaint);
       }
-      GDIOBJ_SetOwnership(GdiHandleTable, Window->UpdateRegion, PsGetCurrentProcess());
+      GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess());
       /* The region is part of the dc now and belongs to the process! */
       Window->UpdateRegion = NULL;
    }

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/windc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/windc.c?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/windc.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/windc.c Wed Feb 27 02:09:20 2008
@@ -590,7 +590,7 @@
   SetDCHook(pdce->hDC, NULL, 0L);
 #endif
 
-  if (Force && !GDIOBJ_OwnedByCurrentProcess(GdiHandleTable, pdce->hDC))
+  if (Force && !GDIOBJ_OwnedByCurrentProcess(pdce->hDC))
   {
      DPRINT1("Change ownership for DCE!\n");
 

Modified: trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c Wed Feb 27 02:09:20 2008
@@ -634,7 +634,7 @@
 		return 0;
 	}
 
-	Bitmap = GDIOBJ_LockObj(GdiHandleTable, hBitmap, GDI_OBJECT_TYPE_BITMAP);
+	Bitmap = GDIOBJ_LockObj(hBitmap, GDI_OBJECT_TYPE_BITMAP);
 	if (Bitmap == NULL)
 	{
 		return 0;
@@ -657,14 +657,14 @@
 	{
 		PBYTE buf;
 
-		resBitmap = GDIOBJ_LockObj(GdiHandleTable, res, GDI_OBJECT_TYPE_BITMAP);
+		resBitmap = GDIOBJ_LockObj(res, GDI_OBJECT_TYPE_BITMAP);
 		if (resBitmap)
 		{
 			buf = ExAllocatePoolWithTag (PagedPool, bm.bmWidthBytes * abs(bm.bmHeight), TAG_BITMAP);
 			if (buf == NULL)
 			{
-				GDIOBJ_UnlockObjByPtr(GdiHandleTable, resBitmap);
-				GDIOBJ_UnlockObjByPtr(GdiHandleTable, Bitmap);
+				GDIOBJ_UnlockObjByPtr((POBJ)resBitmap);
+				GDIOBJ_UnlockObjByPtr((POBJ)Bitmap);
 				NtGdiDeleteObject(res);
 				return 0;
 			}
@@ -672,7 +672,7 @@
 			IntSetBitmapBits (resBitmap, bm.bmWidthBytes * abs(bm.bmHeight), buf);
 			ExFreePool (buf);
 			resBitmap->flFlags = Bitmap->flFlags;
-			GDIOBJ_UnlockObjByPtr(GdiHandleTable, resBitmap);
+			GDIOBJ_UnlockObjByPtr((POBJ)resBitmap);
 		}
 		else
 		{
@@ -681,7 +681,7 @@
 		}
 	}
 
-	GDIOBJ_UnlockObjByPtr(GdiHandleTable, Bitmap);
+	GDIOBJ_UnlockObjByPtr((POBJ)Bitmap);
 
 	return  res;
 }

Modified: trunk/reactos/subsystems/win32/win32k/objects/brush.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/brush.c?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/brush.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/brush.c Wed Feb 27 02:09:20 2008
@@ -42,7 +42,7 @@
   if(pBrush->flAttrs & (GDIBRUSH_IS_HATCH | GDIBRUSH_IS_BITMAP))
   {
     ASSERT(pBrush->hbmPattern);
-    GDIOBJ_SetOwnership(GdiHandleTable, pBrush->hbmPattern, PsGetCurrentProcess());
+    GDIOBJ_SetOwnership(pBrush->hbmPattern, PsGetCurrentProcess());
     NtGdiDeleteObject(pBrush->hbmPattern);
   }
 
@@ -366,7 +366,7 @@
    BrushObject->hbmPattern = hPattern;
    /* FIXME: Fill in the rest of fields!!! */
 
-   GDIOBJ_SetOwnership(GdiHandleTable, hPattern, NULL);
+   GDIOBJ_SetOwnership(hPattern, NULL);
 
    BRUSHOBJ_UnlockBrush(BrushObject);
 
@@ -409,7 +409,7 @@
    BrushObject->hbmPattern = hPattern;
    BrushObject->BrushAttr.lbColor = Color & 0xFFFFFF;
 
-   GDIOBJ_SetOwnership(GdiHandleTable, hPattern, NULL);
+   GDIOBJ_SetOwnership(hPattern, NULL);
 
    BRUSHOBJ_UnlockBrush(BrushObject);
 
@@ -446,7 +446,7 @@
    BrushObject->hbmPattern = hPattern;
    /* FIXME: Fill in the rest of fields!!! */
 
-   GDIOBJ_SetOwnership(GdiHandleTable, hPattern, NULL);
+   GDIOBJ_SetOwnership(hPattern, NULL);
 
    BRUSHOBJ_UnlockBrush(BrushObject);
 

Modified: trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c Wed Feb 27 02:09:20 2008
@@ -81,7 +81,7 @@
   if (dc->w.hVisRgn == NULL)
   {
     dc->w.hVisRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
-    GDIOBJ_CopyOwnership(GdiHandleTable, hdc, dc->w.hVisRgn);
+    GDIOBJ_CopyOwnership(hdc, dc->w.hVisRgn);
   }
 
   retval = NtGdiCombineRgn(dc->w.hVisRgn, hrgn, 0, RGN_COPY);

Modified: trunk/reactos/subsystems/win32/win32k/objects/color.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/color.c?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/color.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/color.c Wed Feb 27 02:09:20 2008
@@ -706,7 +706,7 @@
 NtGdiUnrealizeObject(HGDIOBJ hgdiobj)
 {
 
-   GDIOBJHDR * ptr;
+   POBJ pObject;
    DWORD objectType;
    BOOL Ret = FALSE;
 
@@ -714,15 +714,15 @@
    if(!hgdiobj)
      return Ret;
 
-   ptr = GDIOBJ_LockObj(GdiHandleTable, hgdiobj, GDI_OBJECT_TYPE_DONTCARE);
-   if (ptr == 0)
-     {
-        SetLastWin32Error(ERROR_INVALID_HANDLE);
-        return Ret;
-     }
+   pObject = GDIOBJ_LockObj(hgdiobj, GDI_OBJECT_TYPE_DONTCARE);
+   if (pObject == NULL)
+   {
+      SetLastWin32Error(ERROR_INVALID_HANDLE);
+      return Ret;
+   }
    objectType = GDIOBJ_GetObjectType(hgdiobj);
    switch(objectType)
-     {
+   {
 /*
     msdn.microsoft.com,
     "Windows 2000/XP: If hgdiobj is a brush, UnrealizeObject does nothing,
@@ -738,9 +738,9 @@
          default:
            DPRINT1("Magic 0x%08x not implemented\n", objectType);
            break;
-     }
-
-   GDIOBJ_UnlockObjByPtr(GdiHandleTable, ptr);
+   }
+
+   GDIOBJ_UnlockObjByPtr(pObject);
    return Ret;
 }
 

Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/dc.c?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dc.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dc.c Wed Feb 27 02:09:20 2008
@@ -1019,7 +1019,7 @@
 
   if(IsObjectDead((HGDIOBJ)DCHandle)) return TRUE;
 
-  if (!GDIOBJ_OwnedByCurrentProcess(GdiHandleTable, DCHandle))
+  if (!GDIOBJ_OwnedByCurrentProcess(DCHandle))
     {
       SetLastWin32Error(ERROR_INVALID_HANDLE);
       return FALSE;
@@ -1669,7 +1669,7 @@
   INT Result = 0;
   DWORD dwObjectType;
 
-  pGdiObject = GDIOBJ_LockObj(GdiHandleTable, Handle, GDI_OBJECT_TYPE_DONTCARE);
+  pGdiObject = GDIOBJ_LockObj(Handle, GDI_OBJECT_TYPE_DONTCARE);
   if (!pGdiObject)
     {
       SetLastWin32Error(ERROR_INVALID_HANDLE);
@@ -1711,7 +1711,7 @@
         break;
     }
 
-  GDIOBJ_UnlockObjByPtr(GdiHandleTable, pGdiObject);
+  GDIOBJ_UnlockObjByPtr(pGdiObject);
 
   return Result;
 }
@@ -2375,7 +2375,7 @@
     RtlCopyMemory(Buf, Driver->Buffer, Driver->MaximumLength);
   }
 
-  hDC = (HDC) GDIOBJ_AllocObj(GdiHandleTable, GDI_OBJECT_TYPE_DC);
+  hDC = (HDC) GDIOBJ_AllocObj(GDI_OBJECT_TYPE_DC);
   if (hDC == NULL)
   {
     if(Buf)
@@ -2546,7 +2546,7 @@
   DC_FreeDcAttr(DCToFree);
   if(!IsObjectDead( DCToFree ))
   {
-    if (!GDIOBJ_FreeObj(GdiHandleTable, DCToFree, GDI_OBJECT_TYPE_DC))
+    if (!GDIOBJ_FreeObj(DCToFree, GDI_OBJECT_TYPE_DC))
     {
        DPRINT1("DC_FreeDC failed\n");
     }
@@ -2629,21 +2629,21 @@
 {
   PDC DC;
 
-  GDIOBJ_SetOwnership(GdiHandleTable, hDC, Owner);
+  GDIOBJ_SetOwnership(hDC, Owner);
   DC = DC_LockDc(hDC);
   if (NULL != DC)
     {
       if (NULL != DC->w.hClipRgn)
         {
-          GDIOBJ_CopyOwnership(GdiHandleTable, hDC, DC->w.hClipRgn);
+          GDIOBJ_CopyOwnership(hDC, DC->w.hClipRgn);
         }
       if (NULL != DC->w.hVisRgn)
         {
-          GDIOBJ_CopyOwnership(GdiHandleTable, hDC, DC->w.hVisRgn);
+          GDIOBJ_CopyOwnership(hDC, DC->w.hVisRgn);
         }
       if (NULL != DC->w.hGCClipRgn)
         {
-          GDIOBJ_CopyOwnership(GdiHandleTable, hDC, DC->w.hGCClipRgn);
+          GDIOBJ_CopyOwnership(hDC, DC->w.hGCClipRgn);
         }
       DC_UnlockDc(DC);
     }

Modified: trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c Wed Feb 27 02:09:20 2008
@@ -166,7 +166,7 @@
     if (ObjTypeInfo[ObjType].bUseLookaside)
     {
       ExInitializePagedLookasideList(HandleTable->LookasideLists + ObjType, NULL, NULL, 0,
-                                     ObjTypeInfo[ObjType].ulBodySize + sizeof(GDIOBJHDR), ObjTypeInfo[ObjType].Tag, 0);
+                                     ObjTypeInfo[ObjType].ulBodySize, ObjTypeInfo[ObjType].Tag, 0);
     }
   }
 
@@ -179,10 +179,9 @@
 }
 
 static __inline PPAGED_LOOKASIDE_LIST
-FindLookasideList(PGDI_HANDLE_TABLE HandleTable,
-                  ULONG TypeIndex)
-{
-  return HandleTable->LookasideLists + TypeIndex;
+FindLookasideList(ULONG TypeIndex)
+{
+  return GdiHandleTable->LookasideLists + TypeIndex;
 }
 
 static __inline BOOL
@@ -338,7 +337,7 @@
 
 ULONG
 FASTCALL
-InterlockedPopFreeEntry(PGDI_HANDLE_TABLE HandleTable)
+InterlockedPopFreeEntry()
 {
 	ULONG idxFirstFree, idxNextFree, idxPrev;
 	PGDI_TABLE_ENTRY pFreeEntry;
@@ -347,24 +346,24 @@
 
 	do
 	{
-		idxFirstFree = HandleTable->FirstFree;
+		idxFirstFree = GdiHandleTable->FirstFree;
 		if (idxFirstFree)
 		{
-			pFreeEntry = HandleTable->Entries + idxFirstFree;
+			pFreeEntry = GdiHandleTable->Entries + idxFirstFree;
 			ASSERT(((ULONG)pFreeEntry->KernelData & ~GDI_HANDLE_INDEX_MASK) == 0);
 			idxNextFree = (ULONG)pFreeEntry->KernelData;
-			idxPrev = (ULONG)_InterlockedCompareExchange((LONG*)&HandleTable->FirstFree, idxNextFree, idxFirstFree);
+			idxPrev = (ULONG)_InterlockedCompareExchange((LONG*)&GdiHandleTable->FirstFree, idxNextFree, idxFirstFree);
 		}
 		else
 		{
-			idxFirstFree = HandleTable->FirstUnused;
+			idxFirstFree = GdiHandleTable->FirstUnused;
 			idxNextFree = idxFirstFree + 1;
 			if (idxNextFree >= GDI_HANDLE_COUNT)
 			{
 				DPRINT1("No more gdi handles left!\n");
 				return 0;
 			}
-			idxPrev = (ULONG)_InterlockedCompareExchange((LONG*)&HandleTable->FirstUnused, idxNextFree, idxFirstFree);
+			idxPrev = (ULONG)_InterlockedCompareExchange((LONG*)&GdiHandleTable->FirstUnused, idxNextFree, idxFirstFree);
 		}
 	}
 	while (idxPrev != idxFirstFree);
@@ -376,24 +375,24 @@
    The entry must be unlocked and the base type field must be 0 */
 VOID
 FASTCALL
-InterlockedPushFreeEntry(PGDI_HANDLE_TABLE HandleTable, ULONG idxToFree)
+InterlockedPushFreeEntry(ULONG idxToFree)
 {
 	ULONG idxFirstFree, idxPrev;
 	PGDI_TABLE_ENTRY pFreeEntry;
 
 	DPRINT("Enter InterlockedPushFreeEntry\n");
 
-	pFreeEntry = HandleTable->Entries + idxToFree;
+	pFreeEntry = GdiHandleTable->Entries + idxToFree;
 	ASSERT((pFreeEntry->Type & GDI_ENTRY_BASETYPE_MASK) == 0);
 	ASSERT(pFreeEntry->ProcessId == 0);
 	pFreeEntry->UserData = NULL;
 
 	do
 	{
-		idxFirstFree = HandleTable->FirstFree;
+		idxFirstFree = GdiHandleTable->FirstFree;
 		pFreeEntry->KernelData = (PVOID)idxFirstFree;
 
-		idxPrev = (ULONG)_InterlockedCompareExchange((LONG*)&HandleTable->FirstFree, idxToFree, idxFirstFree);
+		idxPrev = (ULONG)_InterlockedCompareExchange((LONG*)&GdiHandleTable->FirstFree, idxToFree, idxFirstFree);
 	}
 	while (idxPrev != idxFirstFree);
 }
@@ -427,10 +426,10 @@
  * \todo return the object pointer and lock it by default.
 */
 HGDIOBJ INTERNAL_CALL
-GDIOBJ_AllocObj(PGDI_HANDLE_TABLE HandleTable, ULONG ObjectType)
+GDIOBJ_AllocObj(ULONG ObjectType)
 {
   PW32PROCESS W32Process;
-  PGDIOBJHDR  newObject = NULL;
+  POBJ  newObject = NULL;
   PPAGED_LOOKASIDE_LIST LookasideList = NULL;
   HANDLE CurrentProcessId, LockedProcessId;
   ULONG TypeIndex;
@@ -449,7 +448,7 @@
   TypeIndex = GDI_OBJECT_GET_TYPE_INDEX(ObjectType);
   if (ObjTypeInfo[TypeIndex].bUseLookaside)
   {
-    LookasideList = FindLookasideList(HandleTable, TypeIndex);
+    LookasideList = FindLookasideList(TypeIndex);
     if(LookasideList != NULL)
     {
       newObject = ExAllocateFromPagedLookasideList(LookasideList);
@@ -458,37 +457,31 @@
   else
   {
     newObject = ExAllocatePoolWithTag(PagedPool,
-                                      ObjTypeInfo[TypeIndex].ulBodySize + sizeof(GDIOBJHDR),
+                                      ObjTypeInfo[TypeIndex].ulBodySize,
                                       ObjTypeInfo[TypeIndex].Tag);
   }
   if(newObject != NULL)
   {
     UINT Index;
     PGDI_TABLE_ENTRY Entry;
-    PGDIOBJ ObjectBody;
     LONG TypeInfo;
 
     CurrentProcessId = PsGetCurrentProcessId();
     LockedProcessId = (HANDLE)((ULONG_PTR)CurrentProcessId | 0x1);
 
-    newObject->LockingThread = NULL;
-    newObject->Locks = 0;
-
-    ObjectBody = GDIHdrToBdy(newObject);
-
-    RtlZeroMemory(ObjectBody, GetObjectSize(TypeIndex));
+    RtlZeroMemory(newObject, GetObjectSize(TypeIndex));
 
     /* On Windows the higher 16 bit of the type field don't contain the
        full type from the handle, but the base type.
        (type = BRSUH, PEN, EXTPEN, basetype = BRUSH) */
     TypeInfo = (ObjectType & GDI_HANDLE_BASETYPE_MASK) | (ObjectType >> GDI_ENTRY_UPPER_SHIFT);
 
-    Index = InterlockedPopFreeEntry(HandleTable);
+    Index = InterlockedPopFreeEntry();
     if (Index != 0)
     {
       HANDLE PrevProcId;
 
-      Entry = &HandleTable->Entries[Index];
+      Entry = &GdiHandleTable->Entries[Index];
 
 LockHandle:
       PrevProcId = _InterlockedCompareExchangePointer((PVOID*)&Entry->ProcessId, LockedProcessId, 0);
@@ -496,7 +489,7 @@
       {
         HGDIOBJ Handle;
 
-        Entry->KernelData = ObjectBody;
+        Entry->KernelData = newObject;
 
         /* copy the reuse-counter */
         TypeInfo |= Entry->Type & GDI_ENTRY_REUSE_MASK;
@@ -518,7 +511,7 @@
         }
         Handle = (HGDIOBJ)((Index & 0xFFFF) | (TypeInfo << GDI_ENTRY_UPPER_SHIFT));
 
-        DPRINT("GDIOBJ_AllocObj: 0x%x ob: 0x%x\n", Handle, ObjectBody);
+        DPRINT("GDIOBJ_AllocObj: 0x%x ob: 0x%x\n", Handle, newObject);
         return Handle;
       }
       else
@@ -548,7 +541,7 @@
     }
     DPRINT1("Failed to insert gdi object into the handle table, no handles left!\n");
 #ifdef GDI_DEBUG
-    IntDumpHandleTable(HandleTable);
+    IntDumpHandleTable(GdiHandleTable);
 #endif /* GDI_DEBUG */
   }
   else
@@ -569,7 +562,7 @@
  * to the calling process.
 */
 BOOL INTERNAL_CALL
-GDIOBJ_FreeObj(PGDI_HANDLE_TABLE HandleTable, HGDIOBJ hObj, DWORD ExpectedType)
+GDIOBJ_FreeObj(HGDIOBJ hObj, DWORD ExpectedType)
 {
   PGDI_TABLE_ENTRY Entry;
   PPAGED_LOOKASIDE_LIST LookasideList;
@@ -615,7 +608,7 @@
      return FALSE;
   }
 
-  Entry = GDI_HANDLE_GET_ENTRY(HandleTable, hObj);
+  Entry = GDI_HANDLE_GET_ENTRY(GdiHandleTable, hObj);
 
 LockHandle:
   /* lock the object, we must not delete global objects, so don't exchange the locking
@@ -627,11 +620,11 @@
         ((Entry->Type << GDI_ENTRY_UPPER_SHIFT) == HandleUpper) &&
         ((Entry->Type & GDI_ENTRY_BASETYPE_MASK) == (HandleUpper & GDI_ENTRY_BASETYPE_MASK)) )
     {
-      PGDIOBJHDR GdiHdr;
-
-      GdiHdr = GDIBdyToHdr(Entry->KernelData);
-
-      if(GdiHdr->Locks == 0)
+      POBJ Object;
+
+      Object = Entry->KernelData;
+
+      if(Object->cExclusiveLock == 0)
       {
         BOOL Ret;
         PW32PROCESS W32Process = PsGetCurrentProcessWin32Process();
@@ -643,7 +636,7 @@
         (void)_InterlockedExchangePointer((PVOID*)&Entry->ProcessId, NULL);
 
         /* push this entry to the free list */
-        InterlockedPushFreeEntry(HandleTable, GDI_ENTRY_TO_INDEX(HandleTable, Entry));
+        InterlockedPushFreeEntry(GDI_ENTRY_TO_INDEX(GdiHandleTable, Entry));
 
         if(W32Process != NULL)
         {
@@ -652,20 +645,20 @@
 
         /* call the cleanup routine. */
         TypeIndex = GDI_OBJECT_GET_TYPE_INDEX(HandleType);
-        Ret = RunCleanupCallback(GDIHdrToBdy(GdiHdr), TypeIndex);
+        Ret = RunCleanupCallback(Object, TypeIndex);
 
         /* Now it's time to free the memory */
         if (ObjTypeInfo[TypeIndex].bUseLookaside)
         {
-          LookasideList = FindLookasideList(HandleTable, TypeIndex);
+          LookasideList = FindLookasideList(TypeIndex);
           if(LookasideList != NULL)
           {
-            ExFreeToPagedLookasideList(LookasideList, GdiHdr);
+            ExFreeToPagedLookasideList(LookasideList, Object);
           }
         }
         else
         {
-          ExFreePool(GdiHdr);
+          ExFreePool(Object);
         }
 
         return Ret;
@@ -675,7 +668,7 @@
         /*
          * The object is currently locked, so freeing is forbidden!
          */
-        DPRINT1("GdiHdr->Locks: %d\n", GdiHdr->Locks);
+        DPRINT1("Object->cExclusiveLock = %d\n", Object->cExclusiveLock);
 #ifdef GDI_DEBUG
 //        DPRINT1("Locked from:\n");
 //        KeRosDumpStackFrames(GDIHandleLocker[GDI_HANDLE_GET_INDEX(hObj)], GDI_STACK_LEVELS);
@@ -758,7 +751,7 @@
   if(!IsObjectDead(hObject))
   {
   return NULL != hObject
-         ? GDIOBJ_FreeObj(GdiHandleTable, hObject, GDI_OBJECT_TYPE_DONTCARE) : FALSE;
+         ? GDIOBJ_FreeObj(hObject, GDI_OBJECT_TYPE_DONTCARE) : FALSE;
   }
   else
   {
@@ -772,7 +765,7 @@
  * \param	Process - PID of the process that will be destroyed.
 */
 BOOL INTERNAL_CALL
-GDI_CleanupForProcess (PGDI_HANDLE_TABLE HandleTable, struct _EPROCESS *Process)
+GDI_CleanupForProcess (struct _EPROCESS *Process)
 {
   PGDI_TABLE_ENTRY Entry, End;
   PEPROCESS CurrentProcess;
@@ -795,8 +788,8 @@
                we should delete it directly here! */
     ProcId = Process->UniqueProcessId;
 
-    End = &HandleTable->Entries[GDI_HANDLE_COUNT];
-    for(Entry = &HandleTable->Entries[RESERVE_ENTRIES_COUNT];
+    End = &GdiHandleTable->Entries[GDI_HANDLE_COUNT];
+    for(Entry = &GdiHandleTable->Entries[RESERVE_ENTRIES_COUNT];
         Entry != End;
         Entry++, Index++)
     {
@@ -811,7 +804,7 @@
            simply ignore this fact here. */
         ObjectHandle = (HGDIOBJ)(Index | (Entry->Type << GDI_ENTRY_UPPER_SHIFT));
 
-        if(GDIOBJ_FreeObj(HandleTable, ObjectHandle, GDI_OBJECT_TYPE_DONTCARE) &&
+        if(GDIOBJ_FreeObj(ObjectHandle, GDI_OBJECT_TYPE_DONTCARE) &&
            W32Process->GDIObjects == 0)
         {
           /* there are no more gdi handles for this process, bail */
@@ -842,12 +835,12 @@
  * \todo Get rid of the ExpectedType parameter!
 */
 PGDIOBJ INTERNAL_CALL
-GDIOBJ_LockObj (PGDI_HANDLE_TABLE HandleTable, HGDIOBJ hObj, DWORD ExpectedType)
+GDIOBJ_LockObj (HGDIOBJ hObj, DWORD ExpectedType)
 {
    ULONG HandleIndex;
    PGDI_TABLE_ENTRY Entry;
    HANDLE ProcessId, HandleProcessId, LockedProcessId, PrevProcId;
-   PGDIOBJ Object = NULL;
+   POBJ Object = NULL;
    ULONG HandleType, HandleUpper;
 
    HandleIndex = GDI_HANDLE_GET_INDEX(hObj);
@@ -858,7 +851,7 @@
    if (HandleIndex >= GDI_HANDLE_COUNT)
       return NULL;
 
-   Entry = &HandleTable->Entries[HandleIndex];
+   Entry = &GdiHandleTable->Entries[HandleIndex];
 
    /* Check if we have the requested type */
    if ( (ExpectedType != GDI_OBJECT_TYPE_DONTCARE &&
@@ -921,32 +914,29 @@
          if ( (Entry->KernelData != NULL) &&
               ((Entry->Type << GDI_ENTRY_UPPER_SHIFT) == HandleUpper) )
          {
-            PGDIOBJHDR GdiHdr = GDIBdyToHdr(Entry->KernelData);
-            PETHREAD Thread = PsGetCurrentThread();
-
-            if (GdiHdr->Locks == 0)
+            PW32THREAD Thread = PsGetCurrentThreadWin32Thread();
+            Object = Entry->KernelData;
+
+            if (Object->cExclusiveLock == 0)
             {
-               GdiHdr->LockingThread = Thread;
-               GdiHdr->Locks = 1;
+               Object->Tid = Thread;
+               Object->cExclusiveLock = 1;
 #ifdef GDI_DEBUG
                CaptureStackBackTace((PVOID*)GDIHandleLocker[GDI_HANDLE_GET_INDEX(hObj)], GDI_STACK_LEVELS);
 #endif
             }
             else
             {
-               _InterlockedIncrement((PLONG)&GdiHdr->Locks);
-               if (GdiHdr->LockingThread != Thread)
+               if (Object->Tid != Thread)
                {
-                  _InterlockedDecrement((PLONG)&GdiHdr->Locks);
-
                   /* Unlock the handle table entry. */
                   (void)_InterlockedExchangePointer((PVOID*)&Entry->ProcessId, PrevProcId);
 
                   DelayExecution();
                   continue;
                }
+               _InterlockedIncrement((PLONG)&Object->cExclusiveLock);
             }
-            Object = Entry->KernelData;
          }
          else
          {
@@ -991,12 +981,12 @@
  * \todo Get rid of the ExpectedType parameter!
 */
 PGDIOBJ INTERNAL_CALL
-GDIOBJ_ShareLockObj (PGDI_HANDLE_TABLE HandleTable, HGDIOBJ hObj, DWORD ExpectedType)
+GDIOBJ_ShareLockObj (HGDIOBJ hObj, DWORD ExpectedType)
 {
    ULONG HandleIndex;
    PGDI_TABLE_ENTRY Entry;
    HANDLE ProcessId, HandleProcessId, LockedProcessId, PrevProcId;
-   PGDIOBJ Object = NULL;
+   POBJ Object = NULL;
    ULONG_PTR HandleType, HandleUpper;
 
    HandleIndex = GDI_HANDLE_GET_INDEX(hObj);
@@ -1017,7 +1007,7 @@
       return NULL;
    }
 
-   Entry = &HandleTable->Entries[HandleIndex];
+   Entry = &GdiHandleTable->Entries[HandleIndex];
 
    ProcessId = (HANDLE)((ULONG_PTR)PsGetCurrentProcessId() & ~1);
    HandleProcessId = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~1);
@@ -1059,18 +1049,17 @@
          if ( (Entry->KernelData != NULL) &&
               (HandleUpper == (Entry->Type << GDI_ENTRY_UPPER_SHIFT)) )
          {
-            PGDIOBJHDR GdiHdr = GDIBdyToHdr(Entry->KernelData);
-
-#ifdef GDI_DEBUG
-            if (_InterlockedIncrement((PLONG)&GdiHdr->Locks) == 1)
+            Object = (POBJ)Entry->KernelData;
+
+#ifdef GDI_DEBUG
+            if (_InterlockedIncrement((PLONG)&Object->ulShareCount) == 1)
             {
                  memset(GDIHandleLocker[HandleIndex], 0x00, GDI_STACK_LEVELS * sizeof(ULONG));
                  RtlCaptureStackBackTrace(1, GDI_STACK_LEVELS, (PVOID*)GDIHandleLocker[HandleIndex], NULL);
             }
 #else
-            _InterlockedIncrement((PLONG)&GdiHdr->Locks);
-#endif
-            Object = Entry->KernelData;
+            _InterlockedIncrement(Object->ulShareCount);
+#endif
          }
          else
          {
@@ -1110,23 +1099,25 @@
  * \param Object 	Object pointer (as returned by GDIOBJ_LockObj).
  */
 VOID INTERNAL_CALL
-GDIOBJ_UnlockObjByPtr(PGDI_HANDLE_TABLE HandleTable, PGDIOBJ Object)
-{
-   PGDIOBJHDR GdiHdr = GDIBdyToHdr(Object);
-#ifdef GDI_DEBUG
-   if (_InterlockedDecrement((PLONG)&GdiHdr->Locks) == 0)
-   {
-        memset(GDIHandleLocker[GDI_HANDLE_GET_INDEX(Object)], 0x00, GDI_STACK_LEVELS * sizeof(ULONG));
-        RtlCaptureStackBackTrace(1, GDI_STACK_LEVELS, (PVOID*)GDIHandleLocker[GDI_HANDLE_GET_INDEX(Object)], NULL);
-   }
-#else
-   if (_InterlockedDecrement((PLONG)&GdiHdr->Locks) < 0)
-       DPRINT1("Trying to unlock non-existant object\n");
-#endif
+GDIOBJ_UnlockObjByPtr(POBJ Object)
+{
+    if (_InterlockedDecrement((PLONG)&Object->cExclusiveLock) < 0)
+    {
+        DPRINT1("Trying to unlock non-existant object\n");
+    }
+}
+
+VOID INTERNAL_CALL
+GDIOBJ_ShareUnlockObjByPtr(POBJ Object)
+{
+    if (_InterlockedDecrement((PLONG)&Object->ulShareCount) < 0)
+    {
+        DPRINT1("Trying to unlock non-existant object\n");
+    }
 }
 
 BOOL INTERNAL_CALL
-GDIOBJ_OwnedByCurrentProcess(PGDI_HANDLE_TABLE HandleTable, HGDIOBJ ObjectHandle)
+GDIOBJ_OwnedByCurrentProcess(HGDIOBJ ObjectHandle)
 {
   PGDI_TABLE_ENTRY Entry;
   HANDLE ProcessId;
@@ -1138,7 +1129,7 @@
   {
     ProcessId = PsGetCurrentProcessId();
 
-    Entry = GDI_HANDLE_GET_ENTRY(HandleTable, ObjectHandle);
+    Entry = GDI_HANDLE_GET_ENTRY(GdiHandleTable, ObjectHandle);
     Ret = Entry->KernelData != NULL &&
           (Entry->Type & ~GDI_ENTRY_REUSE_MASK) != 0 &&
           (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1) == ProcessId;
@@ -1150,7 +1141,7 @@
 }
 
 BOOL INTERNAL_CALL
-GDIOBJ_ConvertToStockObj(PGDI_HANDLE_TABLE HandleTable, HGDIOBJ *phObj)
+GDIOBJ_ConvertToStockObj(HGDIOBJ *phObj)
 {
 /*
  * FIXME !!!!! THIS FUNCTION NEEDS TO BE FIXED - IT IS NOT SAFE WHEN OTHER THREADS
@@ -1158,7 +1149,7 @@
  */
   PGDI_TABLE_ENTRY Entry;
   HANDLE ProcessId, LockedProcessId, PrevProcId;
-  PETHREAD Thread;
+  PW32THREAD Thread;
   HGDIOBJ hObj;
 #ifdef GDI_DEBUG
   ULONG Attempts = 0;
@@ -1169,14 +1160,14 @@
 
   DPRINT("GDIOBJ_ConvertToStockObj: hObj: 0x%08x\n", hObj);
 
-  Thread = PsGetCurrentThread();
+  Thread = PsGetCurrentThreadWin32Thread();
 
   if(!GDI_HANDLE_IS_STOCKOBJ(hObj))
   {
     ProcessId = PsGetCurrentProcessId();
     LockedProcessId = (HANDLE)((ULONG_PTR)ProcessId | 0x1);
 
-    Entry = GDI_HANDLE_GET_ENTRY(HandleTable, hObj);
+    Entry = GDI_HANDLE_GET_ENTRY(GdiHandleTable, hObj);
 
 LockHandle:
     /* lock the object, we must not convert stock objects, so don't check!!! */
@@ -1203,17 +1194,17 @@
       PrevType = _InterlockedCompareExchange(&Entry->Type, NewType, OldType);
       if(PrevType == OldType && Entry->KernelData != NULL)
       {
-        PETHREAD PrevThread;
-        PGDIOBJHDR GdiHdr;
+        PW32THREAD PrevThread;
+        POBJ Object;
 
         /* We successfully set the stock object flag.
            KernelData should never be NULL here!!! */
         ASSERT(Entry->KernelData);
 
-        GdiHdr = GDIBdyToHdr(Entry->KernelData);
-
-        PrevThread = GdiHdr->LockingThread;
-        if(GdiHdr->Locks == 0 || PrevThread == Thread)
+        Object = Entry->KernelData;
+
+        PrevThread = Object->Tid;
+        if(Object->cExclusiveLock == 0 || PrevThread == Thread)
         {
           /* dereference the process' object counter */
           if(PrevProcId != GDI_GLOBAL_PROCESS)
@@ -1249,10 +1240,7 @@
 #ifdef GDI_DEBUG
           if(++Attempts > 20)
           {
-            if(GdiHdr->lockfile != NULL)
-            {
               DPRINT1("[%d]Locked by 0x%x (we're 0x%x)\n", Attempts, PrevThread, Thread);
-            }
           }
 #endif
           /* WTF?! The object is already locked by a different thread!
@@ -1294,39 +1282,39 @@
 }
 
 void INTERNAL_CALL
-GDIOBJ_SetOwnership(PGDI_HANDLE_TABLE HandleTable, HGDIOBJ ObjectHandle, PEPROCESS NewOwner)
+GDIOBJ_SetOwnership(HGDIOBJ ObjectHandle, PEPROCESS NewOwner)
 {
   PGDI_TABLE_ENTRY Entry;
   HANDLE ProcessId, LockedProcessId, PrevProcId;
-  PETHREAD Thread;
+  PW32THREAD Thread;
 #ifdef GDI_DEBUG
   ULONG Attempts = 0;
 #endif
 
   DPRINT("GDIOBJ_SetOwnership: hObj: 0x%x, NewProcess: 0x%x\n", ObjectHandle, (NewOwner ? PsGetProcessId(NewOwner) : 0));
 
-  Thread = PsGetCurrentThread();
+  Thread = PsGetCurrentThreadWin32Thread();
 
   if(!GDI_HANDLE_IS_STOCKOBJ(ObjectHandle))
   {
     ProcessId = PsGetCurrentProcessId();
     LockedProcessId = (HANDLE)((ULONG_PTR)ProcessId | 0x1);
 
-    Entry = GDI_HANDLE_GET_ENTRY(HandleTable, ObjectHandle);
+    Entry = GDI_HANDLE_GET_ENTRY(GdiHandleTable, ObjectHandle);
 
 LockHandle:
     /* lock the object, we must not convert stock objects, so don't check!!! */
     PrevProcId = _InterlockedCompareExchangePointer((PVOID*)&Entry->ProcessId, ProcessId, LockedProcessId);
     if(PrevProcId == ProcessId)
     {
-      PETHREAD PrevThread;
+      PW32THREAD PrevThread;
 
       if((Entry->Type & ~GDI_ENTRY_REUSE_MASK) != 0 && Entry->KernelData != NULL)
       {
-        PGDIOBJHDR GdiHdr = GDIBdyToHdr(Entry->KernelData);
-
-        PrevThread = GdiHdr->LockingThread;
-        if(GdiHdr->Locks == 0 || PrevThread == Thread)
+        POBJ Object = Entry->KernelData;
+
+        PrevThread = Object->Tid;
+        if(Object->cExclusiveLock == 0 || PrevThread == Thread)
         {
           PEPROCESS OldProcess;
           PW32PROCESS W32Process;
@@ -1427,10 +1415,10 @@
 }
 
 void INTERNAL_CALL
-GDIOBJ_CopyOwnership(PGDI_HANDLE_TABLE HandleTable, HGDIOBJ CopyFrom, HGDIOBJ CopyTo)
+GDIOBJ_CopyOwnership(HGDIOBJ CopyFrom, HGDIOBJ CopyTo)
 {
   PGDI_TABLE_ENTRY FromEntry;
-  PETHREAD Thread;
+  PW32THREAD Thread;
   HANDLE FromProcessId, FromLockedProcessId, FromPrevProcId;
 #ifdef GDI_DEBUG
   ULONG Attempts = 0;
@@ -1438,11 +1426,11 @@
 
   DPRINT("GDIOBJ_CopyOwnership: from: 0x%x, to: 0x%x\n", CopyFrom, CopyTo);
 
-  Thread = PsGetCurrentThread();
+  Thread = PsGetCurrentThreadWin32Thread();
 
   if(!GDI_HANDLE_IS_STOCKOBJ(CopyFrom) && !GDI_HANDLE_IS_STOCKOBJ(CopyTo))
   {
-    FromEntry = GDI_HANDLE_GET_ENTRY(HandleTable, CopyFrom);
+    FromEntry = GDI_HANDLE_GET_ENTRY(GdiHandleTable, CopyFrom);
 
     FromProcessId = (HANDLE)((ULONG_PTR)FromEntry->ProcessId & ~0x1);
     FromLockedProcessId = (HANDLE)((ULONG_PTR)FromProcessId | 0x1);
@@ -1452,17 +1440,17 @@
     FromPrevProcId = _InterlockedCompareExchangePointer((PVOID*)&FromEntry->ProcessId, FromProcessId, FromLockedProcessId);
     if(FromPrevProcId == FromProcessId)
     {
-      PETHREAD PrevThread;
-      PGDIOBJHDR GdiHdr;
+      PW32THREAD PrevThread;
+      POBJ Object;
 
       if((FromEntry->Type & ~GDI_ENTRY_REUSE_MASK) != 0 && FromEntry->KernelData != NULL)
       {
-        GdiHdr = GDIBdyToHdr(FromEntry->KernelData);
+        Object = FromEntry->KernelData;
 
         /* save the pointer to the calling thread so we know it was this thread
            that locked the object */
-        PrevThread = GdiHdr->LockingThread;
-        if(GdiHdr->Locks == 0 || PrevThread == Thread)
+        PrevThread = Object->Tid;
+        if(Object->cExclusiveLock == 0 || PrevThread == Thread)
         {
           /* now let's change the ownership of the target object */
 
@@ -1472,14 +1460,14 @@
             /* FIXME */
             if(NT_SUCCESS(PsLookupProcessByProcessId((HANDLE)((ULONG_PTR)FromPrevProcId & ~0x1), &ProcessTo)))
             {
-              GDIOBJ_SetOwnership(HandleTable, CopyTo, ProcessTo);
+              GDIOBJ_SetOwnership(CopyTo, ProcessTo);
               ObDereferenceObject(ProcessTo);
             }
           }
           else
           {
             /* mark the object as global */
-            GDIOBJ_SetOwnership(HandleTable, CopyTo, NULL);
+            GDIOBJ_SetOwnership(CopyTo, NULL);
           }
 
           (void)_InterlockedExchangePointer((PVOID*)&FromEntry->ProcessId, FromPrevProcId);
@@ -1580,7 +1568,7 @@
 //
   INT Index;
   PGDI_TABLE_ENTRY Entry;
-  HANDLE handle = GDIOBJ_AllocObj(GdiHandleTable, GDI_OBJECT_TYPE_CLIOBJ);
+  HANDLE handle = GDIOBJ_AllocObj(GDI_OBJECT_TYPE_CLIOBJ);
 // Need to change handle type based on ulType.
   Index = GDI_HANDLE_GET_INDEX((HGDIOBJ)handle);
   Entry = &GdiHandleTable->Entries[Index];
@@ -1600,7 +1588,7 @@
     IN HANDLE h
     )
 {
-  return GDIOBJ_FreeObj(GdiHandleTable, h, GDI_OBJECT_TYPE_CLIOBJ);
+  return GDIOBJ_FreeObj(h, GDI_OBJECT_TYPE_CLIOBJ);
 }
 
 /* EOF */

Modified: trunk/reactos/subsystems/win32/win32k/objects/palobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/palobj.c?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/palobj.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/palobj.c Wed Feb 27 02:09:20 2008
@@ -63,7 +63,7 @@
   HPALETTE NewPalette;
   PPALGDI PalGDI;
 
-  NewPalette = (HPALETTE) GDIOBJ_AllocObj(GdiHandleTable, GDI_OBJECT_TYPE_PALETTE);
+  NewPalette = (HPALETTE) GDIOBJ_AllocObj(GDI_OBJECT_TYPE_PALETTE);
   if (NULL == NewPalette)
     {
       return NULL;
@@ -112,7 +112,7 @@
   PPALGDI PalGDI;
   unsigned i;
 
-  NewPalette = (HPALETTE) GDIOBJ_AllocObj(GdiHandleTable, GDI_OBJECT_TYPE_PALETTE);
+  NewPalette = (HPALETTE) GDIOBJ_AllocObj(GDI_OBJECT_TYPE_PALETTE);
   if (NULL == NewPalette)
     {
       return NULL;

Modified: trunk/reactos/subsystems/win32/win32k/objects/region.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/region.c?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/region.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/region.c Wed Feb 27 02:09:20 2008
@@ -2088,7 +2088,7 @@
     HRGN hReg;
     PROSRGNDATA pReg;
 
-    if ((hReg = (HRGN) GDIOBJ_AllocObj(GdiHandleTable, GDI_OBJECT_TYPE_REGION)))
+    if ((hReg = (HRGN) GDIOBJ_AllocObj(GDI_OBJECT_TYPE_REGION)))
     {
         if (NULL != (pReg = RGNDATA_LockRgn(hReg)))
         {

Modified: trunk/reactos/subsystems/win32/win32k/objects/stockobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/stockobj.c?rev=32497&r1=32496&r2=32497&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/stockobj.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/stockobj.c Wed Feb 27 02:09:20 2008
@@ -149,7 +149,7 @@
     {
       if (NULL != StockObjects[Object])
 	{
-	  GDIOBJ_ConvertToStockObj(GdiHandleTable, &StockObjects[Object]);
+	  GDIOBJ_ConvertToStockObj(&StockObjects[Object]);
 	}
     }
 
@@ -284,7 +284,7 @@
       SysColorBrushes[i] = IntGdiCreateSolidBrush(SysColors[i]);
       if(SysColorBrushes[i] != NULL)
       {
-        GDIOBJ_ConvertToStockObj(GdiHandleTable, (HGDIOBJ*)&SysColorBrushes[i]);
+        GDIOBJ_ConvertToStockObj((HGDIOBJ*)&SysColorBrushes[i]);
       }
     }
   }
@@ -301,7 +301,7 @@
       SysColorPens[i] = IntGdiExtCreatePen(Pen.lopnStyle, Pen.lopnWidth.x, BS_SOLID, Pen.lopnColor, 0, 0, 0, NULL, 0, TRUE, NULL);
       if(SysColorPens[i] != NULL)
       {
-        GDIOBJ_ConvertToStockObj(GdiHandleTable, (HGDIOBJ*)&SysColorPens[i]);
+        GDIOBJ_ConvertToStockObj((HGDIOBJ*)&SysColorPens[i]);
       }
     }
   }




More information about the Ros-diffs mailing list