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

commit 0a80b77e766964e84e38a4559956ffc30d32786b
Author:     Giannis Adamopoulos <[email protected]>
AuthorDate: Fri Jan 4 01:22:44 2019 +0200
Commit:     Giannis Adamopoulos <[email protected]>
CommitDate: Fri Jan 4 13:29:26 2019 +0200

    [WINSRV] usersrv: Simplify sanity checks in UserClientShutdown
    UserClientShutdown will never be called for csrss so we don't need to have 
a check for that. The existing check was broken and wasn't doing anything 
anyway.
    Handle processing winlogon by doing nothing so that consrv won't be 
bothered about it.
---
 win32ss/user/winsrv/usersrv/shutdown.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/win32ss/user/winsrv/usersrv/shutdown.c 
b/win32ss/user/winsrv/usersrv/shutdown.c
index c73a535ffb..539ef2a932 100644
--- a/win32ss/user/winsrv/usersrv/shutdown.c
+++ b/win32ss/user/winsrv/usersrv/shutdown.c
@@ -770,15 +770,17 @@ UserClientShutdown(IN PCSR_PROCESS CsrProcess,
         return CsrShutdownNonCsrProcess;
     }
 
-    /* Do not kill Winlogon or CSRSS */
-    if (CsrProcess->ClientId.UniqueProcess == NtCurrentProcess() ||
-        CsrProcess->ClientId.UniqueProcess == UlongToHandle(LogonProcessId))
+    /* Do not kill Winlogon */
+    if (CsrProcess->ClientId.UniqueProcess == UlongToHandle(LogonProcessId))
     {
         DPRINT("Not killing %s; CsrProcess->ShutdownFlags = %lu\n",
                 CsrProcess->ClientId.UniqueProcess == NtCurrentProcess() ? 
"CSRSS" : "Winlogon",
                 CsrProcess->ShutdownFlags);
 
-        return CsrShutdownNonCsrProcess;
+        /* Returning CsrShutdownCsrProcess means that we handled this process 
by doing nothing */
+        /* This will mark winlogon as processed so consrv won't be notified 
again for it */
+        CsrDereferenceProcess(CsrProcess);
+        return CsrShutdownCsrProcess;
     }
 
     /* Notify the process for shutdown if needed */

Reply via email to