[Win32k]
authorJames Tabor <james.tabor@reactos.org>
Tue, 29 May 2012 21:34:06 +0000 (21:34 +0000)
committerJames Tabor <james.tabor@reactos.org>
Tue, 29 May 2012 21:34:06 +0000 (21:34 +0000)
- Users are not allowed to set null desktops. Fixes bug 6759.

svn path=/trunk/; revision=56676

reactos/win32ss/user/ntuser/desktop.c

index 9050b71..1751359 100644 (file)
@@ -1889,11 +1889,15 @@ IntSetThreadDesktop(IN HDESK hDesktop,
 BOOL APIENTRY
 NtUserSetThreadDesktop(HDESK hDesktop)
 {
-   BOOL ret;
+   BOOL ret = FALSE;
 
    UserEnterExclusive();
 
-   ret = IntSetThreadDesktop(hDesktop, FALSE);
+   // FIXME: IntSetThreadDesktop validates the desktop handle, it should happen
+   // here too and set the NT error level. Q. Is it necessary to have the validation
+   // in IntSetThreadDesktop? Is it needed there too?
+   if (hDesktop || (!hDesktop && CsrProcess == PsGetCurrentProcess()))
+      ret = IntSetThreadDesktop(hDesktop, FALSE);
 
    UserLeave();