Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57343
This is what the Java JRE installer does:
- It calls MsiInstallProductW - this opens the msi read/write - The msi runs installer.exe - installer.exe tries to open the msi readonly
From: Fabian Maurer dark.shadow4@web.de
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57343 --- dlls/ieframe/ie.c | 6 ++++++ dlls/ieframe/ieframe.spec | 1 + 2 files changed, 7 insertions(+)
diff --git a/dlls/ieframe/ie.c b/dlls/ieframe/ie.c index e44178f3aaa..2e9503ab77a 100644 --- a/dlls/ieframe/ie.c +++ b/dlls/ieframe/ie.c @@ -875,3 +875,9 @@ void InternetExplorer_WebBrowser_Init(InternetExplorer *This) This->IExternalConnection_iface.lpVtbl = &ExternalConnectionVtbl; This->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl; } + +HRESULT WINAPI IERefreshElevationPolicy(void) +{ + FIXME("(): stub\n"); + return 0; +} diff --git a/dlls/ieframe/ieframe.spec b/dlls/ieframe/ieframe.spec index 27d73c5aa62..8205ea5198e 100644 --- a/dlls/ieframe/ieframe.spec +++ b/dlls/ieframe/ieframe.spec @@ -6,5 +6,6 @@ @ stdcall -private DllRegisterServer() @ stdcall -private DllUnregisterServer() @ stdcall IEGetWriteableHKCU(ptr) +@ stdcall IERefreshElevationPolicy() @ stdcall OpenURL(long long str long) @ stdcall SetQueryNetSessionCount(long)
From: Fabian Maurer dark.shadow4@web.de
--- dlls/msi/tests/custom.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index 8c5e7e4bbd0..3a3154da7da 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -1259,6 +1259,23 @@ static void test_view_get_error(MSIHANDLE hinst) MsiCloseHandle(db); }
+static void test_open_msi(MSIHANDLE hinst) +{ + MSIHANDLE handle = 0; + UINT result; + char buffer[300]; + DWORD len = sizeof(buffer); + + result = MsiGetPropertyA(hinst, "DATABASE", buffer, &len); + 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); +} + /* Main test. Anything that doesn't depend on a specific install configuration * or have undesired side effects should go here. */ UINT WINAPI main_test(MSIHANDLE hinst) @@ -1287,6 +1304,7 @@ UINT WINAPI main_test(MSIHANDLE hinst) test_costs(hinst); test_invalid_functions(hinst); test_view_get_error(hinst); + test_open_msi(hinst);
return ERROR_SUCCESS; }
From: Fabian Maurer dark.shadow4@web.de
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57343 --- dlls/msi/msi.c | 2 +- dlls/msi/msipriv.h | 1 + dlls/msi/package.c | 5 +++-- dlls/msi/tests/custom.c | 1 - 4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c index 2c0f3aa50f5..966bf8f98c6 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c @@ -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)); diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index e20ead557ce..b9eb4c502bf 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -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 ); diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 89b4c09dfa4..02775a16d4f 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -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 ); diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index 3a3154da7da..f0980274ce3 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -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);
We do open the file in read-only mode but the local copy created under windows/installer is opened read-write. Are you saying the installer locates this copy and tries to open it?
On Mon Nov 4 22:17:28 2024 +0000, Hans Leidekker wrote:
We do open the file in read-only mode but the local copy created under windows/installer is opened read-write. Are you saying the installer locates this copy and tries to open it?
Pretty sure it does exactly that.
``` 0304:trace:msi:MsiOpenDatabaseA "C:\windows\Installer\dbe7.msi" (null) 00007FFFFE1FEA50 ... 0304:warn:msi:MSI_OpenDatabaseW open failed r = 0x80030020 for L"C:\windows\Installer\dbe7.msi" ``` This call comes from application code, not from us.
My test case should prove this works on windows.
On Mon Nov 4 22:17:28 2024 +0000, Fabian Maurer wrote:
Pretty sure it does exactly that.
0304:trace:msi:MsiOpenDatabaseA "C:\\windows\\Installer\\dbe7.msi" (null) 00007FFFFE1FEA50 ... 0304:warn:msi:MSI_OpenDatabaseW open failed r = 0x80030020 for L"C:\\windows\\Installer\\dbe7.msi"
This call comes from application code, not from us. My test case should prove this works on windows.
Opening the local copy read-write may be needed to apply patches, I'm not sure.
On Mon Nov 4 22:28:36 2024 +0000, Hans Leidekker wrote:
Opening the local copy read-write may be needed to apply patches, I'm not sure.
That would be something we don't have tests for then, a bit difficult to deal with. Problem is that a file that is opened read/write (shared) can't opened readonly again, but in this case it can be opened readonly. So either we need to open it readonly to begin with (current state), or maybe open it read/write and handle it as readonly internally. Not sure how to test what windows does though.
On Mon Nov 4 22:41:59 2024 +0000, Fabian Maurer wrote:
That would be something we don't have tests for then, a bit difficult to deal with. Problem is that a file that is opened read/write (shared) can't opened readonly again, but in this case it can be opened readonly. So either we need to open it readonly to begin with (current state), or maybe open it read/write and handle it as readonly internally. Not sure how to test what windows does though.
MSI_OPEN_READONLY translates to STGM_DIRECT|STGM_READ|STGM_SHARE_DENY_WRITE and MSI_OPEN_TRANSACT translates to STSTGM_TRANSACTED|STGM_READWRITE|STGM_SHARE_DENY_WRITE. The app passes NULL for szPersist (read-only) which results in a sharing violation only for the latter case (which doesn't explicitly deny read-sharing). We should check if those storage flags are implemented correctly.
The app passes NULL for szPersist (read-only) which results in a sharing violation only for the latter case (which doesn't explicitly deny read-sharing). We should check if those storage flags are implemented correctly.
Not sure I understand what you mean. AFAIK the sharing violation happens because it's not allowed to use CreateFileW to open a file read only that was opened read/write shared, which is how windows behaves as well.
I think that the ieframe should be a separate MR.