diff --git a/reactos/subsystems/win32/win32k/ntuser/desktop.c b/reactos/subsystems/win32/win32k/ntuser/desktop.c index a976fa5610c..91e4ca1394c 100644 --- a/reactos/subsystems/win32/win32k/ntuser/desktop.c +++ b/reactos/subsystems/win32/win32k/ntuser/desktop.c @@ -845,7 +845,7 @@ NtUserCreateDesktop( { ProbeForRead( ObjectAttributes, sizeof(OBJECT_ATTRIBUTES), 1); - Status = IntSafeCopyUnicodeString(&DesktopName, ObjectAttributes->ObjectName); + Status = IntSafeCopyUnicodeStringTerminateNULL(&DesktopName, ObjectAttributes->ObjectName); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -886,7 +886,7 @@ NtUserCreateDesktop( RETURN(NULL); } - DesktopInfoSize = sizeof(DESKTOPINFO) + DesktopName.Length; + DesktopInfoSize = sizeof(DESKTOPINFO) + DesktopName.Length + sizeof(WCHAR); DesktopObject->pDeskInfo = RtlAllocateHeap(DesktopObject->pheapDesktop, HEAP_NO_SERIALIZE, @@ -906,7 +906,7 @@ NtUserCreateDesktop( DesktopObject->pDeskInfo->pvDesktopLimit = (PVOID)((ULONG_PTR)DesktopHeapSystemBase + HeapSize); RtlCopyMemory(DesktopObject->pDeskInfo->szDesktopName, DesktopName.Buffer, - DesktopName.Length); + DesktopName.Length + sizeof(WCHAR)); /* Initialize some local (to win32k) desktop state. */ InitializeListHead(&DesktopObject->PtiList); diff --git a/reactos/subsystems/win32/win32k/ntuser/winsta.c b/reactos/subsystems/win32/win32k/ntuser/winsta.c index 2a5ac8d0a18..b2e4d54d664 100644 --- a/reactos/subsystems/win32/win32k/ntuser/winsta.c +++ b/reactos/subsystems/win32/win32k/ntuser/winsta.c @@ -364,7 +364,7 @@ NtUserCreateWindowStation( _SEH2_TRY { ProbeForRead( ObjectAttributes, sizeof(OBJECT_ATTRIBUTES), 1); - Status = IntSafeCopyUnicodeString(&WindowStationName, ObjectAttributes->ObjectName); + Status = IntSafeCopyUnicodeStringTerminateNULL(&WindowStationName, ObjectAttributes->ObjectName); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -653,14 +653,14 @@ NtUserGetObjectInformation( case UOI_NAME: if (WinStaObject != NULL) { - pvData = ((PUNICODE_STRING)GET_DESKTOP_NAME(WinStaObject))->Buffer; - nDataSize = ((PUNICODE_STRING)GET_DESKTOP_NAME(WinStaObject))->Length + 2; + pvData = WinStaObject->Name.Buffer; + nDataSize = WinStaObject->Name.Length + sizeof(WCHAR); Status = STATUS_SUCCESS; } else if (DesktopObject != NULL) { - pvData = ((PUNICODE_STRING)GET_DESKTOP_NAME(DesktopObject))->Buffer; - nDataSize = ((PUNICODE_STRING)GET_DESKTOP_NAME(DesktopObject))->Length + 2; + pvData = DesktopObject->pDeskInfo->szDesktopName; + nDataSize = (wcslen(DesktopObject->pDeskInfo->szDesktopName) + 1) * sizeof(WCHAR); Status = STATUS_SUCCESS; } else @@ -671,13 +671,13 @@ NtUserGetObjectInformation( if (WinStaObject != NULL) { pvData = L"WindowStation"; - nDataSize = (wcslen(pvData) + 1) * sizeof(WCHAR); + nDataSize = sizeof(L"WindowStation"); Status = STATUS_SUCCESS; } else if (DesktopObject != NULL) { pvData = L"Desktop"; - nDataSize = (wcslen(pvData) + 1) * sizeof(WCHAR); + nDataSize = sizeof(L"Desktop"); Status = STATUS_SUCCESS; } else