msi: Remove read-only bit when copying the package file.

CopyFileW also copies the file attributes, and the copy will be opened with
write access later on.

Signed-off-by: Jérôme Gardou <jerome.gardou@reactos.org>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jérôme Gardou 2021-02-12 14:46:56 +01:00 committed by Alexandre Julliard
parent d6fed9c360
commit e830975806
1 changed files with 7 additions and 0 deletions

View File

@ -1371,6 +1371,8 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage)
r = get_local_package( db, localfile );
if (r != ERROR_SUCCESS || GetFileAttributesW( localfile ) == INVALID_FILE_ATTRIBUTES)
{
DWORD localfile_attr;
r = msi_create_empty_local_file( localfile, L".msi" );
if (r != ERROR_SUCCESS)
{
@ -1387,6 +1389,11 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage)
return r;
}
delete_on_close = TRUE;
/* Remove read-only bit, we are opening it with write access in MSI_OpenDatabaseW below. */
localfile_attr = GetFileAttributesW( localfile );
if (localfile_attr & FILE_ATTRIBUTE_READONLY)
SetFileAttributesW( localfile, localfile_attr & ~FILE_ATTRIBUTE_READONLY);
}
else if (dwOptions & WINE_OPENPACKAGEFLAGS_RECACHE)
{