Use nssm_imagepath().
[nssm.git] / registry.cpp
index de3127f..5a4c652 100644 (file)
@@ -17,8 +17,7 @@ int create_messages() {
   }\r
 \r
   /* Get path of this program */\r
-  TCHAR path[PATH_LENGTH];\r
-  GetModuleFileName(0, path, _countof(path));\r
+  const TCHAR *path = nssm_imagepath();\r
 \r
   /* Try to register the module but don't worry so much on failure */\r
   RegSetValueEx(key, _T("EventMessageFile"), 0, REG_SZ, (const unsigned char *) path, (unsigned long) (_tcslen(path) +  1) * sizeof(TCHAR));\r