diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 8ddd0dc568d..702a92abbf4 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -966,6 +966,12 @@ static UINT ITERATE_CreateFolders(MSIRECORD *row, LPVOID param) if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_LOCAL) { TRACE("Component not scheduled for installation: %s\n", debugstr_w(component)); @@ -1039,6 +1045,12 @@ static UINT ITERATE_RemoveFolders( MSIRECORD *row, LPVOID param ) if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_ABSENT) { TRACE("Component not scheduled for removal: %s\n", debugstr_w(component)); @@ -1808,15 +1820,15 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package) } /* - * now we want to enable or disable components base on feature + * now we want to enable or disable components based on feature */ - LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) { ComponentList *cl; - TRACE("Examining Feature %s (Level %i, Installed %i, Action %i)\n", - debugstr_w(feature->Feature), feature->Level, feature->Installed, feature->Action); + TRACE("Examining Feature %s (Level %d Installed %d Request %d Action %d)\n", + debugstr_w(feature->Feature), feature->Level, feature->Installed, + feature->ActionRequest, feature->Action); if (!feature->Level) continue; @@ -1824,8 +1836,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package) /* features with components that have compressed files are made local */ LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry ) { - if (cl->component->Enabled && - cl->component->ForceLocalState && + if (cl->component->ForceLocalState && feature->Action == INSTALLSTATE_SOURCE) { msi_feature_set_state(package, feature, INSTALLSTATE_LOCAL); @@ -1837,9 +1848,6 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package) { component = cl->component; - if (!component->Enabled) - continue; - switch (feature->Action) { case INSTALLSTATE_ABSENT: @@ -1870,10 +1878,6 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package) LIST_FOR_EACH_ENTRY( component, &package->components, MSICOMPONENT, entry ) { - /* if the component isn't enabled, leave it alone */ - if (!component->Enabled) - continue; - /* check if it's local or source */ if (!(component->Attributes & msidbComponentAttributesOptional) && (component->hasLocalFeature || component->hasSourceFeature)) @@ -1912,17 +1916,16 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package) LIST_FOR_EACH_ENTRY( component, &package->components, MSICOMPONENT, entry ) { - if (component->Action == INSTALLSTATE_DEFAULT) + if (component->ActionRequest == INSTALLSTATE_DEFAULT) { TRACE("%s was default, setting to local\n", debugstr_w(component->Component)); msi_component_set_state(package, component, INSTALLSTATE_LOCAL); } - TRACE("Result: Component %s (Installed %i, Action %i)\n", - debugstr_w(component->Component), component->Installed, component->Action); + TRACE("Result: Component %s (Installed %d Request %d Action %d)\n", + debugstr_w(component->Component), component->Installed, component->ActionRequest, component->Action); } - return ERROR_SUCCESS; } @@ -2383,16 +2386,17 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param) ui_progress(package,2,0,0,0); - value = NULL; - key = NULL; - uikey = NULL; - name = NULL; - component = MSI_RecordGetString(row, 6); comp = get_loaded_component(package,component); if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_LOCAL) { TRACE("Component not scheduled for installation: %s\n", debugstr_w(component)); @@ -2563,6 +2567,12 @@ static UINT ITERATE_RemoveRegistryValuesOnUninstall( MSIRECORD *row, LPVOID para if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_ABSENT) { TRACE("Component not scheduled for removal: %s\n", debugstr_w(component)); @@ -2632,6 +2642,12 @@ static UINT ITERATE_RemoveRegistryValuesOnInstall( MSIRECORD *row, LPVOID param if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_LOCAL) { TRACE("Component not scheduled for installation: %s\n", debugstr_w(component)); @@ -2755,9 +2771,9 @@ static UINT ACTION_InstallValidate(MSIPACKAGE *package) LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) { - TRACE("Feature: %s; Installed: %i; Action %i; Request %i\n", - debugstr_w(feature->Feature), feature->Installed, feature->Action, - feature->ActionRequest); + TRACE("Feature: %s Installed %d Request %d Action %d\n", + debugstr_w(feature->Feature), feature->Installed, + feature->ActionRequest, feature->Action); } return ERROR_SUCCESS; @@ -3022,11 +3038,12 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) ACTION_RefCountComponent( package, comp ); - TRACE("Component %s (%s), Keypath=%s, RefCount=%i\n", + TRACE("Component %s (%s), Keypath=%s, RefCount=%i Request=%u\n", debugstr_w(comp->Component), debugstr_w(squished_cc), debugstr_w(comp->FullKeypath), - comp->RefCount); + comp->RefCount, + comp->ActionRequest); if (comp->ActionRequest == INSTALLSTATE_LOCAL || comp->ActionRequest == INSTALLSTATE_SOURCE) @@ -3054,7 +3071,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) msi_reg_set_val_str(hkey, szPermKey, comp->FullKeypath); } - if (comp->Action == INSTALLSTATE_LOCAL) + if (comp->ActionRequest == INSTALLSTATE_LOCAL) msi_reg_set_val_str(hkey, squished_pc, comp->FullKeypath); else { @@ -3192,6 +3209,12 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param) if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_LOCAL) { TRACE("Component not scheduled for installation: %s\n", debugstr_w(component)); @@ -3301,6 +3324,12 @@ static UINT ITERATE_UnregisterTypeLibraries( MSIRECORD *row, LPVOID param ) if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_ABSENT) { TRACE("Component not scheduled for removal %s\n", debugstr_w(component)); @@ -3392,6 +3421,12 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param) if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_LOCAL) { TRACE("Component not scheduled for installation %s\n", debugstr_w(component)); @@ -3528,6 +3563,12 @@ static UINT ITERATE_RemoveShortcuts( MSIRECORD *row, LPVOID param ) if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_ABSENT) { TRACE("Component not scheduled for removal %s\n", debugstr_w(component)); @@ -4032,6 +4073,12 @@ static UINT ITERATE_WriteIniValues(MSIRECORD *row, LPVOID param) if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_LOCAL) { TRACE("Component not scheduled for installation %s\n", debugstr_w(component)); @@ -4127,6 +4174,12 @@ static UINT ITERATE_RemoveIniValuesOnUninstall( MSIRECORD *row, LPVOID param ) if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_ABSENT) { TRACE("Component not scheduled for removal %s\n", debugstr_w(component)); @@ -4190,6 +4243,12 @@ static UINT ITERATE_RemoveIniValuesOnInstall( MSIRECORD *row, LPVOID param ) if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_LOCAL) { TRACE("Component not scheduled for installation %s\n", debugstr_w(component)); @@ -5351,6 +5410,12 @@ static UINT ITERATE_StartService(MSIRECORD *rec, LPVOID param) if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_LOCAL) { TRACE("Component not scheduled for installation: %s\n", debugstr_w(component)); @@ -5543,6 +5608,12 @@ static UINT ITERATE_StopService( MSIRECORD *rec, LPVOID param ) if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_ABSENT) { TRACE("Component not scheduled for removal: %s\n", debugstr_w(component)); @@ -5620,6 +5691,12 @@ static UINT ITERATE_DeleteService( MSIRECORD *rec, LPVOID param ) if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_ABSENT) { TRACE("Component not scheduled for removal: %s\n", debugstr_w(component)); @@ -6227,6 +6304,12 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID param ) if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_LOCAL) { TRACE("Component not scheduled for installation: %s\n", debugstr_w(component)); @@ -6410,6 +6493,12 @@ static UINT ITERATE_RemoveEnvironmentString( MSIRECORD *rec, LPVOID param ) if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_ABSENT) { TRACE("Component not scheduled for removal: %s\n", debugstr_w(component)); diff --git a/dlls/msi/classes.c b/dlls/msi/classes.c index 22d11c1441c..019ac064d45 100644 --- a/dlls/msi/classes.c +++ b/dlls/msi/classes.c @@ -824,6 +824,12 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) if ( !comp ) continue; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + continue; + } + feature = cls->Feature; if (!feature) continue; @@ -976,6 +982,12 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package ) if (!comp) continue; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + continue; + } + feature = cls->Feature; if (!feature) continue; @@ -1250,6 +1262,12 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) if (!ext->Component) continue; + if (!ext->Component->Enabled) + { + TRACE("component is disabled\n"); + continue; + } + feature = ext->Feature; if (!feature) continue; @@ -1354,6 +1372,12 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package ) if (!ext->Component) continue; + if (!ext->Component->Enabled) + { + TRACE("component is disabled\n"); + continue; + } + feature = ext->Feature; if (!feature) continue; diff --git a/dlls/msi/files.c b/dlls/msi/files.c index 79d78143bb4..0ed9582c179 100644 --- a/dlls/msi/files.c +++ b/dlls/msi/files.c @@ -66,7 +66,7 @@ static void schedule_install_files(MSIPACKAGE *package) LIST_FOR_EACH_ENTRY(file, &package->files, MSIFILE, entry) { - if (file->Component->ActionRequest != INSTALLSTATE_LOCAL) + if (file->Component->ActionRequest != INSTALLSTATE_LOCAL || !file->Component->Enabled) { TRACE("File %s is not scheduled for install\n", debugstr_w(file->File)); @@ -501,6 +501,12 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param ) if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_LOCAL && comp->ActionRequest != INSTALLSTATE_SOURCE) { TRACE("Component not scheduled for installation: %s\n", debugstr_w(component)); @@ -693,6 +699,12 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param) if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_LOCAL) { TRACE("Component not scheduled for installation %s\n", debugstr_w(component)); @@ -775,6 +787,12 @@ static UINT ITERATE_RemoveDuplicateFiles( MSIRECORD *row, LPVOID param ) if (!comp) return ERROR_SUCCESS; + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (comp->ActionRequest != INSTALLSTATE_ABSENT) { TRACE("Component not scheduled for removal %s\n", debugstr_w(component)); @@ -888,6 +906,12 @@ static UINT ITERATE_RemoveFiles(MSIRECORD *row, LPVOID param) return ERROR_FUNCTION_FAILED; } + if (!comp->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (!verify_comp_for_removal(comp, install_mode)) { TRACE("Skipping removal due to missing conditions\n"); @@ -972,6 +996,12 @@ UINT ACTION_RemoveFiles( MSIPACKAGE *package ) file->Component->Installed == INSTALLSTATE_SOURCE ) continue; + if (!file->Component->Enabled) + { + TRACE("component is disabled\n"); + continue; + } + if (file->Version) { ver = msi_get_disk_file_version( file->TargetPath ); diff --git a/dlls/msi/font.c b/dlls/msi/font.c index 1d99a4c0d3a..2128e922a56 100644 --- a/dlls/msi/font.c +++ b/dlls/msi/font.c @@ -196,6 +196,12 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param) return ERROR_SUCCESS; } + if (!file->Component->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (file->Component->ActionRequest != INSTALLSTATE_LOCAL) { TRACE("Component not scheduled for installation\n"); @@ -274,6 +280,12 @@ static UINT ITERATE_UnregisterFonts( MSIRECORD *row, LPVOID param ) return ERROR_SUCCESS; } + if (!file->Component->Enabled) + { + TRACE("component is disabled\n"); + return ERROR_SUCCESS; + } + if (file->Component->ActionRequest != INSTALLSTATE_ABSENT) { TRACE("Component not scheduled for removal\n"); diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index 365c8a68184..d6fa3f0b735 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -5760,8 +5760,8 @@ static void test_publish(void) /* UnpublishFeatures, only feature removed. Only works when entire product is removed */ r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - todo_wine ok(pf_exists("msitest\\maximus"), "File deleted\n"); - todo_wine ok(pf_exists("msitest"), "Directory deleted\n"); + ok(pf_exists("msitest\\maximus"), "File deleted\n"); + ok(pf_exists("msitest"), "Directory deleted\n"); state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"); ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);