Module: wine Branch: master Commit: dcb501decd8a40032200c917b5017f75cf362ca6 URL: http://source.winehq.org/git/wine.git/?a=commit;h=dcb501decd8a40032200c917b5...
Author: Hans Leidekker hans@codeweavers.com Date: Wed Jun 9 12:08:42 2010 +0200
msi: Create directories right before installing files.
---
dlls/msi/action.c | 37 ------------------------------------- dlls/msi/files.c | 29 +++++++++++++++++++++-------- dlls/msi/msipriv.h | 1 - dlls/msi/tests/install.c | 5 +---- 4 files changed, 22 insertions(+), 50 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 0505d33..565ef66 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -1003,43 +1003,6 @@ static UINT ITERATE_CreateFolders(MSIRECORD *row, LPVOID param) return ERROR_SUCCESS; }
-/* FIXME: probably should merge this with the above function */ -static UINT msi_create_directory( MSIPACKAGE* package, LPCWSTR dir ) -{ - UINT rc = ERROR_SUCCESS; - MSIFOLDER *folder; - LPWSTR install_path; - - install_path = resolve_folder(package, dir, FALSE, FALSE, TRUE, &folder); - if (!install_path) - return ERROR_FUNCTION_FAILED; - - /* create the path */ - if (folder->State == 0) - { - create_full_pathW(install_path); - folder->State = 2; - } - msi_free(install_path); - - 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 (comp->ActionRequest != INSTALLSTATE_LOCAL) - continue; - msi_create_directory( package, comp->Directory ); - } - - return ERROR_SUCCESS; -} - static UINT ACTION_CreateFolders(MSIPACKAGE *package) { static const WCHAR ExecSeqQuery[] = diff --git a/dlls/msi/files.c b/dlls/msi/files.c index 052a158..91ec43e 100644 --- a/dlls/msi/files.c +++ b/dlls/msi/files.c @@ -174,6 +174,24 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source) return gle; }
+static UINT msi_create_directory( MSIPACKAGE *package, const WCHAR *dir ) +{ + MSIFOLDER *folder; + WCHAR *install_path; + + install_path = resolve_folder( package, dir, FALSE, FALSE, TRUE, &folder ); + if (!install_path) + return ERROR_FUNCTION_FAILED; + + if (folder->State == 0) + { + create_full_pathW( install_path ); + folder->State = 2; + } + msi_free( install_path ); + return ERROR_SUCCESS; +} + static BOOL installfiles_cb(MSIPACKAGE *package, LPCWSTR file, DWORD action, LPWSTR *path, DWORD *attrs, PVOID user) { @@ -193,6 +211,7 @@ static BOOL installfiles_cb(MSIPACKAGE *package, LPCWSTR file, DWORD action, return FALSE;
msi_file_update_ui(package, f, szInstallFiles); + msi_create_directory(package, f->Component->Directory);
*path = strdupW(f->TargetPath); *attrs = f->Attributes; @@ -224,14 +243,6 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
schedule_install_files(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 = msi_alloc_zero( sizeof(MSIMEDIAINFO) );
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry ) @@ -273,6 +284,8 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) debugstr_w(file->TargetPath));
msi_file_update_ui(package, file, szInstallFiles); + msi_create_directory(package, file->Component->Directory); + rc = copy_install_file(package, file, source); if (rc != ERROR_SUCCESS) { diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index cf9e690..819d8bc 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -1002,7 +1002,6 @@ extern void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature) extern UINT register_unique_action(MSIPACKAGE *, LPCWSTR); extern BOOL check_unique_action(const MSIPACKAGE *, LPCWSTR); extern WCHAR* generate_error_string(MSIPACKAGE *, UINT, DWORD, ... ); -extern UINT msi_create_component_directories( MSIPACKAGE *package ); extern UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid, MSIINSTALLCONTEXT context, DWORD options, LPCWSTR value); extern UINT msi_get_local_package_name(LPWSTR path, LPCWSTR suffix); diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index b78918c..6702f13 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -3981,10 +3981,7 @@ static void test_caborder(void) ok(!delete_pf("msitest\maximus", TRUE), "File is installed\n"); ok(!delete_pf("msitest\augustus", TRUE), "File is installed\n"); ok(!delete_pf("msitest\caesar", TRUE), "File is installed\n"); - todo_wine - { - ok(!delete_pf("msitest", FALSE), "File is installed\n"); - } + ok(!delete_pf("msitest", FALSE), "File is installed\n");
delete_cab_files(); DeleteFile(msifile);