[ros-diffs] [jimtabor] 51008: [Win32k] - Fix an uncovered bug. This should fix coolplayer and winamp type applications. Does not fix drawing issues.

jimtabor at svn.reactos.org jimtabor at svn.reactos.org
Thu Mar 10 13:09:56 UTC 2011


Author: jimtabor
Date: Thu Mar 10 13:09:56 2011
New Revision: 51008

URL: http://svn.reactos.org/svn/reactos?rev=51008&view=rev
Log:
[Win32k]
- Fix an uncovered bug. This should fix coolplayer and winamp type applications. Does not fix drawing issues.

Modified:
    trunk/reactos/subsystems/win32/win32k/include/gdiobj.h
    trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
    trunk/reactos/subsystems/win32/win32k/objects/region.c

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=51008&r1=51007&r2=51008&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] Thu Mar 10 13:09:56 2011
@@ -160,3 +160,7 @@
 
 #define GDIOBJ_GetKernelObj(Handle) \
   ((PGDI_TABLE_ENTRY)&GdiHandleTable->Entries[GDI_HANDLE_GET_INDEX(Handle)])->KernelData
+#define GDI_ENTRY_TO_INDEX(ht, e)                                              \
+  (((ULONG_PTR)(e) - (ULONG_PTR)&((ht)->Entries[0])) / sizeof(GDI_TABLE_ENTRY))
+#define GDI_HANDLE_GET_ENTRY(HandleTable, h)                                   \
+  (&(HandleTable)->Entries[GDI_HANDLE_GET_INDEX((h))])

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=51008&r1=51007&r2=51008&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] Thu Mar 10 13:09:56 2011
@@ -11,11 +11,6 @@
 #include <win32k.h>
 #define NDEBUG
 #include <debug.h>
-
-#define GDI_ENTRY_TO_INDEX(ht, e)                                              \
-  (((ULONG_PTR)(e) - (ULONG_PTR)&((ht)->Entries[0])) / sizeof(GDI_TABLE_ENTRY))
-#define GDI_HANDLE_GET_ENTRY(HandleTable, h)                                   \
-  (&(HandleTable)->Entries[GDI_HANDLE_GET_INDEX((h))])
 
 #define BASE_OBJTYPE_COUNT 32
 

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=51008&r1=51007&r2=51008&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/region.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/region.c [iso-8859-1] Thu Mar 10 13:09:56 2011
@@ -2073,14 +2073,12 @@
 REGION_AllocUserRgnWithHandle(INT nRgn)
 {
     PROSRGNDATA pRgn;
-    INT Index;
     PGDI_TABLE_ENTRY Entry;
 
     pRgn = REGION_AllocRgnWithHandle(nRgn);
     if (pRgn)
     {
-       Index = GDI_HANDLE_GET_INDEX(pRgn->BaseObject.hHmgr);
-       Entry = &GdiHandleTable->Entries[Index];
+       Entry = GDI_HANDLE_GET_ENTRY(GdiHandleTable, pRgn->BaseObject.hHmgr);
        Entry->UserData = AllocateObjectAttr();
     }
     return pRgn;
@@ -2090,23 +2088,18 @@
 FASTCALL
 RGNOBJAPI_Lock(HRGN hRgn, PRGN_ATTR *ppRgn_Attr)
 {
-  INT Index;
   PGDI_TABLE_ENTRY Entry;
-  PROSRGNDATA pRgn;
   PRGN_ATTR pRgn_Attr;
-  HANDLE pid;
+  PROSRGNDATA pRgn = NULL;
 
   pRgn = REGION_LockRgn(hRgn);
 
-  if (pRgn)
+  if (pRgn && GDIOBJ_OwnedByCurrentProcess(hRgn))
   {
-     Index = GDI_HANDLE_GET_INDEX(hRgn);
-     Entry = &GdiHandleTable->Entries[Index];
+     Entry = GDI_HANDLE_GET_ENTRY(GdiHandleTable, hRgn);
      pRgn_Attr = Entry->UserData;
-     pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1);
-
-     if ( pid == NtCurrentTeb()->ClientId.UniqueProcess &&
-          pRgn_Attr )
+
+     if ( pRgn_Attr )
      {
         _SEH2_TRY
         {
@@ -2151,20 +2144,15 @@
 FASTCALL
 RGNOBJAPI_Unlock(PROSRGNDATA pRgn)
 {
-  INT Index;
   PGDI_TABLE_ENTRY Entry;
   PRGN_ATTR pRgn_Attr;
-  HANDLE pid;
-
-  if (pRgn)
+
+  if (pRgn && GDIOBJ_OwnedByCurrentProcess(pRgn->BaseObject.hHmgr))
   {
-     Index = GDI_HANDLE_GET_INDEX(pRgn->BaseObject.hHmgr);
-     Entry = &GdiHandleTable->Entries[Index];
+     Entry = GDI_HANDLE_GET_ENTRY(GdiHandleTable, pRgn->BaseObject.hHmgr);
      pRgn_Attr = Entry->UserData;
-     pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1);
-
-     if ( pid == NtCurrentTeb()->ClientId.UniqueProcess &&
-          pRgn_Attr )
+
+     if ( pRgn_Attr )
      {
         _SEH2_TRY
         {




More information about the Ros-diffs mailing list