[ros-diffs] [jimtabor] 46414: - Fix for gdibatch, does not help Acrobat reader 7.

jimtabor at svn.reactos.org jimtabor at svn.reactos.org
Thu Mar 25 00:35:24 CET 2010


Author: jimtabor
Date: Thu Mar 25 00:35:23 2010
New Revision: 46414

URL: http://svn.reactos.org/svn/reactos?rev=46414&view=rev
Log:
- Fix for gdibatch, does not help Acrobat reader 7.

Modified:
    trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c

Modified: trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c?rev=46414&r1=46413&r2=46414&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/gdibatch.c [iso-8859-1] Thu Mar 25 00:35:23 2010
@@ -66,14 +66,34 @@
 FASTCALL
 GdiFlushUserBatch(PDC dc, PGDIBATCHHDR pHdr)
 {
+  BOOL Hit = FALSE;
+  ULONG Cmd = 0, Size = 0;
   PDC_ATTR pdcattr = NULL;
 
   if (dc)
   {
-    pdcattr = dc->pdcattr;
-  }
+     pdcattr = dc->pdcattr;
+  }
+
+  _SEH2_TRY
+  {
+     Cmd = pHdr->Cmd;
+     Size = pHdr->Size; // Return the full size of the structure.
+  }
+  _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+  {
+     Hit = TRUE;
+  }
+  _SEH2_END;
+
+  if (Hit)
+  {
+     DPRINT1("WARNING! GdiBatch Fault!\n");
+     return 0;
+  }
+
   // FYI! The thread is approaching the end of sunset.
-  switch(pHdr->Cmd)
+  switch(Cmd)
   {
      case GdiBCPatBlt: // Highest pri first!
         break;
@@ -113,7 +133,7 @@
         break;
   }
 
-  return pHdr->Size; // Return the full size of the structure.
+  return Size; 
 }
 
 /*
@@ -139,7 +159,6 @@
 APIENTRY
 NtGdiFlushUserBatch(VOID)
 {
-  BOOL Hit;
   PTEB pTeb = NtCurrentTeb();
   ULONG GdiBatchCount = pTeb->GdiBatchCount;
 
@@ -161,28 +180,13 @@
       }
 
        // No need to init anything, just go!
-       for (Hit = FALSE; GdiBatchCount > 0; GdiBatchCount--)
-       {   /*
-              Looks like a hack,
-              feels like a hack,
-              you're right it's a hack,
-              due to the lack,
-              of kernel thread locking when it is in sunset!
-            */
-           _SEH2_TRY
-           {
-              ((PGDIBATCHHDR)pHdr)->Cmd = ((PGDIBATCHHDR)pHdr)->Cmd;
-           }
-           _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
-           {
-              Hit = TRUE;
-           }
-           _SEH2_END;
-
-           if (Hit) break;
-
+       for (; GdiBatchCount > 0; GdiBatchCount--)
+       {
+           ULONG Size;
            // Process Gdi Batch!
-           pHdr += GdiFlushUserBatch(pDC, (PGDIBATCHHDR) pHdr);
+           Size = GdiFlushUserBatch(pDC, (PGDIBATCHHDR) pHdr);
+           if (!Size) break;
+           pHdr += Size;
        }
 
        if (pDC)




More information about the Ros-diffs mailing list