Hans Leidekker : msi: Skip disabled components in the InstallService action .

Alexandre Julliard julliard at winehq.org
Mon May 2 14:16:16 CDT 2011


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Mon May  2 16:03:14 2011 +0200

msi: Skip disabled components in the InstallService action.

---

 dlls/msi/action.c |   33 +++++++++++++++++++--------------
 1 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 7bed12f..da59d3a 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -5945,23 +5945,33 @@ static UINT ACTION_UnpublishComponents( MSIPACKAGE *package )
 
 static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param)
 {
+    static const WCHAR query[] =
+        {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
+         '`','C','o','m','p','o','n','e','n','t','`',' ','W','H','E','R','E',' ',
+         '`','C','o','m','p','o','n','e','n','t','`',' ','=','\'','%','s','\'',0};
     MSIPACKAGE *package = param;
+    MSICOMPONENT *component;
     MSIRECORD *row;
     MSIFILE *file;
-    SC_HANDLE hscm, service = NULL;
+    SC_HANDLE hscm = NULL, service = NULL;
     LPCWSTR comp, key;
     LPWSTR name = NULL, disp = NULL, load_order = NULL, serv_name = NULL;
     LPWSTR depends = NULL, pass = NULL, args = NULL, image_path = NULL;
     DWORD serv_type, start_type, err_control;
     SERVICE_DESCRIPTIONW sd = {NULL};
 
-    static const WCHAR query[] =
-        {'S','E','L','E','C','T',' ','*',' ','F','R', 'O','M',' ',
-         '`','C','o','m','p','o','n','e','n','t','`',' ',
-         'W','H','E','R','E',' ',
-         '`','C','o','m','p','o','n','e','n','t','`',' ',
-         '=','\'','%','s','\'',0};
-
+    comp = MSI_RecordGetString( rec, 12 );
+    component = get_loaded_component( package, comp );
+    if (!component)
+    {
+        WARN("service component not found\n");
+        goto done;
+    }
+    if (!component->Enabled)
+    {
+        TRACE("service component disabled\n");
+        goto done;
+    }
     hscm = OpenSCManagerW(NULL, SERVICES_ACTIVE_DATABASEW, GENERIC_WRITE);
     if (!hscm)
     {
@@ -5969,10 +5979,6 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param)
         goto done;
     }
 
-    comp = MSI_RecordGetString( rec, 12 );
-    if (!get_loaded_component( package, comp ))
-        goto done;
-
     start_type = MSI_RecordGetInteger(rec, 5);
     if (start_type == SERVICE_BOOT_START || start_type == SERVICE_SYSTEM_START)
         goto done;
@@ -5992,11 +5998,10 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param)
     row = MSI_QueryGetRecord(package->db, query, comp);
     if (!row)
     {
-        ERR("Control query failed!\n");
+        ERR("Query failed\n");
         goto done;
     }
     key = MSI_RecordGetString(row, 6);
-
     file = get_loaded_file(package, key);
     msiobj_release(&row->hdr);
     if (!file)




More information about the wine-cvs mailing list