X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=service.cpp;h=d864fa2d4f22a9a7b7a31c47f65fc020b333f6a3;hb=d47dca0afe81c1c8e75c518da5a51829e61ad1cd;hp=617cad12dea70ee44df9c6096deee37764e30166;hpb=f124b07b52a569dd9e332d0940af592d0e8e201d;p=nssm.git diff --git a/service.cpp b/service.cpp index 617cad1..d864fa2 100644 --- a/service.cpp +++ b/service.cpp @@ -240,7 +240,7 @@ int affinity_string_to_mask(TCHAR *string, __int64 *mask) { return 0; } -inline unsigned long priority_mask() { +unsigned long priority_mask() { return REALTIME_PRIORITY_CLASS | HIGH_PRIORITY_CLASS | ABOVE_NORMAL_PRIORITY_CLASS | NORMAL_PRIORITY_CLASS | BELOW_NORMAL_PRIORITY_CLASS | IDLE_PRIORITY_CLASS; } @@ -774,7 +774,7 @@ void cleanup_nssm_service(nssm_service_t *service) { if (service->throttle_section_initialised) DeleteCriticalSection(&service->throttle_section); if (service->throttle_timer) CloseHandle(service->throttle_timer); if (service->hook_section_initialised) DeleteCriticalSection(&service->hook_section); - if (service->initial_env) FreeEnvironmentStrings(service->initial_env); + if (service->initial_env) HeapFree(GetProcessHeap(), 0, service->initial_env); HeapFree(GetProcessHeap(), 0, service); } @@ -1126,7 +1126,7 @@ int install_service(nssm_service_t *service) { } /* Get path of this program */ - GetModuleFileName(0, service->image, _countof(service->image)); + _sntprintf_s(service->image, _countof(service->image), _TRUNCATE, _T("%s"), nssm_imagepath()); /* Create the service - settings will be changed in edit_service() */ service->handle = CreateService(services, service->name, service->name, SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, service->image, 0, 0, 0, 0, 0); @@ -1479,7 +1479,7 @@ void WINAPI service_main(unsigned long argc, TCHAR **argv) { service->hook_section_initialised = true; /* Remember our initial environment. */ - service->initial_env = GetEnvironmentStrings(); + service->initial_env = copy_environment(); /* Remember our creation time. */ if (get_process_creation_time(GetCurrentProcess(), &service->nssm_creation_time)) ZeroMemory(&service->nssm_creation_time, sizeof(service->nssm_creation_time));