From 53a30e2f31bdf723851c28f960f69193076a3d5d Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Wed, 12 Apr 2006 10:15:46 +0000 Subject: [PATCH] commiting file desktop.x from bug 252 , the patch is from j_anderw it make our win32k lile more stable svn path=/trunk/; revision=21561 --- .../subsystems/win32/win32k/ntuser/desktop.c | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/desktop.c b/reactos/subsystems/win32/win32k/ntuser/desktop.c index 972525faf1f..55310d9840f 100644 --- a/reactos/subsystems/win32/win32k/ntuser/desktop.c +++ b/reactos/subsystems/win32/win32k/ntuser/desktop.c @@ -790,7 +790,9 @@ NtUserCreateDesktop( CSR_API_MESSAGE Request; PVOID DesktopHeapSystemBase = NULL; SIZE_T DesktopInfoSize; + UNICODE_STRING SafeDesktopName; DECLARE_RETURN(HDESK); + DPRINT("Enter NtUserCreateDesktop: %wZ\n", lpszDesktopName); UserEnterExclusive(); @@ -808,15 +810,29 @@ NtUserCreateDesktop( SetLastNtError(Status); RETURN( NULL); } + if(lpszDesktopName != NULL) + { + Status = IntSafeCopyUnicodeString(&SafeDesktopName, lpszDesktopName); + if(!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + RETURN( NULL); + } + } + else + { + RtlInitUnicodeString(&SafeDesktopName, NULL); + } if (! IntGetFullWindowStationName(&DesktopName, &WinStaObject->Name, - lpszDesktopName)) + &SafeDesktopName)) { SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); ObDereferenceObject(WinStaObject); + RtlFreeUnicodeString(&SafeDesktopName); RETURN( NULL); } - + RtlFreeUnicodeString(&SafeDesktopName); ObDereferenceObject(WinStaObject); /* @@ -998,6 +1014,7 @@ NtUserOpenDesktop( HWINSTA WinSta; PWINSTATION_OBJECT WinStaObject; UNICODE_STRING DesktopName; + UNICODE_STRING SafeDesktopName; NTSTATUS Status; HDESK Desktop; DECLARE_RETURN(HDESK); @@ -1024,14 +1041,30 @@ NtUserOpenDesktop( RETURN( 0); } + if(lpszDesktopName != NULL) + { + Status = IntSafeCopyUnicodeString(&SafeDesktopName, lpszDesktopName); + if(!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + RETURN( NULL); + } + } + else + { + RtlInitUnicodeString(&SafeDesktopName, NULL); + } + if (!IntGetFullWindowStationName(&DesktopName, &WinStaObject->Name, lpszDesktopName)) { SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); ObDereferenceObject(WinStaObject); + RtlFreeUnicodeString(&SafeDesktopName); RETURN( 0); } + RtlFreeUnicodeString(&SafeDesktopName); ObDereferenceObject(WinStaObject); DPRINT("Trying to open desktop (%wZ)\n", &DesktopName);