From 0662382730cb7a7c35ede76a5fd70f679f75d74d Mon Sep 17 00:00:00 2001 From: DavidXanatos <3890945+DavidXanatos@users.noreply.github.com> Date: Mon, 22 May 2023 22:11:50 +0200 Subject: [PATCH] Update kmdutil.c --- Sandboxie/install/kmdutil/kmdutil.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Sandboxie/install/kmdutil/kmdutil.c b/Sandboxie/install/kmdutil/kmdutil.c index f40f924b..55fd16cf 100644 --- a/Sandboxie/install/kmdutil/kmdutil.c +++ b/Sandboxie/install/kmdutil/kmdutil.c @@ -391,12 +391,25 @@ BOOL Kmd_Install_Service( DWORD ServiceType; DWORD StartType; + WCHAR* Path = NULL; if (Options & OPT_KERNEL_TYPE) ServiceType = SERVICE_KERNEL_DRIVER; - else + else { ServiceType = SERVICE_WIN32_OWN_PROCESS; + // quote path + if (*Service_Path != L'\"') { + ULONG len = wcslen(Service_Path); + Path = malloc((len + 3) * sizeof(WCHAR)); + Path[0] = L'\"'; + wcscpy(&Path[1], Service_Path); + Path[len + 1] = L'\"'; + Path[len + 2] = 0; + Service_Path = Path; + } + } + if (Options & OPT_SYSTEM_START) StartType = SERVICE_SYSTEM_START; else if (Options & OPT_AUTO_START) @@ -423,6 +436,8 @@ BOOL Kmd_Install_Service( NULL, // LocalSystem account NULL); + if (Path) free(Path); + if (! service) { if (GetLastError() != ERROR_SERVICE_EXISTS) { Display_Error(L"CreateService", 0);