Author: gadamopoulos Date: Thu Feb 9 19:41:38 2012 New Revision: 55517 URL: http://svn.reactos.org/svn/reactos?rev=55517&view=rev Log: [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
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c?rev=55517&r1=55516&r2=55517&view=diff ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] Thu Feb 9 19:41:38 2012 @@ -67,6 +67,10 @@ 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 @@ /* Set the desktop object and return success */ *Object = Desktop; + *pContext = TRUE; return STATUS_SUCCESS; } @@ -844,7 +849,7 @@ 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 @@ 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); }