From: Iain Patterson Date: Mon, 13 Jan 2014 11:09:54 +0000 (+0000) Subject: Added service_status_text(). X-Git-Tag: v2.22~61 X-Git-Url: http://git.iain.cx/?p=nssm.git;a=commitdiff_plain;h=8d884cbd586f2c3158708eea541ea62508506907 Added service_status_text(). Function to get a string representation of a service status, eg SERVICE_RUNNING. --- diff --git a/service.cpp b/service.cpp index 51c3937..e952dbd 100644 --- a/service.cpp +++ b/service.cpp @@ -1292,6 +1292,19 @@ TCHAR *service_control_text(unsigned long control) { } } +TCHAR *service_status_text(unsigned long status) { + switch (status) { + case SERVICE_STOPPED: return _T("SERVICE_STOPPED"); + case SERVICE_START_PENDING: return _T("SERVICE_START_PENDING"); + case SERVICE_STOP_PENDING: return _T("SERVICE_STOP_PENDING"); + case SERVICE_RUNNING: return _T("SERVICE_RUNNING"); + case SERVICE_CONTINUE_PENDING: return _T("SERVICE_CONTINUE_PENDING"); + case SERVICE_PAUSE_PENDING: return _T("SERVICE_PAUSE_PENDING"); + case SERVICE_PAUSED: return _T("SERVICE_PAUSED"); + default: return 0; + } +} + void log_service_control(TCHAR *service_name, unsigned long control, bool handled) { TCHAR *text = service_control_text(control); unsigned long event; diff --git a/service.h b/service.h index 45680cf..0d37757 100644 --- a/service.h +++ b/service.h @@ -104,6 +104,7 @@ typedef struct { void WINAPI service_main(unsigned long, TCHAR **); TCHAR *service_control_text(unsigned long); +TCHAR *service_status_text(unsigned long); void log_service_control(TCHAR *, unsigned long, bool); unsigned long WINAPI service_control_handler(unsigned long, unsigned long, void *, void *);