James Hawkins : msi: Skip the feature action detection logic if there is no product code.

Alexandre Julliard julliard at winehq.org
Mon Aug 25 06:20:52 CDT 2008


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

Author: James Hawkins <jhawkins at codeweavers.com>
Date:   Mon Aug 25 00:07:18 2008 -0500

msi: Skip the feature action detection logic if there is no product code.

---

 dlls/msi/action.c        |   25 +++++++++++++------------
 dlls/msi/dialog.c        |    2 +-
 dlls/msi/events.c        |    6 +++---
 dlls/msi/install.c       |    2 +-
 dlls/msi/msipriv.h       |   11 +++++++++--
 dlls/msi/tests/package.c |    5 +----
 6 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index f165109..a0b0a22 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -1327,7 +1327,7 @@ static UINT load_feature(MSIRECORD * row, LPVOID param)
     feature->Attributes = MSI_RecordGetInteger(row,8);
 
     feature->Installed = INSTALLSTATE_UNKNOWN;
-    msi_feature_set_state( feature, INSTALLSTATE_UNKNOWN );
+    msi_feature_set_state(package, feature, INSTALLSTATE_UNKNOWN);
 
     list_add_tail( &package->features, &feature->entry );
 
@@ -1754,7 +1754,7 @@ static BOOL process_state_property(MSIPACKAGE* package, int level,
             continue;
 
         if (strcmpiW(override,all)==0)
-            msi_feature_set_state( feature, state );
+            msi_feature_set_state(package, feature, state);
         else
         {
             LPWSTR ptr = override;
@@ -1765,7 +1765,7 @@ static BOOL process_state_property(MSIPACKAGE* package, int level,
                 if ((ptr2 && strncmpW(ptr,feature->Feature, ptr2-ptr)==0)
                     || (!ptr2 && strcmpW(ptr,feature->Feature)==0))
                 {
-                    msi_feature_set_state(feature, state);
+                    msi_feature_set_state(package, feature, state);
                     break;
                 }
                 if (ptr2)
@@ -1841,11 +1841,11 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
             if ((feature_state) && (feature->Action == INSTALLSTATE_UNKNOWN))
             {
                 if (feature->Attributes & msidbFeatureAttributesFavorSource)
-                    msi_feature_set_state( feature, INSTALLSTATE_SOURCE );
+                    msi_feature_set_state(package, feature, INSTALLSTATE_SOURCE);
                 else if (feature->Attributes & msidbFeatureAttributesFavorAdvertise)
-                    msi_feature_set_state( feature, INSTALLSTATE_ADVERTISED );
+                    msi_feature_set_state(package, feature, INSTALLSTATE_ADVERTISED);
                 else
-                    msi_feature_set_state( feature, INSTALLSTATE_LOCAL );
+                    msi_feature_set_state(package, feature, INSTALLSTATE_LOCAL);
             }
         }
 
@@ -1858,7 +1858,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
                 continue;
 
             LIST_FOR_EACH_ENTRY( fl, &feature->Children, FeatureList, entry )
-                msi_feature_set_state( fl->feature, INSTALLSTATE_UNKNOWN );
+                msi_feature_set_state(package, fl->feature, INSTALLSTATE_UNKNOWN);
         }
     }
     else
@@ -1891,7 +1891,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
                 cl->component->ForceLocalState &&
                 feature->Action == INSTALLSTATE_SOURCE)
             {
-                msi_feature_set_state( feature, INSTALLSTATE_LOCAL );
+                msi_feature_set_state(package, feature, INSTALLSTATE_LOCAL);
                 break;
             }
         }
@@ -5736,7 +5736,8 @@ static BOOL init_functionpointers(void)
     return TRUE;
 }
 
-static UINT install_assembly(MSIASSEMBLY *assembly, LPWSTR path)
+static UINT install_assembly(MSIPACKAGE *package, MSIASSEMBLY *assembly,
+                             LPWSTR path)
 {
     IAssemblyCache *cache;
     HRESULT hr;
@@ -5745,7 +5746,7 @@ static UINT install_assembly(MSIASSEMBLY *assembly, LPWSTR path)
     TRACE("installing assembly: %s\n", debugstr_w(path));
 
     if (assembly->feature)
-        msi_feature_set_state(assembly->feature, INSTALLSTATE_LOCAL);
+        msi_feature_set_state(package, assembly->feature, INSTALLSTATE_LOCAL);
 
     if (assembly->manifest)
         FIXME("Manifest unhandled\n");
@@ -5905,7 +5906,7 @@ static BOOL installassembly_cb(MSIPACKAGE *package, LPCWSTR file, DWORD action,
     {
         assembly->installed = TRUE;
 
-        r = install_assembly(assembly, temppath);
+        r = install_assembly(package, assembly, temppath);
         if (r != ERROR_SUCCESS)
             ERR("Failed to install assembly\n");
     }
@@ -5970,7 +5971,7 @@ static UINT ACTION_MsiPublishAssemblies( MSIPACKAGE *package )
         {
             lstrcpyW(path, assembly->file->SourcePath);
 
-            r = install_assembly(assembly, path);
+            r = install_assembly(package, assembly, path);
             if (r != ERROR_SUCCESS)
                 ERR("Failed to install assembly\n");
         }
diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c
index 8c7c59a..add7876 100644
--- a/dlls/msi/dialog.c
+++ b/dlls/msi/dialog.c
@@ -1909,7 +1909,7 @@ msi_seltree_menu( HWND hwnd, HTREEITEM hItem )
     case INSTALLSTATE_LOCAL:
     case INSTALLSTATE_ADVERTISED:
     case INSTALLSTATE_ABSENT:
-        msi_feature_set_state( feature, r );
+        msi_feature_set_state(package, feature, r);
         break;
     default:
         FIXME("select feature and all children\n");
diff --git a/dlls/msi/events.c b/dlls/msi/events.c
index 6b6ead9..79e1f66 100644
--- a/dlls/msi/events.c
+++ b/dlls/msi/events.c
@@ -180,7 +180,7 @@ static UINT ControlEvent_AddLocal(MSIPACKAGE* package, LPCWSTR argument,
     else
     {
         LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
-            msi_feature_set_state( feature, INSTALLSTATE_LOCAL );
+            msi_feature_set_state(package, feature, INSTALLSTATE_LOCAL);
 
         ACTION_UpdateComponentStates(package,argument);
     }
@@ -200,7 +200,7 @@ static UINT ControlEvent_Remove(MSIPACKAGE* package, LPCWSTR argument,
     else
     {
         LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
-            msi_feature_set_state( feature, INSTALLSTATE_ABSENT );
+            msi_feature_set_state(package, feature, INSTALLSTATE_ABSENT);
 
         ACTION_UpdateComponentStates(package,argument);
     }
@@ -220,7 +220,7 @@ static UINT ControlEvent_AddSource(MSIPACKAGE* package, LPCWSTR argument,
     else
     {
         LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
-            msi_feature_set_state( feature, INSTALLSTATE_SOURCE );
+            msi_feature_set_state(package, feature, INSTALLSTATE_SOURCE);
         ACTION_UpdateComponentStates(package,argument);
     }
     return ERROR_SUCCESS;
diff --git a/dlls/msi/install.c b/dlls/msi/install.c
index 6415459..95fe51a 100644
--- a/dlls/msi/install.c
+++ b/dlls/msi/install.c
@@ -774,7 +774,7 @@ UINT WINAPI MSI_SetFeatureStateW(MSIPACKAGE* package, LPCWSTR szFeature,
         feature->Attributes & msidbFeatureAttributesDisallowAdvertise)
         return ERROR_FUNCTION_FAILED;
 
-    msi_feature_set_state( feature, iState );
+    msi_feature_set_state(package, feature, iState);
 
     ACTION_UpdateComponentStates(package,szFeature);
 
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index e6ce9da..cfb5c41 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -854,9 +854,16 @@ extern UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action, UIN
 extern void ACTION_FinishCustomActions( const MSIPACKAGE* package);
 extern UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, UINT script, BOOL execute);
 
-static inline void msi_feature_set_state( MSIFEATURE *feature, INSTALLSTATE state )
+static inline void msi_feature_set_state(MSIPACKAGE *package,
+                                         MSIFEATURE *feature,
+                                         INSTALLSTATE state)
 {
-    if (state == INSTALLSTATE_ABSENT)
+    if (!package->ProductCode)
+    {
+        feature->ActionRequest = state;
+        feature->Action = state;
+    }
+    else if (state == INSTALLSTATE_ABSENT)
     {
         switch (feature->Installed)
         {
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index ab34e81..54c307d 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -5926,10 +5926,7 @@ static void test_featureparents(void)
     r = MsiGetFeatureState(hpkg, "orion", &state, &action);
     ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
     ok( state == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", state);
-    todo_wine
-    {
-        ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
-    }
+    ok( action == INSTALLSTATE_ABSENT, "Expected orion INSTALLSTATE_ABSENT, got %d\n", action);
 
     state = 0xdeadbee;
     action = 0xdeadbee;




More information about the wine-cvs mailing list