Added UTF-8 functions.
[nssm.git] / service.cpp
index 88c1820..2d20ff3 100644 (file)
@@ -2078,7 +2078,7 @@ void CALLBACK end_service(void *arg, unsigned char why) {
       stop_service(service, exitcode, false, default_action);\r
       wait_for_hooks(service, false);\r
       free_imports();\r
-      exit(exitcode);\r
+      nssm_exit(exitcode);\r
   }\r
 }\r
 \r
@@ -2212,7 +2212,9 @@ awaited:
   return ret;\r
 }\r
 \r
-int list_nssm_services() {\r
+int list_nssm_services(int argc, TCHAR **argv) {\r
+  bool including_native = (argc > 0 && str_equiv(argv[0], _T("all")));\r
+\r
   /* Open service manager. */\r
   SC_HANDLE services = open_service_manager(SC_MANAGER_CONNECT | SC_MANAGER_ENUMERATE_SERVICE);\r
   if (! services) {\r
@@ -2259,7 +2261,7 @@ int list_nssm_services() {
 \r
       get_parameters(service, 0);\r
       /* We manage the service if we have an Application. */\r
-      if (service->exe[0]) _tprintf(_T("%s\n"), service->name);\r
+      if (including_native || service->exe[0]) _tprintf(_T("%s\n"), service->name);\r
 \r
       cleanup_nssm_service(service);\r
     }\r