/* Check exit code */\r
unsigned long exitcode = 0;\r
TCHAR code[16];\r
- GetExitCodeProcess(service->process_handle, &exitcode);\r
- if (exitcode == STILL_ACTIVE || get_process_exit_time(service->process_handle, &service->exit_time)) GetSystemTimeAsFileTime(&service->exit_time);\r
- CloseHandle(service->process_handle);\r
+ if (service->process_handle) {\r
+ GetExitCodeProcess(service->process_handle, &exitcode);\r
+ if (exitcode == STILL_ACTIVE || get_process_exit_time(service->process_handle, &service->exit_time)) GetSystemTimeAsFileTime(&service->exit_time);\r
+ CloseHandle(service->process_handle);\r
+ }\r
+ else GetSystemTimeAsFileTime(&service->exit_time);\r
\r
service->process_handle = 0;\r
- service->pid = 0;\r
\r
/*\r
Log that the service ended BEFORE logging about killing the process\r
\r
/* Clean up. */\r
if (exitcode == STILL_ACTIVE) exitcode = 0;\r
- kill_process_tree(service, service->pid, exitcode, service->pid);\r
+ if (service->pid) kill_process_tree(service, service->pid, exitcode, service->pid);\r
+ service->pid = 0;\r
\r
/*\r
The why argument is true if our wait timed out or false otherwise.\r