[2/4] msi: Get rid of ACTION_VerifyComponentForAction.

Hans Leidekker hans at codeweavers.com
Tue Feb 16 04:44:47 CST 2010


---
 dlls/msi/action.c  |   61 +++++++++++++++++++++------------------------------
 dlls/msi/files.c   |   16 +++++--------
 dlls/msi/font.c    |   10 +++-----
 dlls/msi/helpers.c |   11 ---------
 dlls/msi/msipriv.h |    1 -
 5 files changed, 35 insertions(+), 64 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 3d6b5c1..f9823fe 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -951,7 +951,7 @@ UINT msi_create_component_directories( MSIPACKAGE *package )
     /* create all the folders required by the components are going to install */
     LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
     {
-        if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL))
+        if (comp->ActionRequest != INSTALLSTATE_LOCAL)
             continue;
         msi_create_directory( package, comp->Directory );
     }
@@ -2231,16 +2231,12 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param)
     if (!comp)
         return ERROR_SUCCESS;
 
-    if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL))
+    if (comp->ActionRequest != INSTALLSTATE_LOCAL)
     {
-        TRACE("Skipping write due to disabled component %s\n",
-                        debugstr_w(component));
-
+        TRACE("Component not scheduled for installation: %s\n", debugstr_w(component));
         comp->Action = comp->Installed;
-
         return ERROR_SUCCESS;
     }
-
     comp->Action = INSTALLSTATE_LOCAL;
 
     name = MSI_RecordGetString(row, 4);
@@ -2704,8 +2700,8 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
                             debugstr_w(comp->FullKeypath),
                             comp->RefCount);
 
-        if (ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL) ||
-            ACTION_VerifyComponentForAction( comp, INSTALLSTATE_SOURCE))
+        if (comp->ActionRequest == INSTALLSTATE_LOCAL ||
+            comp->ActionRequest == INSTALLSTATE_SOURCE)
         {
             if (!comp->FullKeypath)
                 continue;
@@ -2771,7 +2767,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
             }
             RegCloseKey(hkey);
         }
-        else if (ACTION_VerifyComponentForAction(comp, INSTALLSTATE_ABSENT))
+        else if (comp->ActionRequest == INSTALLSTATE_ABSENT)
         {
             if (package->Context == MSIINSTALLCONTEXT_MACHINE)
                 MSIREG_DeleteUserDataComponentKey(comp->ComponentId, szLocalSid);
@@ -2867,15 +2863,12 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param)
     if (!comp)
         return ERROR_SUCCESS;
 
-    if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL))
+    if (comp->ActionRequest != INSTALLSTATE_LOCAL)
     {
-        TRACE("Skipping typelib reg due to disabled component\n");
-
+        TRACE("Component not scheduled for installation: %s\n", debugstr_w(component));
         comp->Action = comp->Installed;
-
         return ERROR_SUCCESS;
     }
-
     comp->Action = INSTALLSTATE_LOCAL;
 
     file = get_loaded_file( package, comp->KeyPath ); 
@@ -2979,10 +2972,9 @@ static UINT ITERATE_UnregisterTypeLibraries( MSIRECORD *row, LPVOID param )
     if (!comp)
         return ERROR_SUCCESS;
 
-    if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_ABSENT ))
+    if (comp->ActionRequest != INSTALLSTATE_ABSENT)
     {
-        TRACE("Skipping, component is not scheduled for uninstall\n");
-
+        TRACE("Component not scheduled for removal %s\n", debugstr_w(component));
         comp->Action = comp->Installed;
         return ERROR_SUCCESS;
     }
@@ -3071,10 +3063,9 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param)
     if (!comp)
         return ERROR_SUCCESS;
 
-    if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL ))
+    if (comp->ActionRequest != INSTALLSTATE_LOCAL)
     {
-        TRACE("Skipping shortcut creation due to disabled component\n");
-
+        TRACE("Component not scheduled for installation %s\n", debugstr_w(component));
         comp->Action = comp->Installed;
         return ERROR_SUCCESS;
     }
@@ -3208,10 +3199,9 @@ static UINT ITERATE_RemoveShortcuts( MSIRECORD *row, LPVOID param )
     if (!comp)
         return ERROR_SUCCESS;
 
-    if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_ABSENT ))
+    if (comp->ActionRequest != INSTALLSTATE_ABSENT)
     {
-        TRACE("Skipping, component not scheduled for uninstall\n");
-
+        TRACE("Component not scheduled for removal %s\n", debugstr_w(component));
         comp->Action = comp->Installed;
         return ERROR_SUCCESS;
     }
@@ -3626,17 +3616,15 @@ static UINT ITERATE_WriteIniValues(MSIRECORD *row, LPVOID param)
 
     component = MSI_RecordGetString(row, 8);
     comp = get_loaded_component(package,component);
+    if (!comp)
+        return ERROR_SUCCESS;
 
-    if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL))
+    if (comp->ActionRequest != INSTALLSTATE_LOCAL)
     {
-        TRACE("Skipping ini file due to disabled component %s\n",
-                        debugstr_w(component));
-
+        TRACE("Component not scheduled for installation %s\n", debugstr_w(component));
         comp->Action = comp->Installed;
-
         return ERROR_SUCCESS;
     }
-
     comp->Action = INSTALLSTATE_LOCAL;
 
     identifier = MSI_RecordGetString(row,1); 
@@ -4490,14 +4478,15 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param)
 
     component = MSI_RecordGetString(rec,3);
     comp = get_loaded_component(package,component);
+    if (!comp)
+        return ERROR_SUCCESS;
 
-    if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL ) && 
-       !ACTION_VerifyComponentForAction( comp, INSTALLSTATE_SOURCE ) &&
-       !ACTION_VerifyComponentForAction( comp, INSTALLSTATE_ADVERTISED ))
+    if (comp->ActionRequest != INSTALLSTATE_LOCAL &&
+        comp->ActionRequest != INSTALLSTATE_SOURCE &&
+        comp->ActionRequest != INSTALLSTATE_ADVERTISED)
     {
-        TRACE("Skipping: Component %s not scheduled for install\n",
-                        debugstr_w(component));
-
+        TRACE("Component not scheduled for installation %s\n", debugstr_w(component));
+        comp->Action = comp->Installed;
         return ERROR_SUCCESS;
     }
 
diff --git a/dlls/msi/files.c b/dlls/msi/files.c
index b7af4d3..d641950 100644
--- a/dlls/msi/files.c
+++ b/dlls/msi/files.c
@@ -108,7 +108,7 @@ static void schedule_install_files(MSIPACKAGE *package)
 
     LIST_FOR_EACH_ENTRY(file, &package->files, MSIFILE, entry)
     {
-        if (!ACTION_VerifyComponentForAction(file->Component, INSTALLSTATE_LOCAL))
+        if (file->Component->ActionRequest != INSTALLSTATE_LOCAL)
         {
             TRACE("File %s is not scheduled for install\n", debugstr_w(file->File));
 
@@ -358,19 +358,15 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
 
     component = MSI_RecordGetString(row,2);
     comp = get_loaded_component(package,component);
+    if (!comp)
+        return ERROR_SUCCESS;
 
-    if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL ))
+    if (comp->ActionRequest != INSTALLSTATE_LOCAL)
     {
-        TRACE("Skipping copy due to disabled component %s\n",
-                        debugstr_w(component));
-
-        /* the action taken was the same as the current install state */        
-        if (comp)
-            comp->Action = comp->Installed;
-
+        TRACE("Component not scheduled for installation %s\n", debugstr_w(component));
+        comp->Action = comp->Installed;
         return ERROR_SUCCESS;
     }
-
     comp->Action = INSTALLSTATE_LOCAL;
 
     file_key = MSI_RecordGetString(row,3);
diff --git a/dlls/msi/font.c b/dlls/msi/font.c
index 73ebe20..1b2c3c7 100644
--- a/dlls/msi/font.c
+++ b/dlls/msi/font.c
@@ -201,10 +201,9 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param)
         return ERROR_SUCCESS;
     }
 
-    /* check to make sure that component is installed */
-    if (!ACTION_VerifyComponentForAction( file->Component, INSTALLSTATE_LOCAL))
+    if (file->Component->ActionRequest != INSTALLSTATE_LOCAL)
     {
-        TRACE("Skipping: Component not scheduled for install\n");
+        TRACE("Component not scheduled for installation\n");
         return ERROR_SUCCESS;
     }
 
@@ -280,10 +279,9 @@ static UINT ITERATE_UnregisterFonts( MSIRECORD *row, LPVOID param )
         return ERROR_SUCCESS;
     }
 
-    /* check to make sure that component is uninstalled */
-    if (!ACTION_VerifyComponentForAction( file->Component, INSTALLSTATE_ABSENT ))
+    if (file->Component->ActionRequest != INSTALLSTATE_ABSENT)
     {
-        TRACE("Skipping: Component not scheduled for uninstall\n");
+        TRACE("Component not scheduled for removal\n");
         return ERROR_SUCCESS;
     }
 
diff --git a/dlls/msi/helpers.c b/dlls/msi/helpers.c
index e3009f7..df25c3e 100644
--- a/dlls/msi/helpers.c
+++ b/dlls/msi/helpers.c
@@ -604,17 +604,6 @@ void ui_actiondata(MSIPACKAGE *package, LPCWSTR action, MSIRECORD * record)
     msiobj_release(&row->hdr);
 }
 
-BOOL ACTION_VerifyComponentForAction( const MSICOMPONENT* comp, INSTALLSTATE check )
-{
-    if (!comp)
-        return FALSE;
-
-    if (comp->ActionRequest == check)
-        return TRUE;
-    else
-        return FALSE;
-}
-
 BOOL ACTION_VerifyFeatureForAction( const MSIFEATURE* feature, INSTALLSTATE check )
 {
     if (!feature)
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 8022afc..8c77a9f 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -982,7 +982,6 @@ extern void msi_free_action_script(MSIPACKAGE *package, UINT script);
 extern LPWSTR build_icon_path(MSIPACKAGE *, LPCWSTR);
 extern LPWSTR build_directory_name(DWORD , ...);
 extern BOOL create_full_pathW(const WCHAR *path);
-extern BOOL ACTION_VerifyComponentForAction(const MSICOMPONENT*, INSTALLSTATE);
 extern BOOL ACTION_VerifyFeatureForAction(const MSIFEATURE*, INSTALLSTATE);
 extern void reduce_to_longfilename(WCHAR*);
 extern LPWSTR create_component_advertise_string(MSIPACKAGE*, MSICOMPONENT*, LPCWSTR);
-- 
1.6.3.3





More information about the wine-patches mailing list