ULONG PsGetProcessSessionId( __in PEPROCESS Process ) { return MmGetSessionId (Process); }
ULONG PsGetThreadSessionId( __in PETHREAD Thread ) { return MmGetSessionId (THREAD_TO_PROCESS(Thread)); }
NTSTATUS NTAPI PspInitializeProcessSecurity(IN PEPROCESS Process, IN PEPROCESS Parent OPTIONAL) { NTSTATUS Status = STATUS_SUCCESS; PTOKEN NewToken, ParentToken; PAGED_CODE(); PSTRACE(PS_SECURITY_DEBUG, "Process: %p\n", Process); /* If we have a parent, then duplicate the Token */ if (Parent) { /* Get the Parent Token */ ParentToken = PsReferencePrimaryToken(Parent); /* Duplicate it */ Status = SeSubProcessToken(ParentToken, &NewToken, TRUE, MmGetSessionId(Process)); /* Dereference the Parent */ ObFastDereferenceObject(&Parent->Token, ParentToken); /* Set the new Token */ if (NT_SUCCESS(Status)) { /* Initailize the fast reference */ ObInitializeFastReference(&Process->Token, NewToken); } } else { /* No parent, assign the Boot Token */ ObInitializeFastReference(&Process->Token, NULL); SeAssignPrimaryToken(Process, PspBootAccessToken); } /* Return to caller */ return Status; }
ULONG PsGetCurrentProcessSessionId( VOID ) { return MmGetSessionId (_PsGetCurrentProcess()); }