https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d77c4932130c2b434dcc303611cb374ad39f5f2b

commit d77c4932130c2b434dcc303611cb374ad39f5f2b
Author:     Hermès Bélusca-Maïto <[email protected]>
AuthorDate: Sat Jun 16 19:44:15 2018 +0200
Commit:     Hermès Bélusca-Maïto <[email protected]>
CommitDate: Sun Aug 19 22:18:29 2018 +0200

    [WIN32K:NTUSER] Move the GetProcessLuid() function to the miscellaneous 
module.
---
 win32ss/user/ntuser/misc.c      | 37 +++++++++++++++++++++++++++++++++++++
 win32ss/user/ntuser/shutdown.c  | 36 ------------------------------------
 win32ss/user/ntuser/userfuncs.h |  5 +++++
 3 files changed, 42 insertions(+), 36 deletions(-)

diff --git a/win32ss/user/ntuser/misc.c b/win32ss/user/ntuser/misc.c
index 856806ef11..ceaa7ccc13 100644
--- a/win32ss/user/ntuser/misc.c
+++ b/win32ss/user/ntuser/misc.c
@@ -762,4 +762,41 @@ GetW32ThreadInfo(VOID)
     return (PTHREADINFO)PsGetCurrentThreadWin32Thread();
 }
 
+
+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;
+}
+
 /* EOF */
diff --git a/win32ss/user/ntuser/shutdown.c b/win32ss/user/ntuser/shutdown.c
index 8286235340..a750a08fb8 100644
--- a/win32ss/user/ntuser/shutdown.c
+++ b/win32ss/user/ntuser/shutdown.c
@@ -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)
 {
diff --git a/win32ss/user/ntuser/userfuncs.h b/win32ss/user/ntuser/userfuncs.h
index 33f3cd285b..016180a598 100644
--- a/win32ss/user/ntuser/userfuncs.h
+++ b/win32ss/user/ntuser/userfuncs.h
@@ -105,6 +105,11 @@ PTHREADINFO FASTCALL IntTID2PTI(HANDLE);
 HBRUSH FASTCALL GetControlBrush(PWND,HDC,UINT);
 HBRUSH FASTCALL GetControlColor(PWND,PWND,HDC,UINT);
 
+NTSTATUS
+GetProcessLuid(
+    IN PETHREAD Thread OPTIONAL,
+    OUT PLUID Luid);
+
 /*************** MESSAGE.C ***************/
 
 BOOL FASTCALL UserPostMessage(HWND Wnd,UINT Msg, WPARAM wParam, LPARAM lParam);

Reply via email to