From 8026c070bc087dd300a9a8787caa46a2666b4167 Mon Sep 17 00:00:00 2001 From: Misha Koshelev Date: Mon, 30 Apr 2007 20:54:24 -0500 Subject: [PATCH] msi: automation: Implement Installer::OpenPackage. --- dlls/msi/automation.c | 53 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/dlls/msi/automation.c b/dlls/msi/automation.c index 84054c5b754..d9ca76d9118 100644 --- a/dlls/msi/automation.c +++ b/dlls/msi/automation.c @@ -861,3 +861,56 @@ static HRESULT WINAPI SessionImpl_Invoke( return S_OK; } + +static HRESULT WINAPI InstallerImpl_Invoke( + AutomationObject* This, + DISPID dispIdMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS* pDispParams, + VARIANT* pVarResult, + EXCEPINFO* pExcepInfo, + UINT* puArgErr) +{ + MSIHANDLE msiHandle; + IDispatch *pDispatch = NULL; + UINT ret; + VARIANTARG varg0, varg1; + HRESULT hr; + + VariantInit(&varg0); + VariantInit(&varg1); + + switch (dispIdMember) + { + case DISPID_INSTALLER_OPENPACKAGE: + if (wFlags & DISPATCH_METHOD) + { + hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr); + if (FAILED(hr)) return hr; + hr = DispGetParam(pDispParams, 1, VT_I4, &varg1, puArgErr); + if (FAILED(hr)) return hr; + V_VT(pVarResult) = VT_DISPATCH; + if ((ret = MsiOpenPackageExW(V_BSTR(&varg0), V_I4(&varg1), &msiHandle)) == ERROR_SUCCESS) + { + if (SUCCEEDED(create_automation_object(msiHandle, NULL, (LPVOID*)&pDispatch, &DIID_Session, SessionImpl_Invoke))) + { + IDispatch_AddRef(pDispatch); + V_DISPATCH(pVarResult) = pDispatch; + } + } + else + { + ERR("MsiOpenPackageEx returned %d\n", ret); + return DISP_E_EXCEPTION; + } + } + break; + + default: + return DISP_E_MEMBERNOTFOUND; + } + + return S_OK; +}