[ros-diffs] [jimtabor] 45168: [Win32k] - System regions do not possess user attribute sections. See bug 5124. - Read the patch for more information.

jimtabor at svn.reactos.org jimtabor at svn.reactos.org
Thu Jan 21 01:14:06 CET 2010


Author: jimtabor
Date: Thu Jan 21 01:14:06 2010
New Revision: 45168

URL: http://svn.reactos.org/svn/reactos?rev=45168&view=rev
Log:
[Win32k]
- System regions do not possess user attribute sections. See bug 5124.
- Read the patch for more information.

Modified:
    trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c
    trunk/reactos/subsystems/win32/win32k/objects/dclife.c
    trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
    trunk/reactos/subsystems/win32/win32k/objects/region.c

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=45168&r1=45167&r2=45168&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c [iso-8859-1] Thu Jan 21 01:14:06 2010
@@ -32,7 +32,7 @@
 
    if (Dc->rosdc.hClipRgn == NULL)
       NtGdiCombineRgn(Dc->rosdc.hGCClipRgn, Dc->rosdc.hVisRgn, 0, RGN_COPY);
-   else
+   else // FYI: Vis == NULL! source of "IntGdiCombineRgn requires hSrc2 != NULL for combine mode 1!"
       NtGdiCombineRgn(Dc->rosdc.hGCClipRgn, Dc->rosdc.hClipRgn, Dc->rosdc.hVisRgn, RGN_AND);
    NtGdiOffsetRgn(Dc->rosdc.hGCClipRgn, Dc->ptlDCOrig.x, Dc->ptlDCOrig.y);
 

Modified: trunk/reactos/subsystems/win32/win32k/objects/dclife.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/dclife.c?rev=45168&r1=45167&r2=45168&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Thu Jan 21 01:14:06 2010
@@ -167,22 +167,50 @@
 FASTCALL
 DC_SetOwnership(HDC hDC, PEPROCESS Owner)
 {
+    INT Index;
+    PGDI_TABLE_ENTRY Entry;
     PDC pDC;
 
     if (!GDIOBJ_SetOwnership(hDC, Owner)) return FALSE;
     pDC = DC_LockDc(hDC);
     if (pDC)
     {
+    /*
+       System Regions:
+          These regions do not use attribute sections and when allocated, use
+          gdiobj level functions.
+    */
         if (pDC->rosdc.hClipRgn)
-        {
+        {   // FIXME! HAX!!!
+            KeEnterCriticalRegion();
+            Index = GDI_HANDLE_GET_INDEX(pDC->rosdc.hClipRgn);
+            Entry = &GdiHandleTable->Entries[Index];
+            if (Entry->UserData) FreeObjectAttr(Entry->UserData);
+            Entry->UserData = NULL;
+            KeLeaveCriticalRegion();
+            //
             if (!GDIOBJ_SetOwnership(pDC->rosdc.hClipRgn, Owner)) return FALSE;
         }
         if (pDC->rosdc.hVisRgn)
-        {
+        {   // FIXME! HAX!!!
+            KeEnterCriticalRegion();
+            Index = GDI_HANDLE_GET_INDEX(pDC->rosdc.hVisRgn);
+            Entry = &GdiHandleTable->Entries[Index];
+            if (Entry->UserData) FreeObjectAttr(Entry->UserData);
+            Entry->UserData = NULL;
+            KeLeaveCriticalRegion();
+            //
             if (!GDIOBJ_SetOwnership(pDC->rosdc.hVisRgn, Owner)) return FALSE;
         }
         if (pDC->rosdc.hGCClipRgn)
-        {
+        {   // FIXME! HAX!!!
+            KeEnterCriticalRegion();
+            Index = GDI_HANDLE_GET_INDEX(pDC->rosdc.hGCClipRgn);
+            Entry = &GdiHandleTable->Entries[Index];
+            if (Entry->UserData) FreeObjectAttr(Entry->UserData);
+            Entry->UserData = NULL;
+            KeLeaveCriticalRegion();
+            //
             if (!GDIOBJ_SetOwnership(pDC->rosdc.hGCClipRgn, Owner)) return FALSE;
         }
         if (pDC->dclevel.hPath)

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=45168&r1=45167&r2=45168&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 Jan 21 01:14:06 2010
@@ -753,7 +753,8 @@
              if (pAttr)
              {
                 KeEnterCriticalRegion();
-                FreeObjectAttr(pAttr);
+                if (pAttr) FreeObjectAttr(pAttr);
+                Entry->UserData = NULL;
                 KeLeaveCriticalRegion();
              }
              break;

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=45168&r1=45167&r2=45168&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 Jan 21 01:14:06 2010
@@ -2085,6 +2085,7 @@
   PGDI_TABLE_ENTRY Entry;
   PROSRGNDATA pRgn;
   PRGN_ATTR pRgn_Attr;
+  HANDLE pid;
 
   pRgn = REGION_LockRgn(hRgn);
 
@@ -2094,9 +2095,11 @@
      Index = GDI_HANDLE_GET_INDEX(hRgn);
      Entry = &GdiHandleTable->Entries[Index];
      pRgn_Attr = Entry->UserData;
+     pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1);
      KeLeaveCriticalRegion();
 
-     if (pRgn_Attr)
+     if ( pid == NtCurrentTeb()->ClientId.UniqueProcess &&
+          pRgn_Attr )
      {
         _SEH2_TRY
         {
@@ -2144,6 +2147,7 @@
   INT Index;
   PGDI_TABLE_ENTRY Entry;
   PRGN_ATTR pRgn_Attr;
+  HANDLE pid;
 
   if (pRgn)
   {
@@ -2151,9 +2155,11 @@
      Index = GDI_HANDLE_GET_INDEX(pRgn->BaseObject.hHmgr);
      Entry = &GdiHandleTable->Entries[Index];
      pRgn_Attr = Entry->UserData;
+     pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1);
      KeLeaveCriticalRegion();
 
-     if ( pRgn_Attr )
+     if ( pid == NtCurrentTeb()->ClientId.UniqueProcess &&
+          pRgn_Attr )
      {
         _SEH2_TRY
         {
@@ -2175,6 +2181,12 @@
   REGION_UnlockRgn(pRgn);
 }
 
+/*
+  System Regions:
+    These regions do not use attribute sections and when allocated, use gdiobj
+    level functions.
+*/
+
 BOOL INTERNAL_CALL
 REGION_Cleanup(PVOID ObjectBody)
 {
@@ -2190,7 +2202,6 @@
   if ( pRgn == prgnDefault) return;
   REGION_FreeRgn(pRgn);
 }
-
 
 VOID FASTCALL
 IntGdiReleaseRaoRgn(PDC pDC)
@@ -2201,7 +2212,6 @@
   Entry->Flags |= GDI_ENTRY_VALIDATE_VIS;
   RECTL_vSetEmptyRect(&pDC->erclClip);
 }
-
 
 VOID FASTCALL
 IntGdiReleaseVisRgn(PDC pDC)




More information about the Ros-diffs mailing list