[SERVICES] Send services shutdown notifications only if they accept them.

This commit is contained in:
Hermès Bélusca-Maïto 2018-02-25 00:31:17 +01:00
parent 6c097b4740
commit 1aa359ec7f
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -2164,10 +2164,11 @@ ScmAutoShutdownServices(VOID)
{
CurrentService = CONTAINING_RECORD(ServiceEntry, SERVICE, ServiceListEntry);
if (CurrentService->Status.dwCurrentState == SERVICE_RUNNING ||
CurrentService->Status.dwCurrentState == SERVICE_START_PENDING)
if ((CurrentService->Status.dwControlsAccepted & SERVICE_ACCEPT_SHUTDOWN) &&
(CurrentService->Status.dwCurrentState == SERVICE_RUNNING ||
CurrentService->Status.dwCurrentState == SERVICE_START_PENDING))
{
/* shutdown service */
/* Send the shutdown notification */
DPRINT("Shutdown service: %S\n", CurrentService->lpServiceName);
ScmControlService(CurrentService->lpImage->hControlPipe,
CurrentService->lpServiceName,