From 22d1f86ac1f2731a4733c4ac1b89a4b54a291572 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Sat, 14 May 2016 23:18:43 -0700 Subject: [PATCH] launcher: AllocConsole if we are running as a service without one (DETACHED_PROCESS) --- src/launcher/launcher.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/launcher/launcher.c b/src/launcher/launcher.c index e80a51d3..e09b5478 100644 --- a/src/launcher/launcher.c +++ b/src/launcher/launcher.c @@ -608,6 +608,13 @@ static NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv) { SECURITY_ATTRIBUTES SecurityAttributes = { 0 }; + /* + * Allocate a console in case we are running as a service without one. + * This will ensure that we can send console control events to service instances. + */ + if (AllocConsole()) + ShowWindow(GetConsoleWindow(), SW_HIDE); + InitializeCriticalSection(&SvcInstanceLock); SecurityAttributes.nLength = sizeof SecurityAttributes;