}\r
\r
/* Get path of this program */\r
- TCHAR path[MAX_PATH];\r
- GetModuleFileName(0, path, MAX_PATH);\r
-\r
- /* Construct command */\r
- TCHAR command[CMD_LENGTH];\r
- size_t pathlen = _tcslen(path);\r
- if (pathlen + 1 >= VALUE_LENGTH) {\r
- print_message(stderr, NSSM_MESSAGE_PATH_TOO_LONG, NSSM);\r
- return 3;\r
- }\r
- if (_sntprintf_s(command, sizeof(command), _TRUNCATE, _T("\"%s\""), path) < 0) {\r
- print_message(stderr, NSSM_MESSAGE_OUT_OF_MEMORY_FOR_IMAGEPATH);\r
- return 4;\r
- }\r
+ TCHAR command[MAX_PATH];\r
+ GetModuleFileName(0, command, _countof(command));\r
\r
/* Create the service */\r
service->handle = CreateService(services, service->name, service->name, SC_MANAGER_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, command, 0, 0, 0, 0, 0);\r