Alexandre Julliard : msiexec: Ignore failure to create the service if it already exists.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Sep 13 06:07:11 CDT 2006


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Sep 13 12:56:37 2006 +0200

msiexec: Ignore failure to create the service if it already exists.

---

 programs/msiexec/msiexec.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/programs/msiexec/msiexec.c b/programs/msiexec/msiexec.c
index d8025bf..364d54a 100644
--- a/programs/msiexec/msiexec.c
+++ b/programs/msiexec/msiexec.c
@@ -333,6 +333,7 @@ static DWORD DoRegServer(void)
 {
     SC_HANDLE scm, service;
     CHAR path[MAX_PATH+12];
+    DWORD ret = 0;
 
     scm = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_CREATE_SERVICE);
     if (!scm)
@@ -348,16 +349,15 @@ static DWORD DoRegServer(void)
                              SERVICE_WIN32_SHARE_PROCESS, SERVICE_DEMAND_START,
                              SERVICE_ERROR_NORMAL, path, NULL, NULL,
                              NULL, NULL, NULL);
-    if (!service)
+
+    if (service) CloseServiceHandle(service);
+    else if (GetLastError() != ERROR_SERVICE_EXISTS)
     {
         fprintf(stderr, "Failed to create MSI service\n");
-        CloseServiceHandle(scm);
-        return 1;
+        ret = 1;
     }
-
-     CloseServiceHandle(scm);
-     CloseServiceHandle(service);
-     return 0;
+    CloseServiceHandle(scm);
+    return ret;
 }
 
 static BOOL process_args_from_reg( LPWSTR ident, int *pargc, WCHAR ***pargv )




More information about the wine-cvs mailing list