services: Do not start services for which start type is not set.
authorAlexander Morozov <amorozov@etersoft.ru>
Mon, 3 Aug 2009 16:48:07 +0000 (20:48 +0400)
committerVitaly Lipatov <lav@etersoft.ru>
Tue, 4 Aug 2009 08:49:04 +0000 (12:49 +0400)
programs/services/services.c
programs/services/utils.c

index 013c000f5cccb6acb80852faa3f28e4ee9a73f7f..45520d059d9418a89bc28d8457b483af555ecc3a 100644 (file)
@@ -75,6 +75,7 @@ DWORD service_create(LPCWSTR name, struct service_entry **entry)
     (*entry)->control_pipe = INVALID_HANDLE_VALUE;
     (*entry)->status.dwCurrentState = SERVICE_STOPPED;
     (*entry)->status.dwWin32ExitCode = ERROR_SERVICE_NEVER_STARTED;
+    (*entry)->config.dwStartType = (DWORD)-1L;
     /* all other fields are zero */
     return ERROR_SUCCESS;
 }
@@ -461,6 +462,13 @@ static DWORD scmdatabase_load_services(struct scmdatabase *db)
             continue;
         }
 
+        if (entry->config.dwStartType == (DWORD)-1L)
+        {
+            WINE_TRACE("Start type not set for service %s - skipping\n", wine_dbgstr_w(szName));
+            free_service_entry(entry);
+            continue;
+        }
+
         if (!validate_service_config(entry))
         {
             WINE_ERR("Invalid configuration of service %s - skipping\n", wine_dbgstr_w(szName));
index 191cc5f07e576ba30303a2bcd399d577dba70f08..d34523a42a83575ff8002764db344ccac2d4b729 100644 (file)
@@ -142,7 +142,7 @@ DWORD load_reg_dword(HKEY hKey, LPCWSTR szValue, DWORD *output)
     DWORD size, type;
     DWORD err;
 
-    *output = 0;
+    if (*output != (DWORD)-1L) *output = 0;  /* save *output for dwStartType */
     size = sizeof(DWORD);
     if ((err = RegQueryValueExW(hKey, szValue, 0, &type, (LPBYTE)output, &size)) != 0)
     {