[WIN32K:NTUSER] Move the GetProcessLuid() function to the miscellaneous module.

This commit is contained in:
Hermès Bélusca-Maïto 2018-06-16 19:44:15 +02:00
parent 9c0564063d
commit d77c493213
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
3 changed files with 42 additions and 36 deletions

View file

@ -88,42 +88,6 @@ IntClientShutdown(IN PWND pWindow,
return lResult;
}
NTSTATUS
GetProcessLuid(IN PETHREAD Thread OPTIONAL,
OUT PLUID Luid)
{
NTSTATUS Status;
PACCESS_TOKEN Token;
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
BOOLEAN CopyOnOpen, EffectiveOnly;
if (Thread == NULL)
Thread = PsGetCurrentThread();
/* Use a thread token */
Token = PsReferenceImpersonationToken(Thread,
&CopyOnOpen,
&EffectiveOnly,
&ImpersonationLevel);
if (Token == NULL)
{
/* We don't have a thread token, use a process token */
Token = PsReferencePrimaryToken(PsGetThreadProcess(Thread));
/* If no token, fail */
if (Token == NULL)
return STATUS_NO_TOKEN;
}
/* Query the LUID */
Status = SeQueryAuthenticationIdToken(Token, Luid);
/* Get rid of the token and return */
ObDereferenceObject(Token);
return Status;
}
BOOLEAN
HasPrivilege(IN PPRIVILEGE_SET Privilege)
{