From 225c5c4a20aa16b1e068eda6e426def38871687a Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Sun, 25 Nov 2018 20:13:56 +0200 Subject: [PATCH] [WINSRV] Wait for the process to exit after calling NtTerminateProcess NtTerminateProcess just queues an apc in every thread of the target process which in turn kills each thread. We need to wait so that all processes have enough time to exit before shutting down. --- win32ss/user/winsrv/usersrv/shutdown.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/win32ss/user/winsrv/usersrv/shutdown.c b/win32ss/user/winsrv/usersrv/shutdown.c index 5c2f464f846..7238b21ab80 100644 --- a/win32ss/user/winsrv/usersrv/shutdown.c +++ b/win32ss/user/winsrv/usersrv/shutdown.c @@ -796,6 +796,8 @@ UserClientShutdown(IN PCSR_PROCESS CsrProcess, #endif NtTerminateProcess(CsrProcess->ProcessHandle, 0); + WaitForSingleObject(CsrProcess->ProcessHandle, ShutdownSettings.ProcessTerminateTimeout); + /* We are done */ CsrDereferenceProcess(CsrProcess); return CsrShutdownCsrProcess; -- 2.17.1