\r
/* About to install the service */\r
int pre_install_service(int argc, TCHAR **argv) {\r
+ nssm_service_t *service = alloc_nssm_service();\r
+ set_nssm_service_defaults(service);\r
+ if (argc) _sntprintf_s(service->name, _countof(service->name), _TRUNCATE, _T("%s"), argv[0]);\r
+\r
/* Show the dialogue box if we didn't give the service name and path */\r
- if (argc < 2) return nssm_gui(IDD_INSTALL, argv[0]);\r
+ if (argc < 2) return nssm_gui(IDD_INSTALL, service);\r
\r
- nssm_service_t *service = alloc_nssm_service();\r
if (! service) {\r
print_message(stderr, NSSM_EVENT_OUT_OF_MEMORY, _T("service"), _T("pre_install_service()"));\r
return 1;\r
}\r
-\r
- set_nssm_service_defaults(service);\r
- _sntprintf_s(service->name, _countof(service->name), _TRUNCATE, _T("%s"), argv[0]);\r
_sntprintf_s(service->exe, _countof(service->exe), _TRUNCATE, _T("%s"), argv[1]);\r
\r
/* Arguments are optional */\r
\r
/* About to remove the service */\r
int pre_remove_service(int argc, TCHAR **argv) {\r
+ nssm_service_t *service = alloc_nssm_service();\r
+ set_nssm_service_defaults(service);\r
+ if (argc) _sntprintf_s(service->name, _countof(service->name), _TRUNCATE, _T("%s"), argv[0]);\r
+\r
/* Show dialogue box if we didn't pass service name and "confirm" */\r
- if (argc < 2) return nssm_gui(IDD_REMOVE, argv[0]);\r
+ if (argc < 2) return nssm_gui(IDD_REMOVE, service);\r
if (str_equiv(argv[1], _T("confirm"))) {\r
- nssm_service_t *service = alloc_nssm_service();\r
- _sntprintf_s(service->name, _countof(service->name), _TRUNCATE, _T("%s"), argv[0]);\r
int ret = remove_service(service);\r
cleanup_nssm_service(service);\r
return ret;\r