Use GetWindowsDirectory() instead of %SYSTEMROOT%.
authorIain Patterson <me@iain.cx>
Wed, 16 Feb 2011 23:48:31 +0000 (23:48 +0000)
committerIain Patterson <me@iain.cx>
Wed, 16 Feb 2011 23:48:31 +0000 (23:48 +0000)
Though unlikely, it's possible that %SYSTEMROOT% might be undefined.

registry.cpp

index 0471ca7..f82e1bf 100644 (file)
@@ -180,7 +180,7 @@ int get_parameters(char *service_name, char *exe, int exelen, char *flags, int f
     }\r
     else {\r
       /* Help! */\r
-      unsigned long ret = ExpandEnvironmentStrings("%SYSTEMROOT%", dir, dirlen);\r
+      unsigned long ret = GetWindowsDirectory(dir, dirlen);\r
       if (! ret || ret > dirlen) {\r
         log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_NO_DIR_AND_NO_FALLBACK, NSSM_REG_DIR, service_name, 0);\r
         RegCloseKey(key);\r