Hans Leidekker : msi: Only run the CreateFolder and RemoveFolder actions when the component is set to be installed or removed , respectively.
Alexandre Julliard
julliard at winehq.org
Tue Feb 16 11:44:41 CST 2010
Module: wine
Branch: master
Commit: 9cbb80d984db6077a426182d29f62a1871b778ce
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9cbb80d984db6077a426182d29f62a1871b778ce
Author: Hans Leidekker <hans at codeweavers.com>
Date: Tue Feb 16 11:45:34 2010 +0100
msi: Only run the CreateFolder and RemoveFolder actions when the component is set to be installed or removed, respectively.
---
dlls/msi/action.c | 32 ++++++++++++++++++++++++++++++--
dlls/msi/tests/install.c | 36 ++++++++++++++++++++++++++++++++++--
2 files changed, 64 insertions(+), 4 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 7bb4e52..2c036b8 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -886,10 +886,24 @@ static BOOL ACTION_HandleCustomAction( MSIPACKAGE* package, LPCWSTR action,
static UINT ITERATE_CreateFolders(MSIRECORD *row, LPVOID param)
{
MSIPACKAGE *package = param;
- LPCWSTR dir;
+ LPCWSTR dir, component;
LPWSTR full_path;
MSIRECORD *uirow;
MSIFOLDER *folder;
+ MSICOMPONENT *comp;
+
+ component = MSI_RecordGetString(row, 2);
+ comp = get_loaded_component(package, component);
+ if (!comp)
+ return ERROR_SUCCESS;
+
+ if (comp->ActionRequest != INSTALLSTATE_LOCAL)
+ {
+ TRACE("Component not scheduled for installation: %s\n", debugstr_w(component));
+ comp->Action = comp->Installed;
+ return ERROR_SUCCESS;
+ }
+ comp->Action = INSTALLSTATE_LOCAL;
dir = MSI_RecordGetString(row,1);
if (!dir)
@@ -983,10 +997,24 @@ static UINT ACTION_CreateFolders(MSIPACKAGE *package)
static UINT ITERATE_RemoveFolders( MSIRECORD *row, LPVOID param )
{
MSIPACKAGE *package = param;
- LPCWSTR dir;
+ LPCWSTR dir, component;
LPWSTR full_path;
MSIRECORD *uirow;
MSIFOLDER *folder;
+ MSICOMPONENT *comp;
+
+ component = MSI_RecordGetString(row, 2);
+ comp = get_loaded_component(package, component);
+ if (!comp)
+ return ERROR_SUCCESS;
+
+ if (comp->ActionRequest != INSTALLSTATE_ABSENT)
+ {
+ TRACE("Component not scheduled for removal: %s\n", debugstr_w(component));
+ comp->Action = comp->Installed;
+ return ERROR_SUCCESS;
+ }
+ comp->Action = INSTALLSTATE_ABSENT;
dir = MSI_RecordGetString( row, 1 );
if (!dir)
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 8eb2b73..44eec8e 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -1091,7 +1091,7 @@ static const CHAR aup_custom_action_dat[] = "Action\tType\tSource\tTarget\tISCom
static const CHAR cf_create_folders_dat[] = "Directory_\tComponent_\n"
"s72\ts72\n"
"CreateFolder\tDirectory_\tComponent_\n"
- "MSITESTDIR\tOne\n";
+ "FIRSTDIR\tOne\n";
static const CHAR cf_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
"s72\tS255\tI2\n"
@@ -7857,7 +7857,23 @@ static void test_create_folder(void)
ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
- todo_wine ok(!delete_pf("msitest", FALSE), "Directory created\n");
+ ok(!delete_pf("msitest", FALSE), "Directory created\n");
+
+ r = MsiInstallProductA(msifile, "LOCAL=Two");
+ ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
+
+ ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
+ ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
+ ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
+ ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
+ ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
+ ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
+ ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
+ ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
+ ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
+ ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
+ ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
+ ok(!delete_pf("msitest", FALSE), "Directory created\n");
delete_test_files();
}
@@ -7887,6 +7903,22 @@ static void test_remove_folder(void)
ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
ok(!delete_pf("msitest", FALSE), "Directory created\n");
+ r = MsiInstallProductA(msifile, "LOCAL=Two");
+ ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
+
+ ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
+ ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
+ ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
+ ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
+ ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
+ ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
+ ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
+ ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
+ ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
+ ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
+ ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
+ ok(!delete_pf("msitest", FALSE), "Directory created\n");
+
delete_test_files();
}
More information about the wine-cvs
mailing list