Alexandre Julliard : services: Properly initialize service status at creation time.

Alexandre Julliard julliard at winehq.org
Tue Nov 25 07:21:36 CST 2008


Module: wine
Branch: master
Commit: 42fb9fe779a229ff715289d1a1e81e998e7fc6a6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=42fb9fe779a229ff715289d1a1e81e998e7fc6a6

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Nov 25 11:56:33 2008 +0100

services: Properly initialize service status at creation time.

---

 programs/services/rpc.c      |    2 +-
 programs/services/services.c |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/programs/services/rpc.c b/programs/services/rpc.c
index ed353d4..6cc2e4a 100644
--- a/programs/services/rpc.c
+++ b/programs/services/rpc.c
@@ -364,7 +364,7 @@ DWORD svcctl_CreateServiceW(
     err = service_create(lpServiceName, &entry);
     if (err != ERROR_SUCCESS)
         return err;
-    entry->config.dwServiceType = dwServiceType;
+    entry->config.dwServiceType = entry->status.dwServiceType = dwServiceType;
     entry->config.dwStartType = dwStartType;
     entry->config.dwErrorControl = dwErrorControl;
     entry->config.lpBinaryPathName = strdupW(lpBinaryPathName);
diff --git a/programs/services/services.c b/programs/services/services.c
index cd71a1f..003771f 100644
--- a/programs/services/services.c
+++ b/programs/services/services.c
@@ -71,6 +71,9 @@ DWORD service_create(LPCWSTR name, struct service_entry **entry)
         return ERROR_NOT_ENOUGH_SERVER_MEMORY;
     }
     (*entry)->control_pipe = INVALID_HANDLE_VALUE;
+    (*entry)->status.dwCurrentState = SERVICE_STOPPED;
+    (*entry)->status.dwWin32ExitCode = ERROR_SERVICE_NEVER_STARTED;
+    /* all other fields are zero */
     return ERROR_SUCCESS;
 }
 
@@ -442,10 +445,7 @@ static DWORD scmdatabase_load_services(struct scmdatabase *db)
         }
 
         entry->status.dwServiceType = entry->config.dwServiceType;
-        entry->status.dwCurrentState = SERVICE_STOPPED;
-        entry->status.dwWin32ExitCode = ERROR_SERVICE_NEVER_STARTED;
         entry->db = db;
-        /* all other fields are zero */
 
         list_add_tail(&db->services, &entry->entry);
     }




More information about the wine-cvs mailing list