/>\r
<Tool\r
Name="VCLinkerTool"\r
- OutputFile="$(OutDir)\$(ProjectName)-$(PlatformName).exe"\r
+ AdditionalDependencies="shlwapi.lib"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
GenerateDebugInformation="true"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- OutputFile="$(OutDir)\$(ProjectName)-$(PlatformName).exe"\r
+ AdditionalDependencies="shlwapi.lib"\r
LinkIncremental="2"\r
SuppressStartupBanner="true"\r
GenerateDebugInformation="true"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- OutputFile="$(OutDir)\$(ProjectName)-$(PlatformName).exe"\r
+ AdditionalDependencies="shlwapi.lib"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
ProgramDatabaseFile=".\Release/nssm.pdb"\r
/>\r
<Tool\r
Name="VCLinkerTool"\r
- OutputFile="$(OutDir)\$(ProjectName)-$(PlatformName).exe"\r
+ AdditionalDependencies="shlwapi.lib"\r
LinkIncremental="1"\r
SuppressStartupBanner="true"\r
ProgramDatabaseFile=".\Release/nssm.pdb"\r
return 0;\r
}\r
\r
-int expand_parameter(HKEY key, char *value, char *data, unsigned long datalen) {\r
+int expand_parameter(HKEY key, char *value, char *data, unsigned long datalen, bool sanitise) {\r
unsigned char *buffer = (unsigned char *) HeapAlloc(GetProcessHeap(), 0, datalen);\r
if (! buffer) {\r
log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OUT_OF_MEMORY, value, "expand_parameter()", 0);\r
return 2;\r
}\r
\r
+ /* Paths aren't allowed to contain quotes. */\r
+ if (sanitise) PathUnquoteSpaces((LPSTR) buffer);\r
+\r
ZeroMemory(data, datalen);\r
\r
/* Technically we shouldn't expand environment strings from REG_SZ values */\r
}\r
\r
/* Try to get executable file - MUST succeed */\r
- if (expand_parameter(key, NSSM_REG_EXE, exe, exelen)) {\r
+ if (expand_parameter(key, NSSM_REG_EXE, exe, exelen, false)) {\r
RegCloseKey(key);\r
return 3;\r
}\r
\r
/* Try to get flags - may fail and we don't care */\r
- if (expand_parameter(key, NSSM_REG_FLAGS, flags, flagslen)) {\r
+ if (expand_parameter(key, NSSM_REG_FLAGS, flags, flagslen, false)) {\r
log_event(EVENTLOG_WARNING_TYPE, NSSM_EVENT_NO_FLAGS, NSSM_REG_FLAGS, service_name, exe, 0);\r
ZeroMemory(flags, flagslen);\r
}\r
\r
/* Try to get startup directory - may fail and we fall back to a default */\r
- if (expand_parameter(key, NSSM_REG_DIR, dir, dirlen) || ! dir[0]) {\r
+ if (expand_parameter(key, NSSM_REG_DIR, dir, dirlen, true) || ! dir[0]) {\r
/* Our buffers are defined to be long enough for this to be safe */\r
size_t i;\r
for (i = strlen(exe); i && exe[i] != '\\' && exe[i] != '/'; i--);\r
int create_messages();\r
int create_parameters(char *, char *, char *, char *);\r
int create_exit_action(char *, const char *);\r
-int expand_parameter(HKEY, char *, char *, unsigned long);\r
+int expand_parameter(HKEY, char *, char *, unsigned long, bool);\r
int get_parameters(char *, char *, int, char *, int, char *, int);\r
int get_exit_action(char *, unsigned long *, unsigned char *, bool *);\r
\r