msi: Make MsiInstallProductW open msi readonly

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57343
This commit is contained in:
Fabian Maurer 2024-11-03 16:13:10 +01:00
parent fa22986ace
commit 2a4fc095ee
4 changed files with 5 additions and 4 deletions

View file

@ -229,7 +229,7 @@ UINT WINAPI MsiInstallProductW(LPCWSTR szPackagePath, LPCWSTR szCommandLine)
{
MSIPACKAGE *package = NULL;
const WCHAR *reinstallmode;
DWORD options = 0;
DWORD options = WINE_OPENPACKAGEFLAGS_READONLY;
UINT r, len;
TRACE("%s %s\n",debugstr_w(szPackagePath), debugstr_w(szCommandLine));

View file

@ -906,6 +906,7 @@ extern UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel );
/* package internals */
#define WINE_OPENPACKAGEFLAGS_RECACHE 0x80000000
#define WINE_OPENPACKAGEFLAGS_READONLY 0x40000000
extern MSIPACKAGE *MSI_CreatePackage( MSIDATABASE * );
extern UINT MSI_OpenPackageW( LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage );
extern UINT MSI_SetTargetPathW( MSIPACKAGE *, LPCWSTR, LPCWSTR );

View file

@ -1327,7 +1327,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage)
MSIRECORD *data_row, *info_row;
UINT r;
WCHAR localfile[MAX_PATH], cachefile[MAX_PATH];
LPCWSTR file = szPackage;
LPCWSTR file = szPackage, mode;
DWORD index = 0;
MSISUMMARYINFO *si;
BOOL delete_on_close = FALSE;
@ -1405,7 +1405,8 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, DWORD dwOptions, MSIPACKAGE **pPackage)
product_version = get_product_version( db );
msiobj_release( &db->hdr );
TRACE("opening package %s\n", debugstr_w( localfile ));
r = MSI_OpenDatabaseW( localfile, MSIDBOPEN_TRANSACT, &db );
mode = (dwOptions & WINE_OPENPACKAGEFLAGS_READONLY) ? MSIDBOPEN_READONLY : MSIDBOPEN_TRANSACT;
r = MSI_OpenDatabaseW( localfile, mode, &db );
if (r != ERROR_SUCCESS)
{
free( product_version );

View file

@ -1270,7 +1270,6 @@ static void test_open_msi(MSIHANDLE hinst)
ok(hinst, result == 0, "Failed: %x\n", result);
result = MsiOpenDatabaseA(buffer, (LPCSTR)MSIDBOPEN_READONLY, &handle);
todo_wine
ok (hinst, result == 0, "Got %u\n", result);
MsiCloseHandle(handle);