From 643115bc146bce4dfcdbef77c47ba589015ad126 Mon Sep 17 00:00:00 2001 From: Mikolaj Zalewski Date: Wed, 26 Sep 2007 11:45:51 -0700 Subject: [PATCH] advapi32: the lpServiceStartName should defualt to LocalSystem for Win32 services --- dlls/advapi32/service.c | 4 ++++ dlls/advapi32/tests/service.c | 2 +- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c index 82bd7ed..666be6e 100644 --- a/dlls/advapi32/service.c +++ b/dlls/advapi32/service.c @@ -39,6 +39,7 @@ #include "wine/list.h" WINE_DEFAULT_DEBUG_CHANNEL(advapi); +static const WCHAR szLocalSystem[] = {'L','o','c','a','l','S','y','s','t','e','m',0}; static const WCHAR szServiceManagerKey[] = { 'S','y','s','t','e','m','\\', 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', 'S','e','r','v','i','c','e','s',0 }; @@ -1341,6 +1342,9 @@ CreateServiceW( SC_HANDLE hSCManager, LP SetLastError(ERROR_INVALID_PARAMETER); return NULL; } + + if (!lpServiceStartName && (dwServiceType & SERVICE_WIN32)) + lpServiceStartName = szLocalSystem; /* StartType can only be a single value (if several values are mixed the result is probably not what was intended) */ if (dwStartType > SERVICE_DISABLED) diff --git a/dlls/advapi32/tests/service.c b/dlls/advapi32/tests/service.c index bfb535d..79b4c3c 100644 --- a/dlls/advapi32/tests/service.c +++ b/dlls/advapi32/tests/service.c @@ -815,8 +815,8 @@ static void test_sequence(void) todo_wine { ok(!memcmp(config->lpDependencies, dependencies, sizeof(dependencies)), "Wrong string\n"); - ok(!strcmp(config->lpServiceStartName, localsystem), "Expected 'LocalSystem', got '%s'\n", config->lpServiceStartName); } + ok(!strcmp(config->lpServiceStartName, localsystem), "Expected 'LocalSystem', got '%s'\n", config->lpServiceStartName); ok(!strcmp(config->lpDisplayName, displayname), "Expected '%s', got '%s'\n", displayname, config->lpDisplayName); SetLastError(0xdeadbeef); -- 1.4.1