- Fix disconnecting from a desktop when IntSetThreadDesktop gets NULL parameter

svn path=/trunk/; revision=51101
This commit is contained in:
Giannis Adamopoulos 2011-03-20 14:28:12 +00:00
parent 5177b0a967
commit 508ce4d9f8

View file

@ -1798,7 +1798,7 @@ BOOL
IntSetThreadDesktop(IN HDESK hDesktop,
IN BOOL FreeOnFailure)
{
PDESKTOP DesktopObject, OldDesktop;
PDESKTOP DesktopObject = NULL, OldDesktop;
HDESK hOldDesktop;
PTHREADINFO W32Thread;
NTSTATUS Status;
@ -1809,6 +1809,8 @@ IntSetThreadDesktop(IN HDESK hDesktop,
MapHeap = (PsGetCurrentProcess() != PsInitialSystemProcess);
W32Thread = PsGetCurrentThreadWin32Thread();
if(hDesktop != NULL)
{
/* Validate the new desktop. */
Status = IntValidateDesktopHandle(
hDesktop,
@ -1818,7 +1820,7 @@ IntSetThreadDesktop(IN HDESK hDesktop,
if (!NT_SUCCESS(Status))
{
DPRINT("Validation of desktop handle (0x%X) failed\n", hDesktop);
DPRINT1("Validation of desktop handle (0x%X) failed\n", hDesktop);
return FALSE;
}
@ -1829,6 +1831,8 @@ IntSetThreadDesktop(IN HDESK hDesktop,
return TRUE;
}
}
if (!IsListEmpty(&W32Thread->WindowListHead))
{
DPRINT1("Attempted to change thread desktop although the thread has windows!\n");