[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.

svn path=/trunk/; revision=60317
This commit is contained in:
Alex Ionescu 2013-09-22 18:47:36 +00:00
parent 2cdfc40af8
commit 7e3fbb3780
4 changed files with 33 additions and 2 deletions

View file

@ -493,6 +493,12 @@ MmGetSessionId(
IN PEPROCESS Process IN PEPROCESS Process
); );
ULONG
NTAPI
MmGetSessionIdEx(
IN PEPROCESS Process
);
/* marea.c *******************************************************************/ /* marea.c *******************************************************************/
NTSTATUS NTSTATUS

View file

@ -1561,6 +1561,21 @@ MmGetSessionId(IN PEPROCESS Process)
return SessionGlobal->SessionId; 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 VOID
NTAPI NTAPI
MiReleaseProcessReferenceToSessionDataPage(IN PMM_SESSION_SPACE SessionGlobal) MiReleaseProcessReferenceToSessionDataPage(IN PMM_SESSION_SPACE SessionGlobal)

View file

@ -987,7 +987,7 @@
@ stdcall PsGetProcessSectionBaseAddress(ptr) @ stdcall PsGetProcessSectionBaseAddress(ptr)
@ stdcall PsGetProcessSecurityPort(ptr) @ stdcall PsGetProcessSecurityPort(ptr)
@ stdcall PsGetProcessSessionId(ptr) @ stdcall PsGetProcessSessionId(ptr)
;PsGetProcessSessionIdEx @ stdcall PsGetProcessSessionIdEx(ptr)
@ stdcall PsGetProcessWin32Process(ptr) @ stdcall PsGetProcessWin32Process(ptr)
@ stdcall PsGetProcessWin32WindowStation(ptr) @ stdcall PsGetProcessWin32WindowStation(ptr)
;@ cdecl -arch=x86_64 PsGetProcessWow64Process() ;@ cdecl -arch=x86_64 PsGetProcessWow64Process()

View file

@ -1149,11 +1149,21 @@ PsGetProcessSecurityPort(PEPROCESS Process)
*/ */
ULONG ULONG
NTAPI NTAPI
PsGetProcessSessionId(PEPROCESS Process) PsGetProcessSessionId(IN PEPROCESS Process)
{ {
return MmGetSessionId(Process); return MmGetSessionId(Process);
} }
/*
* @implemented
*/
ULONG
NTAPI
PsGetProcessSessionIdEx(IN PEPROCESS Process)
{
return MmGetSessionIdEx(Process);
}
/* /*
* @implemented * @implemented
*/ */