Author: ion
Date: Sun Sep 22 18:47:36 2013
New Revision: 60317
URL:
http://svn.reactos.org/svn/reactos?rev=60317&view=rev
Log:
[NTOSKRNL]: Implement and export PsGetProcessSessionIdEx, and MmGetSessionIdEx. Dedicated
to hbelusca. If you look at the diff (please don't), yes, this is seriously how it
works in Windows.
Modified:
trunk/reactos/ntoskrnl/include/internal/mm.h
trunk/reactos/ntoskrnl/mm/ARM3/procsup.c
trunk/reactos/ntoskrnl/ntoskrnl.spec
trunk/reactos/ntoskrnl/ps/process.c
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Sun Sep 22 18:47:36 2013
@@ -493,6 +493,12 @@
IN PEPROCESS Process
);
+ULONG
+NTAPI
+MmGetSessionIdEx(
+ IN PEPROCESS Process
+);
+
/* marea.c *******************************************************************/
NTSTATUS
Modified: trunk/reactos/ntoskrnl/mm/ARM3/procsup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/procsup.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] Sun Sep 22 18:47:36 2013
@@ -1561,6 +1561,21 @@
return SessionGlobal->SessionId;
}
+ULONG
+NTAPI
+MmGetSessionIdEx(IN PEPROCESS Process)
+{
+ PMM_SESSION_SPACE SessionGlobal;
+
+ /* The session leader is always session zero */
+ if (Process->Vm.Flags.SessionLeader == 1) return 0;
+
+ /* Otherwise, get the session global, and read the session ID from it */
+ SessionGlobal = (PMM_SESSION_SPACE)Process->Session;
+ if (!SessionGlobal) return -1;
+ return SessionGlobal->SessionId;
+}
+
VOID
NTAPI
MiReleaseProcessReferenceToSessionDataPage(IN PMM_SESSION_SPACE SessionGlobal)
Modified: trunk/reactos/ntoskrnl/ntoskrnl.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.spec?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ntoskrnl.spec [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ntoskrnl.spec [iso-8859-1] Sun Sep 22 18:47:36 2013
@@ -987,7 +987,7 @@
@ stdcall PsGetProcessSectionBaseAddress(ptr)
@ stdcall PsGetProcessSecurityPort(ptr)
@ stdcall PsGetProcessSessionId(ptr)
-;PsGetProcessSessionIdEx
+@ stdcall PsGetProcessSessionIdEx(ptr)
@ stdcall PsGetProcessWin32Process(ptr)
@ stdcall PsGetProcessWin32WindowStation(ptr)
;@ cdecl -arch=x86_64 PsGetProcessWow64Process()
Modified: trunk/reactos/ntoskrnl/ps/process.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/process.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/process.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ps/process.c [iso-8859-1] Sun Sep 22 18:47:36 2013
@@ -1149,9 +1149,19 @@
*/
ULONG
NTAPI
-PsGetProcessSessionId(PEPROCESS Process)
+PsGetProcessSessionId(IN PEPROCESS Process)
{
return MmGetSessionId(Process);
+}
+
+/*
+ * @implemented
+ */
+ULONG
+NTAPI
+PsGetProcessSessionIdEx(IN PEPROCESS Process)
+{
+ return MmGetSessionIdEx(Process);
}
/*