Author: gadamopoulos
Date: Sat Feb 25 18:26:05 2012
New Revision: 55857
URL:
http://svn.reactos.org/svn/reactos?rev=55857&view=rev
Log:
[win32k]
- null terminate DesktopObject->pDeskInfo->szDesktopName and
WindowStationObject->Name
- null terminate the buffer when NtUserGetObjectInformation is called with UOI_NAME
parameter
- should fix a random failure in user32:desktop tests
Modified:
trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c
trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] Sat Feb 25
18:26:05 2012
@@ -845,7 +845,7 @@
{
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 @@
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 @@
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);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c [iso-8859-1] Sat Feb 25 18:26:05
2012
@@ -364,7 +364,7 @@
_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 @@
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 @@
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