diff --git a/src/launcher/launcher.c b/src/launcher/launcher.c index 8cbf9ca7..3849e116 100644 --- a/src/launcher/launcher.c +++ b/src/launcher/launcher.c @@ -16,6 +16,7 @@ */ #include +#include #define PROGNAME "WinFsp-Launcher" #define REGKEY "SYSTEM\\CurrentControlSet\\Services\\" PROGNAME "\\Services" @@ -356,8 +357,16 @@ static VOID SvcPipeTransact(PWSTR PipeBuf, PULONG PSize); static NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv) { + SECURITY_ATTRIBUTES SecurityAttributes = { 0 }; + InitializeCriticalSection(&SvcInstanceLock); + SecurityAttributes.nLength = sizeof SecurityAttributes; + SecurityAttributes.bInheritHandle = FALSE; + if (!ConvertStringSecurityDescriptorToSecurityDescriptorW(L"" PIPE_SDDL, SDDL_REVISION_1, + &SecurityAttributes.lpSecurityDescriptor, 0)) + goto fail; + SvcEvent = CreateEventW(0, TRUE, FALSE, 0); if (0 == SvcEvent) goto fail; @@ -378,6 +387,8 @@ static NTSTATUS SvcStart(FSP_SERVICE *Service, ULONG argc, PWSTR *argv) if (0 == SvcThread) goto fail; + LocalFree(SecurityAttributes.lpSecurityDescriptor); + return STATUS_SUCCESS; fail: @@ -395,6 +406,8 @@ fail: if (0 != SvcEvent) CloseHandle(SvcEvent); + LocalFree(SecurityAttributes.lpSecurityDescriptor); + DeleteCriticalSection(&SvcInstanceLock); return FspNtStatusFromWin32(LastError); diff --git a/src/launcher/launcher.h b/src/launcher/launcher.h index d967a275..27d09034 100644 --- a/src/launcher/launcher.h +++ b/src/launcher/launcher.h @@ -22,6 +22,7 @@ #include #define PIPE_NAME "\\\\.\\pipe\\WinFsp.{14E7137D-22B4-437A-B0C1-D21D1BDF3767}" +#define PIPE_SDDL "O:SYG:SYD:P(A;;GA;;;WD)" #define PIPE_BUFFER_SIZE 2048 #define PIPE_DEFAULT_TIMEOUT 3000