[Bug 60062] New: `Installer.OpenDatabase` automation method mishandles a numeric open mode (crashes KNX ETS 6 on setting a KNX-Secure project password)
http://bugs.winehq.org/show_bug.cgi?id=60062 Bug ID: 60062 Summary: `Installer.OpenDatabase` automation method mishandles a numeric open mode (crashes KNX ETS 6 on setting a KNX-Secure project password) Product: Wine Version: 11.13 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: msi Assignee: wine-bugs@list.winehq.org Reporter: Robert-Gerigk@online.de Target Milestone: --- Distribution: --- The `OpenDatabase` method of the Windows Installer automation object (`WindowsInstaller.Installer`, ProgID, CLSID `{000C1090-...}`) takes an `OpenMode` argument that is an integer from the `msiOpenDatabaseMode` enumeration (`msiOpenDatabaseModeReadOnly` = 0, `...Transact` = 1, `...Direct` = 2, `...Create` = 3). Wine's implementation in `dlls/msi/automation.c` (`InstallerImpl_OpenDatabase`) retrieves this argument as a `VT_BSTR`: DispGetParam(pDispParams, 1, VT_BSTR, &varg1, puArgErr); ... MsiOpenDatabaseW(V_BSTR(&varg0), V_BSTR(&varg1), &hdb); When the caller passes the mode as an integer (which is the normal case), the `VT_I4` value is coerced to a string, e.g. 0 becomes the string "0". `MsiOpenDatabase` does not recognise "0" as one of the `MSIDBOPEN_*` low-pointer constants, so it treats it as an *output path*: it copies the database to a file named "0" and opens that copy read/write in transacted mode, instead of opening the original read-only. **Impact — ETS 6 (KNX Association, https://www.knx.org):** ETS opens a device plug-in .msi package through this automation method with the read-only mode. Because of the bug the package is opened as a writable transacted copy instead of read-only, and adding a KNX-Secure device and setting the project password then terminates ETS silently. Building Wine with the fix below makes ETS open the package read-only again and the crash disappears. Tested with ETS Build 6.6.0.3998, .NET Framework 4.0.30319, Wine 11.13/11.14. **Steps to reproduce (minimal, without ETS):** Call the automation method with a numeric open mode: Set installer = CreateObject("WindowsInstaller.Installer") Set db = installer.OpenDatabase("some.msi", 0) ' msiOpenDatabaseModeReadOnly Expected: `db` is the database opened read-only; no side effects. Actual (Wine): the database is copied to a file named "0" in the current directory and opened read/write; the returned object is a writable copy, not a read-only view of the original. A `WINEDEBUG=+msi` trace shows the difference directly — the automation call ends up in `MSI_OpenDatabaseW ... L"0"` instead of `MSI_OpenDatabaseW ... (null)` (NULL = `MSIDBOPEN_READONLY`). Fix and Test is ready: https://gitlab.winehq.org/wine/wine/-/merge_requests/11472 https://gitlab.winehq.org/wine/wine/-/merge_requests/11473 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla