Added service_status_text().
authorIain Patterson <me@iain.cx>
Mon, 13 Jan 2014 11:09:54 +0000 (11:09 +0000)
committerIain Patterson <me@iain.cx>
Mon, 13 Jan 2014 11:09:54 +0000 (11:09 +0000)
Function to get a string representation of a service status, eg
SERVICE_RUNNING.

service.cpp
service.h

index 51c3937..e952dbd 100644 (file)
@@ -1292,6 +1292,19 @@ TCHAR *service_control_text(unsigned long control) {
   }\r
 }\r
 \r
+TCHAR *service_status_text(unsigned long status) {\r
+  switch (status) {\r
+    case SERVICE_STOPPED: return _T("SERVICE_STOPPED");\r
+    case SERVICE_START_PENDING: return _T("SERVICE_START_PENDING");\r
+    case SERVICE_STOP_PENDING: return _T("SERVICE_STOP_PENDING");\r
+    case SERVICE_RUNNING: return _T("SERVICE_RUNNING");\r
+    case SERVICE_CONTINUE_PENDING: return _T("SERVICE_CONTINUE_PENDING");\r
+    case SERVICE_PAUSE_PENDING: return _T("SERVICE_PAUSE_PENDING");\r
+    case SERVICE_PAUSED: return _T("SERVICE_PAUSED");\r
+    default: return 0;\r
+  }\r
+}\r
+\r
 void log_service_control(TCHAR *service_name, unsigned long control, bool handled) {\r
   TCHAR *text = service_control_text(control);\r
   unsigned long event;\r
index 45680cf..0d37757 100644 (file)
--- a/service.h
+++ b/service.h
@@ -104,6 +104,7 @@ typedef struct {
 \r
 void WINAPI service_main(unsigned long, TCHAR **);\r
 TCHAR *service_control_text(unsigned long);\r
+TCHAR *service_status_text(unsigned long);\r
 void log_service_control(TCHAR *, unsigned long, bool);\r
 unsigned long WINAPI service_control_handler(unsigned long, unsigned long, void *, void *);\r
 \r