if (service->dependencies) HeapFree(GetProcessHeap(), 0, service->dependencies);\r
if (service->env) HeapFree(GetProcessHeap(), 0, service->env);\r
if (service->env_extra) HeapFree(GetProcessHeap(), 0, service->env_extra);\r
- if (service->handle) CloseHandle(service->handle);\r
+ if (service->handle) CloseServiceHandle(service->handle);\r
if (service->process_handle) CloseHandle(service->process_handle);\r
if (service->wait_handle) UnregisterWait(service->wait_handle);\r
if (service->throttle_section_initialised) DeleteCriticalSection(&service->throttle_section);\r
/* Get system details. */\r
QUERY_SERVICE_CONFIG *qsc = query_service_config(service->name, service->handle);\r
if (! qsc) {\r
- CloseHandle(service->handle);\r
+ CloseServiceHandle(service->handle);\r
CloseServiceHandle(services);\r
return 4;\r
}\r
if (! (service->type & SERVICE_WIN32_OWN_PROCESS)) {\r
if (mode != MODE_GETTING) {\r
HeapFree(GetProcessHeap(), 0, qsc);\r
- CloseHandle(service->handle);\r
+ CloseServiceHandle(service->handle);\r
CloseServiceHandle(services);\r
print_message(stderr, NSSM_MESSAGE_CANNOT_EDIT, service->name, NSSM_WIN32_OWN_PROCESS, 0);\r
return 3;\r
if (get_service_startup(service->name, service->handle, qsc, &service->startup)) {\r
if (mode != MODE_GETTING) {\r
HeapFree(GetProcessHeap(), 0, qsc);\r
- CloseHandle(service->handle);\r
+ CloseServiceHandle(service->handle);\r
CloseServiceHandle(services);\r
return 4;\r
}\r
if (get_service_username(service->name, qsc, &service->username, &service->usernamelen)) {\r
if (mode != MODE_GETTING) {\r
HeapFree(GetProcessHeap(), 0, qsc);\r
- CloseHandle(service->handle);\r
+ CloseServiceHandle(service->handle);\r
CloseServiceHandle(services);\r
return 5;\r
}\r
/* Get extended system details. */\r
if (get_service_description(service->name, service->handle, _countof(service->description), service->description)) {\r
if (mode != MODE_GETTING) {\r
- CloseHandle(service->handle);\r
+ CloseServiceHandle(service->handle);\r
CloseServiceHandle(services);\r
return 6;\r
}\r
\r
if (get_service_dependencies(service->name, service->handle, &service->dependencies, &service->dependencieslen)) {\r
if (mode != MODE_GETTING) {\r
- CloseHandle(service->handle);\r
+ CloseServiceHandle(service->handle);\r
CloseServiceHandle(services);\r
return 7;\r
}\r
\r
/* Trying to manage App* parameters for a non-NSSM service. */\r
if (! setting->native && service->native) {\r
- CloseHandle(service->handle);\r
+ CloseServiceHandle(service->handle);\r
print_message(stderr, NSSM_MESSAGE_NATIVE_PARAMETER, setting->name, NSSM);\r
return 1;\r
}\r
if (setting->native) ret = get_setting(service->name, service->handle, setting, &value, additional);\r
else ret = get_setting(service->name, key, setting, &value, additional);\r
if (ret < 0) {\r
- CloseHandle(service->handle);\r
+ CloseServiceHandle(service->handle);\r
return 5;\r
}\r
\r
}\r
\r
if (! service->native) RegCloseKey(key);\r
- CloseHandle(service->handle);\r
+ CloseServiceHandle(service->handle);\r
return 0;\r
}\r
\r
value.string = (TCHAR *) HeapAlloc(GetProcessHeap(), 0, len * sizeof(TCHAR));\r
if (! value.string) {\r
print_message(stderr, NSSM_MESSAGE_OUT_OF_MEMORY, _T("value"), _T("edit_service()"));\r
- CloseHandle(service->handle);\r
+ CloseServiceHandle(service->handle);\r
return 2;\r
}\r
\r
if (value.string) HeapFree(GetProcessHeap(), 0, value.string);\r
if (ret < 0) {\r
if (! service->native) RegCloseKey(key);\r
- CloseHandle(service->handle);\r
+ CloseServiceHandle(service->handle);\r
return 6;\r
}\r
\r
if (! service->native) RegCloseKey(key);\r
- CloseHandle(service->handle);\r
+ CloseServiceHandle(service->handle);\r
\r
return 0;\r
}\r
\r
if (ret) {\r
int response = await_service_control_response(control, service_handle, &service_status, initial_status);\r
- CloseHandle(service_handle);\r
+ CloseServiceHandle(service_handle);\r
\r
if (response) {\r
print_message(stderr, NSSM_MESSAGE_BAD_CONTROL_RESPONSE, canonical_name, service_status_text(service_status.dwCurrentState), service_control_text(control));\r
return 0;\r
}\r
else {\r
- CloseHandle(service_handle);\r
+ CloseServiceHandle(service_handle);\r
_ftprintf(stderr, _T("%s: %s: %s"), canonical_name, service_control_text(control), error_string(error));\r
return 1;\r
}\r
\r
if (ret) {\r
int response = await_service_control_response(control, service_handle, &service_status, initial_status);\r
- CloseHandle(service_handle);\r
+ CloseServiceHandle(service_handle);\r
\r
if (response) {\r
print_message(stderr, NSSM_MESSAGE_BAD_CONTROL_RESPONSE, canonical_name, service_status_text(service_status.dwCurrentState), service_control_text(control));\r
return 0;\r
}\r
else {\r
- CloseHandle(service_handle);\r
+ CloseServiceHandle(service_handle);\r
_ftprintf(stderr, _T("%s: %s: %s"), canonical_name, service_control_text(control), error_string(error));\r
if (error == ERROR_SERVICE_NOT_ACTIVE) {\r
if (control == SERVICE_CONTROL_SHUTDOWN || control == SERVICE_CONTROL_STOP) return 0;\r