msi: Implement Installer::OpenDatabase.

This commit is contained in:
James Hawkins 2007-05-31 19:49:52 -07:00 committed by Alexandre Julliard
parent 60e95ee6e8
commit 7a289624cf
3 changed files with 43 additions and 0 deletions

View File

@ -1433,6 +1433,43 @@ static HRESULT WINAPI InstallerImpl_Invoke(
else return DISP_E_MEMBERNOTFOUND; else return DISP_E_MEMBERNOTFOUND;
break; 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: case DISPID_INSTALLER_INSTALLPRODUCT:
if (wFlags & DISPATCH_METHOD) if (wFlags & DISPATCH_METHOD)
{ {
@ -1676,6 +1713,7 @@ static HRESULT WINAPI InstallerImpl_Invoke(
break; break;
default: default:
ERR("Member not found: %d\n", dispIdMember);
return DISP_E_MEMBERNOTFOUND; return DISP_E_MEMBERNOTFOUND;
} }

View File

@ -66,6 +66,10 @@ library WindowsInstaller
Session* OpenPackage( Session* OpenPackage(
[in] VARIANT PackagePath, [in] VARIANT PackagePath,
[in, optional, defaultvalue(0)] long Options); [in, optional, defaultvalue(0)] long Options);
[id(DISPID_INSTALLER_OPENDATABASE)]
Database *OpenDatabase(
[in] BSTR DatabasePath,
[in] VARIANT OpenMode);
[id(DISPID_INSTALLER_INSTALLPRODUCT)] [id(DISPID_INSTALLER_INSTALLPRODUCT)]
void InstallProduct( void InstallProduct(
[in] BSTR PackagePath, [in] BSTR PackagePath,

View File

@ -18,6 +18,7 @@
#define DISPID_INSTALLER_CREATERECORD 1 #define DISPID_INSTALLER_CREATERECORD 1
#define DISPID_INSTALLER_OPENPACKAGE 2 #define DISPID_INSTALLER_OPENPACKAGE 2
#define DISPID_INSTALLER_OPENDATABASE 3
#define DISPID_INSTALLER_INSTALLPRODUCT 8 #define DISPID_INSTALLER_INSTALLPRODUCT 8
#define DISPID_INSTALLER_REGISTRYVALUE 11 #define DISPID_INSTALLER_REGISTRYVALUE 11
#define DISPID_INSTALLER_PRODUCTSTATE 17 #define DISPID_INSTALLER_PRODUCTSTATE 17