From 7a289624cfcbc829aabc614093bbd5ae01251529 Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Thu, 31 May 2007 19:49:52 -0700 Subject: [PATCH] msi: Implement Installer::OpenDatabase. --- dlls/msi/automation.c | 38 ++++++++++++++++++++++++++++++++++++ dlls/msi/msiserver.idl | 4 ++++ dlls/msi/msiserver_dispids.h | 1 + 3 files changed, 43 insertions(+) diff --git a/dlls/msi/automation.c b/dlls/msi/automation.c index 63fea99c1a3..be47cb69d54 100644 --- a/dlls/msi/automation.c +++ b/dlls/msi/automation.c @@ -1433,6 +1433,43 @@ static HRESULT WINAPI InstallerImpl_Invoke( else return DISP_E_MEMBERNOTFOUND; break; + case DISPID_INSTALLER_OPENDATABASE: + if (wFlags & DISPATCH_METHOD) + { + hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr); + if (FAILED(hr)) return hr; + + hr = DispGetParam(pDispParams, 1, VT_BSTR, &varg1, puArgErr); + if (FAILED(hr)) + { + VariantClear(&varg0); + return hr; + } + + V_VT(pVarResult) = VT_DISPATCH; + if ((ret = MsiOpenDatabaseW(V_BSTR(&varg0), V_BSTR(&varg1), &msiHandle)) == ERROR_SUCCESS) + { + hr = create_automation_object(msiHandle, NULL, (LPVOID *)&pDispatch, + &DIID_Database, DatabaseImpl_Invoke, NULL, 0); + if (SUCCEEDED(hr)) + { + IDispatch_AddRef(pDispatch); + V_DISPATCH(pVarResult) = pDispatch; + } + else + ERR("Failed to create Database object: 0x%08x\n", hr); + } + else + { + VariantClear(&varg0); + VariantClear(&varg1); + ERR("MsiOpenDatabase returned %d\n", ret); + return DISP_E_EXCEPTION; + } + } + else return DISP_E_MEMBERNOTFOUND; + break; + case DISPID_INSTALLER_INSTALLPRODUCT: if (wFlags & DISPATCH_METHOD) { @@ -1676,6 +1713,7 @@ static HRESULT WINAPI InstallerImpl_Invoke( break; default: + ERR("Member not found: %d\n", dispIdMember); return DISP_E_MEMBERNOTFOUND; } diff --git a/dlls/msi/msiserver.idl b/dlls/msi/msiserver.idl index 3c0428b2607..66a7e9d39a5 100644 --- a/dlls/msi/msiserver.idl +++ b/dlls/msi/msiserver.idl @@ -66,6 +66,10 @@ library WindowsInstaller Session* OpenPackage( [in] VARIANT PackagePath, [in, optional, defaultvalue(0)] long Options); + [id(DISPID_INSTALLER_OPENDATABASE)] + Database *OpenDatabase( + [in] BSTR DatabasePath, + [in] VARIANT OpenMode); [id(DISPID_INSTALLER_INSTALLPRODUCT)] void InstallProduct( [in] BSTR PackagePath, diff --git a/dlls/msi/msiserver_dispids.h b/dlls/msi/msiserver_dispids.h index 694090e1024..c3dd07a8300 100644 --- a/dlls/msi/msiserver_dispids.h +++ b/dlls/msi/msiserver_dispids.h @@ -18,6 +18,7 @@ #define DISPID_INSTALLER_CREATERECORD 1 #define DISPID_INSTALLER_OPENPACKAGE 2 +#define DISPID_INSTALLER_OPENDATABASE 3 #define DISPID_INSTALLER_INSTALLPRODUCT 8 #define DISPID_INSTALLER_REGISTRYVALUE 11 #define DISPID_INSTALLER_PRODUCTSTATE 17