Commit b73389b6 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Refactor the Installer.CreateRecord method into InstallerImpl_CreateRecord.

parent ae58e29e
...@@ -1534,6 +1534,39 @@ static void variant_from_registry_value(VARIANT *pVarResult, DWORD dwType, LPBYT ...@@ -1534,6 +1534,39 @@ static void variant_from_registry_value(VARIANT *pVarResult, DWORD dwType, LPBYT
} }
} }
static HRESULT InstallerImpl_CreateRecord(WORD wFlags,
DISPPARAMS* pDispParams,
VARIANT* pVarResult,
EXCEPINFO* pExcepInfo,
UINT* puArgErr)
{
HRESULT hr;
VARIANTARG varg0;
MSIHANDLE hrec;
IDispatch* dispatch;
if (!(wFlags & DISPATCH_METHOD))
return DISP_E_MEMBERNOTFOUND;
VariantInit(&varg0);
hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr);
if (FAILED(hr))
return hr;
V_VT(pVarResult) = VT_DISPATCH;
hrec = MsiCreateRecord(V_I4(&varg0));
if (!hrec)
return DISP_E_EXCEPTION;
hr = create_automation_object(hrec, NULL, (LPVOID*)&dispatch,
&DIID_Record, RecordImpl_Invoke, NULL, 0);
if (SUCCEEDED(hr))
V_DISPATCH(pVarResult) = dispatch;
return hr;
}
static HRESULT WINAPI InstallerImpl_Invoke( static HRESULT WINAPI InstallerImpl_Invoke(
AutomationObject* This, AutomationObject* This,
DISPID dispIdMember, DISPID dispIdMember,
...@@ -1561,26 +1594,8 @@ static HRESULT WINAPI InstallerImpl_Invoke( ...@@ -1561,26 +1594,8 @@ static HRESULT WINAPI InstallerImpl_Invoke(
switch (dispIdMember) switch (dispIdMember)
{ {
case DISPID_INSTALLER_CREATERECORD: case DISPID_INSTALLER_CREATERECORD:
if (wFlags & DISPATCH_METHOD) return InstallerImpl_CreateRecord(wFlags, pDispParams,
{ pVarResult, pExcepInfo, puArgErr);
hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr);
if (FAILED(hr)) return hr;
V_VT(pVarResult) = VT_DISPATCH;
if ((msiHandle = MsiCreateRecord(V_I4(&varg0))))
{
if (SUCCEEDED(hr = create_automation_object(msiHandle, NULL, (LPVOID*)&pDispatch, &DIID_Record, RecordImpl_Invoke, NULL, 0)))
V_DISPATCH(pVarResult) = pDispatch;
else
ERR("Failed to create Record object, hresult 0x%08x\n", hr);
}
else
{
ERR("MsiCreateRecord failed\n");
return DISP_E_EXCEPTION;
}
}
else return DISP_E_MEMBERNOTFOUND;
break;
case DISPID_INSTALLER_OPENPACKAGE: case DISPID_INSTALLER_OPENPACKAGE:
if (wFlags & DISPATCH_METHOD) if (wFlags & DISPATCH_METHOD)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment