Update kmdutil.c

This commit is contained in:
DavidXanatos 2023-05-22 22:11:50 +02:00
parent bc02e63931
commit 0662382730
1 changed files with 16 additions and 1 deletions

View File

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