[ros-diffs] [hbirr] 14563: Close the desktop handle after getting the object pointer.

hbirr at svn.reactos.com hbirr at svn.reactos.com
Sat Apr 9 19:10:28 CEST 2005


Close the desktop handle after getting the object pointer.
Modified: trunk/reactos/subsys/win32k/main/dllmain.c
  _____  

Modified: trunk/reactos/subsys/win32k/main/dllmain.c
--- trunk/reactos/subsys/win32k/main/dllmain.c	2005-04-09 13:48:31 UTC
(rev 14562)
+++ trunk/reactos/subsys/win32k/main/dllmain.c	2005-04-09 17:10:25 UTC
(rev 14563)
@@ -195,23 +195,22 @@

           }
         }
 
-        Win32Thread->hDesktop = hDesk;
-
-        Status = ObReferenceObjectByHandle(hDesk,
-                 0,
-                 ExDesktopObjectType,
-                 KernelMode,
-                 (PVOID*)&Win32Thread->Desktop,
-                 NULL);
-
-        if(!NT_SUCCESS(Status))
+        if (hDesk != NULL)
         {
-          DPRINT1("Unable to reference thread desktop handle 0x%x\n",
hDesk);
-          Win32Thread->Desktop = NULL;
+          Status = ObReferenceObjectByHandle(hDesk,
+                                             0,
+                                             ExDesktopObjectType,
+                                             KernelMode,
+
(PVOID*)&Win32Thread->Desktop,
+                                             NULL);
           NtClose(hDesk);
+          if(!NT_SUCCESS(Status))
+          {
+            DPRINT1("Unable to reference thread desktop handle 0x%x\n",
hDesk);
+            Win32Thread->Desktop = NULL;
+          }
         }
       }
-
       Win32Thread->IsExiting = FALSE;
       IntDestroyCaret(Win32Thread);
       Win32Thread->MessageQueue = MsqCreateMessageQueue(Thread);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050409/f319e609/attachment.html


More information about the Ros-diffs mailing list