From 3985d6c9801cc73bac2b0a7bff9d698fcf201b9c Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Sat, 9 Apr 2005 17:10:25 +0000 Subject: [PATCH] Close the desktop handle after getting the object pointer. svn path=/trunk/; revision=14563 --- reactos/subsys/win32k/main/dllmain.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/reactos/subsys/win32k/main/dllmain.c b/reactos/subsys/win32k/main/dllmain.c index ece94e4daf6..c139b878eb7 100644 --- a/reactos/subsys/win32k/main/dllmain.c +++ b/reactos/subsys/win32k/main/dllmain.c @@ -195,23 +195,22 @@ Win32kThreadCallback (struct _ETHREAD *Thread, } } - 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);