From 9c8458514cbafa83e79a6742584267204ed2e701 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Sat, 29 Oct 2005 11:29:17 +0000 Subject: [PATCH] Some installers don't call the CreateFolders action before the InstallFiles action as MSDN specifies, but it still seems to work, so make sure that we create component directories in the InstallFiles action anyway. --- dlls/msi/action.c | 24 ++++++++++++++++-------- dlls/msi/action.h | 1 + dlls/msi/files.c | 8 ++++++++ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 7ac9b100bb..e0fc0cbe67 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -1074,6 +1074,21 @@ static UINT msi_create_directory( MSIPACKAGE* package, LPCWSTR dir ) return rc; } +UINT msi_create_component_directories( MSIPACKAGE *package ) +{ + MSICOMPONENT *comp; + + /* create all the folders required by the components are going to install */ + LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry ) + { + if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL)) + continue; + msi_create_directory( package, comp->Directory ); + } + + return ERROR_SUCCESS; +} + /* * Also we cannot enable/disable components either, so for now I am just going * to do all the directories for all the components. @@ -1087,7 +1102,6 @@ static UINT ACTION_CreateFolders(MSIPACKAGE *package) '`','C','r','e','a','t','e','F','o','l','d','e','r','`',0 }; UINT rc; MSIQUERY *view; - MSICOMPONENT *comp; /* create all the empty folders specified in the CreateFolder table */ rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view ); @@ -1097,13 +1111,7 @@ static UINT ACTION_CreateFolders(MSIPACKAGE *package) rc = MSI_IterateRecords(view, NULL, ITERATE_CreateFolders, package); msiobj_release(&view->hdr); - /* create all the folders required by the components are going to install */ - LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry ) - { - if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL)) - continue; - msi_create_directory( package, comp->Directory ); - } + msi_create_component_directories( package ); return rc; } diff --git a/dlls/msi/action.h b/dlls/msi/action.h index c7572d8aa7..40aee9619a 100644 --- a/dlls/msi/action.h +++ b/dlls/msi/action.h @@ -273,6 +273,7 @@ extern void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature) extern UINT register_unique_action(MSIPACKAGE *, LPCWSTR); extern BOOL check_unique_action(MSIPACKAGE *, LPCWSTR); extern WCHAR* generate_error_string(MSIPACKAGE *, UINT, DWORD, ... ); +extern UINT msi_create_component_directories( MSIPACKAGE *package ); /* control event stuff */ diff --git a/dlls/msi/files.c b/dlls/msi/files.c index 6e162b8737..42326b7105 100644 --- a/dlls/msi/files.c +++ b/dlls/msi/files.c @@ -674,6 +674,14 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) } } + /* + * Despite MSDN specifying that the CreateFolders action + * should be called before InstallFiles, some installers don't + * do that, and they seem to work correctly. We need to create + * directories here to make sure that the files can be copied. + */ + msi_create_component_directories( package ); + mi = create_media_info(); /* Pass 2 */ -- 2.32.0.93.g670b81a890