[WIN32K]
[reactos.git] / reactos / win32ss / gdi / ntgdi / gdiobj.c
index 6b82c34..f3365cb 100644 (file)
@@ -51,8 +51,7 @@
            (objt) == GDIObjType_BRUSH_TYPE)
 #define ASSERT_EXCLUSIVE_OBJECT_TYPE(objt) \
     ASSERT((objt) == GDIObjType_DC_TYPE || \
            (objt) == GDIObjType_BRUSH_TYPE)
 #define ASSERT_EXCLUSIVE_OBJECT_TYPE(objt) \
     ASSERT((objt) == GDIObjType_DC_TYPE || \
-           (objt) == GDIObjType_RGN_TYPE || \
-           (objt) == GDIObjType_LFONT_TYPE)
+           (objt) == GDIObjType_RGN_TYPE)
 #else
 #define DBG_INCREASE_LOCK_COUNT(ppi, hobj)
 #define DBG_DECREASE_LOCK_COUNT(x, y)
 #else
 #define DBG_INCREASE_LOCK_COUNT(ppi, hobj)
 #define DBG_DECREASE_LOCK_COUNT(x, y)
 #define ASSERT_EXCLUSIVE_OBJECT_TYPE(objt)
 #endif
 
 #define ASSERT_EXCLUSIVE_OBJECT_TYPE(objt)
 #endif
 
-#define MmMapViewInSessionSpace MmMapViewInSystemSpace
-
 #if defined(_M_IX86) || defined(_M_AMD64)
 #define InterlockedOr16 _InterlockedOr16
 #endif
 
 #if defined(_M_IX86) || defined(_M_AMD64)
 #define InterlockedOr16 _InterlockedOr16
 #endif
 
-#define GDIOBJ_POOL_TAG(type) ('00hG' + ((objt & 0x1f) << 24))
+#define GDIOBJ_POOL_TAG(type) ('00hG' + (((type) & 0x1f) << 24))
 
 enum
 {
 
 enum
 {
@@ -81,8 +78,8 @@ enum
 
 /* Per session handle table globals */
 static PVOID gpvGdiHdlTblSection = NULL;
 
 /* Per session handle table globals */
 static PVOID gpvGdiHdlTblSection = NULL;
-static PENTRY gpentHmgr;
-static PULONG gpaulRefCount;
+PENTRY gpentHmgr;
+PULONG gpaulRefCount;
 ULONG gulFirstFree;
 ULONG gulFirstUnused;
 static PPAGED_LOOKASIDE_LIST gpaLookasideList;
 ULONG gulFirstFree;
 ULONG gulFirstUnused;
 static PPAGED_LOOKASIDE_LIST gpaLookasideList;
@@ -166,7 +163,7 @@ InitGdiHandleTable(void)
                              NULL,
                              &liSize,
                              PAGE_READWRITE,
                              NULL,
                              &liSize,
                              PAGE_READWRITE,
-                             SEC_COMMIT,
+                             SEC_COMMIT | 0x1,
                              NULL,
                              NULL);
     if (!NT_SUCCESS(status))
                              NULL,
                              NULL);
     if (!NT_SUCCESS(status))
@@ -361,7 +358,7 @@ ENTRY_ReferenceEntryByHandle(HGDIOBJ hobj, FLONG fl)
         if (pentry->FullUnique != (USHORT)((ULONG_PTR)hobj >> 16))
         {
             DPRINT("GDIOBJ: Wrong unique value. Handle: 0x%4x, entry: 0x%4x\n",
         if (pentry->FullUnique != (USHORT)((ULONG_PTR)hobj >> 16))
         {
             DPRINT("GDIOBJ: Wrong unique value. Handle: 0x%4x, entry: 0x%4x\n",
-                   (USHORT)((ULONG_PTR)hobj >> 16, pentry->FullUnique));
+                   (USHORT)((ULONG_PTR)hobj >> 16), pentry->FullUnique);
             return NULL;
         }
 
             return NULL;
         }
 
@@ -1240,6 +1237,11 @@ GDIOBJ_AllocObjWithHandle(ULONG ObjectType, ULONG cjSize)
     }
 
     pobj = GDIOBJ_AllocateObject(objt, cjSize, fl);
     }
 
     pobj = GDIOBJ_AllocateObject(objt, cjSize, fl);
+    if (!pobj)
+    {
+        return NULL;
+    }
+
     if (!GDIOBJ_hInsertObject(pobj, GDI_OBJ_HMGR_POWNED))
     {
         GDIOBJ_vFreeObject(pobj);
     if (!GDIOBJ_hInsertObject(pobj, GDI_OBJ_HMGR_POWNED))
     {
         GDIOBJ_vFreeObject(pobj);
@@ -1286,7 +1288,7 @@ GDI_CleanupForProcess(struct _EPROCESS *Process)
     DWORD dwProcessId;
     PPROCESSINFO ppi;
 
     DWORD dwProcessId;
     PPROCESSINFO ppi;
 
-    DPRINT("CleanupForProcess prochandle %x Pid %d\n",
+    DPRINT("CleanupForProcess prochandle %p Pid %p\n",
            Process, Process->UniqueProcessId);
 
     ASSERT(Process == PsGetCurrentProcess());
            Process, Process->UniqueProcessId);
 
     ASSERT(Process == PsGetCurrentProcess());
@@ -1317,7 +1319,7 @@ GDI_CleanupForProcess(struct _EPROCESS *Process)
 #endif
 
     ppi = PsGetCurrentProcessWin32Process();
 #endif
 
     ppi = PsGetCurrentProcessWin32Process();
-    DPRINT("Completed cleanup for process %d\n", Process->UniqueProcessId);
+    DPRINT("Completed cleanup for process %p\n", Process->UniqueProcessId);
     if (ppi->GDIHandleCount != 0)
     {
         DPRINT1("Leaking %d handles!\n", ppi->GDIHandleCount);
     if (ppi->GDIHandleCount != 0)
     {
         DPRINT1("Leaking %d handles!\n", ppi->GDIHandleCount);
@@ -1343,4 +1345,5 @@ GDI_CleanupForProcess(struct _EPROCESS *Process)
     return TRUE;
 }
 
     return TRUE;
 }
 
+
 /* EOF */
 /* EOF */