Commit dcb501de authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Create directories right before installing files.

parent f2229e6d
......@@ -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[] =
......
......@@ -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)
{
......
......@@ -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);
......
......@@ -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");
}
delete_cab_files();
DeleteFile(msifile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment