From 9cde5acdc8573b7f6f2a3d5eb8ecf10a8b59bcf4 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Thu, 9 Feb 2012 19:41:38 +0000 Subject: [PATCH] [win32k] - Use the parse context to store whether or not the desktop object was created. If the object was not created, NtUserCreateDesktop should return immediately (this can happen if it didn't exist) - Before this , if the desktop already exited, we opened the existing desktop and initialized it again. We also created another desktop heap, desktop window, etc.. This fact confused threads using this desktop and caused problems like the assertion we see in the test suite svn path=/trunk/; revision=55517 --- reactos/subsystems/win32/win32k/ntuser/desktop.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/desktop.c b/reactos/subsystems/win32/win32k/ntuser/desktop.c index a04d2cedffe..00abc978cf7 100644 --- a/reactos/subsystems/win32/win32k/ntuser/desktop.c +++ b/reactos/subsystems/win32/win32k/ntuser/desktop.c @@ -67,6 +67,10 @@ IntDesktopObjectParse(IN PVOID ParseObject, PLIST_ENTRY NextEntry, ListHead; PWINSTATION_OBJECT WinStaObject = (PWINSTATION_OBJECT)ParseObject; PUNICODE_STRING DesktopName; + PBOOLEAN pContext = (PBOOLEAN) Context; + + if(pContext) + *pContext = FALSE; /* Set the list pointers and loop the window station */ ListHead = &WinStaObject->DesktopListHead; @@ -144,6 +148,7 @@ IntDesktopObjectParse(IN PVOID ParseObject, /* Set the desktop object and return success */ *Object = Desktop; + *pContext = TRUE; return STATUS_SUCCESS; } @@ -844,7 +849,7 @@ NtUserCreateDesktop( CSR_API_MESSAGE Request; PVOID DesktopHeapSystemBase = NULL; SIZE_T DesktopInfoSize; - ULONG DummyContext; + BOOLEAN Context; ULONG_PTR HeapSize = 4 * 1024 * 1024; /* FIXME */ UNICODE_STRING ClassName; LARGE_STRING WindowName; @@ -880,10 +885,12 @@ NtUserCreateDesktop( UserMode, NULL, dwDesiredAccess, - (PVOID)&DummyContext, + (PVOID)&Context, (HANDLE*)&Desktop); if (!NT_SUCCESS(Status)) RETURN(NULL); - if (Status == STATUS_OBJECT_NAME_EXISTS) + + /* In case the object was not created (eg if it existed), return now */ + if (Context == FALSE) { RETURN( Desktop); }