[ros-diffs] [jgardou] 47131: [WIN32K] - Allow NtGdiDeleteObjectApp to delete a permanent DC, as windows does it. This is not exactly what windows does, but no one should use a DeletedDC'ed DC anyway. Fixes "No! You Naughty Application" debug spam and some wine tests

jgardou at svn.reactos.org jgardou at svn.reactos.org
Sat May 8 18:41:41 CEST 2010


Author: jgardou
Date: Sat May  8 18:41:41 2010
New Revision: 47131

URL: http://svn.reactos.org/svn/reactos?rev=47131&view=rev
Log:
[WIN32K]
  - Allow NtGdiDeleteObjectApp to delete a permanent DC, as windows does it.
This is not exactly what windows does, but no one should use a DeletedDC'ed DC anyway.
Fixes "No! You Naughty Application" debug spam and some wine tests

Modified:
    branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c

Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c
URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c?rev=47131&r1=47130&r2=47131&view=diff
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] (original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Sat May  8 18:41:41 2010
@@ -801,11 +801,28 @@
 
     if (!Force)
     {
+        /* Windows permits NtGdiDeleteObjectApp to delete a permanent DC
+         * For some reason, it's still a valid handle, pointing to some kernel data.
+         * Not sure if this is a bug, a feature, some cache stuff... Who knows?
+         * See NtGdiDeleteObjectApp test for details */
         if (DCToDelete->fs & DC_FLAG_PERMANENT)
         {
-            DPRINT1("No! You Naughty Application!\n");
             DC_UnlockDc(DCToDelete);
-            return UserReleaseDC(NULL, hDC, FALSE);
+            if(UserReleaseDC(NULL, hDC, FALSE))
+            {
+                /* ReactOs feature : call UserReleaseDC
+                 * I don't think windows does it.
+                 * Still, complain, no one should ever call DeleteDC
+                 * on a window DC */
+                 DPRINT1("No, you naughty application!\n");
+                 return TRUE;
+            }
+            else
+            {
+                /* This is not a window owned DC.
+                 * Force its deletion */
+                return IntGdiDeleteDC(hDC, TRUE);
+            }
         }
     }
 




More information about the Ros-diffs mailing list