launcher: AllocConsole if we are running as a service without one (DETACHED_PROCESS)

This commit is contained in:
Bill Zissimopoulos 2016-05-14 23:18:43 -07:00
parent 1a7d3b8f9e
commit 22d1f86ac1

View File

@ -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;