[Wine-patches] [eterhack 1/2] services: Do not start services for which start type is not set.

Alexander Morozov amorozov на etersoft.ru
Пн Авг 3 21:02:39 MSD 2009


----------- следующая часть -----------
From 82b4c3f7262fc61e3b3002367843c733dbaab6b7 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Mon, 3 Aug 2009 20:48:07 +0400
Subject: [eterhack 1/2] services: Do not start services for which start type is not set.

---
 programs/services/services.c |    8 ++++++++
 programs/services/utils.c    |    2 +-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/programs/services/services.c b/programs/services/services.c
index 439d6cd..ec94003 100644
--- a/programs/services/services.c
+++ b/programs/services/services.c
@@ -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;
 }
@@ -460,6 +461,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));
diff --git a/programs/services/utils.c b/programs/services/utils.c
index 191cc5f..d34523a 100644
--- a/programs/services/utils.c
+++ b/programs/services/utils.c
@@ -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)
     {
-- 
1.6.3.3



Подробная информация о списке рассылки Wine-patches