Author: gadamopoulos
Date: Sat Mar 16 10:12:16 2013
New Revision: 58514
URL: http://svn.reactos.org/svn/reactos?rev=58514&view=rev
Log:
[win32k]
- Store the session id in WINSTATION_OBJECT when we create a window station.
- Don't allow switching to a desktop that belongs to a different session
This is a modified version of the patch from CORE-5531
Modified:
trunk/reactos/win32ss/user/ntuser/desktop.c
trunk/reactos/win32ss/user/ntuser/winsta.c
trunk/reactos/win32ss/user/ntuser/winsta.h
Modified: trunk/reactos/win32ss/user/ntuser/desktop.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/deskto…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/desktop.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/desktop.c [iso-8859-1] Sat Mar 16 10:12:16 2013
@@ -1632,6 +1632,12 @@
RETURN(FALSE);
}
+ if (PsGetCurrentProcessSessionId() != pdesk->rpwinstaParent->dwSessionId)
+ {
+ ERR("NtUserSwitchDesktop called for a desktop of a different session\n");
+ RETURN(FALSE);
+ }
+
if(pdesk == gpdeskInputDesktop)
{
WARN("NtUserSwitchDesktop called for active desktop\n");
Modified: trunk/reactos/win32ss/user/ntuser/winsta.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/winsta…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/winsta.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/winsta.c [iso-8859-1] Sat Mar 16 10:12:16 2013
@@ -432,6 +432,7 @@
Status = RtlCreateAtomTable(37, &WindowStationObject->AtomTable);
WindowStationObject->SystemMenuTemplate = (HANDLE)0;
WindowStationObject->Name = WindowStationName;
+ WindowStationObject->dwSessionId = NtCurrentPeb()->SessionId;
if (InputWindowStation == NULL)
{
Modified: trunk/reactos/win32ss/user/ntuser/winsta.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/winsta…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/winsta.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/winsta.h [iso-8859-1] Sat Mar 16 10:12:16 2013
@@ -9,6 +9,8 @@
typedef struct _WINSTATION_OBJECT
{
+ DWORD dwSessionId;
+
KSPIN_LOCK Lock;
UNICODE_STRING Name;
LIST_ENTRY DesktopListHead;