Allow listing all services.
[nssm.git] / service.cpp
index 88c1820..20ebcd9 100644 (file)
@@ -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