https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b3399c68e9cde2baeb10c…
commit b3399c68e9cde2baeb10c36332fc6da421f0caf8
Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
AuthorDate: Fri Jan 4 19:38:36 2019 +0200
Commit: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
CommitDate: Fri Jan 4 19:38:36 2019 +0200
[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.
---
win32ss/user/winsrv/consrv/init.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/win32ss/user/winsrv/consrv/init.c b/win32ss/user/winsrv/consrv/init.c
index ab89f7f76e..eea8cf890f 100644
--- a/win32ss/user/winsrv/consrv/init.c
+++ b/win32ss/user/winsrv/consrv/init.c
@@ -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;
}