Module: wine Branch: master Commit: e830975806df9ef283c89f7153b06b145dfb2cec URL: https://source.winehq.org/git/wine.git/?a=commit;h=e830975806df9ef283c89f715... Author: Jérôme Gardou <jerome.gardou(a)gmail.com> Date: Fri Feb 12 14:46:56 2021 +0100 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(a)reactos.org> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msi/package.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 25e22f040a4..05f122fb545 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -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) {