[WINSRV] ConSrvConnect: Always store the control dispatcher routine

This shouldn't be used only for console applications but can potentially be used by any application to receive shutdown notifications.
MSDN provides more information in the documentation for SetConsoleCtrlHandler. Our services.exe also expect to receive shutdown notifications in this way.
This commit is contained in:
Giannis Adamopoulos 2019-01-04 19:38:36 +02:00
parent cb2dcc0a2f
commit b3399c68e9

View file

@ -428,6 +428,9 @@ ConSrvConnect(IN PCSR_PROCESS CsrProcess,
return STATUS_UNSUCCESSFUL;
}
/* Set Control-Dispatcher handler */
ProcessData->CtrlRoutine = ConnectInfo->CtrlRoutine;
/* If we don't need a console, then get out of here */
DPRINT("ConnectInfo->IsConsoleApp = %s\n", ConnectInfo->IsConsoleApp ? "True" : "False");
if (!ConnectInfo->IsConsoleApp) return STATUS_SUCCESS;
@ -525,9 +528,8 @@ ConSrvConnect(IN PCSR_PROCESS CsrProcess,
}
}
/* Set the Property-Dialog and Control-Dispatcher handlers */
/* Set the Property-Dialog handler */
ProcessData->PropRoutine = ConnectInfo->PropRoutine;
ProcessData->CtrlRoutine = ConnectInfo->CtrlRoutine;
return STATUS_SUCCESS;
}