Commit a58c6251 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

msi: Disable FS redirection for temporary file in cabinet_copy_file().

parent 1be02b2b
......@@ -48,6 +48,15 @@
WINE_DEFAULT_DEBUG_CHANNEL(msi);
BOOL msi_get_temp_file_name( MSIPACKAGE *package, const WCHAR *tmp_path, const WCHAR *prefix, WCHAR *tmp_filename )
{
BOOL ret;
msi_disable_fs_redirection( package );
ret = GetTempFileNameW( tmp_path, prefix, 0, tmp_filename );
msi_revert_fs_redirection( package );
return ret;
}
HANDLE msi_create_file( MSIPACKAGE *package, const WCHAR *filename, DWORD access, DWORD sharing, DWORD creation,
DWORD flags )
{
......
......@@ -468,10 +468,10 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint,
msi_free( tmppathW );
return ERROR_OUTOFMEMORY;
}
if (!GetTempFileNameW(tmppathW, L"msi", 0, tmpfileW)) tmpfileW[0] = 0;
if (!msi_get_temp_file_name( data->package, tmppathW, L"msi", tmpfileW )) tmpfileW[0] = 0;
msi_free( tmppathW );
handle = CreateFileW(tmpfileW, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, attrs, NULL);
handle = msi_create_file( data->package, tmpfileW, GENERIC_READ | GENERIC_WRITE, 0, CREATE_ALWAYS, attrs );
if (handle != INVALID_HANDLE_VALUE &&
msi_move_file( data->package, path, NULL, MOVEFILE_DELAY_UNTIL_REBOOT ) &&
......@@ -482,7 +482,7 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint,
else
{
WARN( "failed to schedule rename operation %s (error %lu)\n", debugstr_w(path), GetLastError() );
DeleteFileW( tmpfileW );
msi_delete_file( data->package, tmpfileW );
}
msi_free(tmpfileW);
}
......
......@@ -1073,6 +1073,7 @@ static inline void msi_revert_fs_redirection( MSIPACKAGE *package )
{
if (is_wow64 && package->platform == PLATFORM_X64) Wow64RevertWow64FsRedirection( package->cookie );
}
extern BOOL msi_get_temp_file_name( MSIPACKAGE *, const WCHAR *, const WCHAR *, WCHAR * ) DECLSPEC_HIDDEN;
extern HANDLE msi_create_file( MSIPACKAGE *, const WCHAR *, DWORD, DWORD, DWORD, DWORD ) DECLSPEC_HIDDEN;
extern BOOL msi_delete_file( MSIPACKAGE *, const WCHAR * ) DECLSPEC_HIDDEN;
extern BOOL msi_remove_directory( MSIPACKAGE *, const WCHAR * ) DECLSPEC_HIDDEN;
......
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