msi: automation: Implement Installer::CreateRecord.

oldstable
Misha Koshelev 2007-05-11 14:07:58 -05:00 committed by Alexandre Julliard
parent 075e1898bf
commit 7eb3db632e
4 changed files with 42 additions and 15 deletions

View File

@ -1115,6 +1115,30 @@ static HRESULT WINAPI InstallerImpl_Invoke(
switch (dispIdMember)
{
case DISPID_INSTALLER_CREATERECORD:
if (wFlags & DISPATCH_METHOD)
{
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)))
{
IDispatch_AddRef(pDispatch);
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;
}
}
break;
case DISPID_INSTALLER_OPENPACKAGE:
if (wFlags & DISPATCH_METHOD)
{

View File

@ -59,6 +59,8 @@ library WindowsInstaller
{
properties:
methods:
[id(DISPID_INSTALLER_CREATERECORD)]
Record *CreateRecord([in] long Count);
[id(DISPID_INSTALLER_OPENPACKAGE)]
Session* OpenPackage(
[in] VARIANT PackagePath,

View File

@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define DISPID_INSTALLER_CREATERECORD 1
#define DISPID_INSTALLER_OPENPACKAGE 2
#define DISPID_INSTALLER_REGISTRYVALUE 11
#define DISPID_INSTALLER_PRODUCTSTATE 17

View File

@ -312,9 +312,7 @@ static DISPID get_dispid( IDispatch *disp, const char *name )
static void test_dispid(void)
{
todo_wine {
ok( get_dispid( pInstaller, "CreateRecord" ) == 1, "dispid wrong\n");
}
ok( get_dispid( pInstaller, "OpenPackage" ) == 2, "dispid wrong\n");
todo_wine {
ok( get_dispid( pInstaller, "OpenProduct" ) == 3, "dispid wrong\n");
@ -1350,25 +1348,27 @@ static void test_Installer(void)
if (!pInstaller) return;
/* Installer::CreateRecord */
todo_wine {
/* Test for error */
hr = Installer_CreateRecord(-1, &pRecord);
ok(hr == DISP_E_EXCEPTION, "Installer_CreateRecord failed, hresult 0x%08x\n", hr);
ok_exception(hr, szCreateRecordException);
/* Test for success */
hr = Installer_CreateRecord(1, &pRecord);
ok(SUCCEEDED(hr), "Installer_CreateRecord failed, hresult 0x%08x\n", hr);
ok(pRecord != NULL, "Installer_CreateRecord should not have returned NULL record\n");
}
/* Test for error */
hr = Installer_CreateRecord(-1, &pRecord);
ok(hr == DISP_E_EXCEPTION, "Installer_CreateRecord failed, hresult 0x%08x\n", hr);
ok_exception(hr, szCreateRecordException);
/* Test for success */
hr = Installer_CreateRecord(1, &pRecord);
ok(SUCCEEDED(hr), "Installer_CreateRecord failed, hresult 0x%08x\n", hr);
ok(pRecord != NULL, "Installer_CreateRecord should not have returned NULL record\n");
if (pRecord)
{
int iFieldCount = 0;
/* Record::FieldCountGet */
hr = Record_FieldCountGet(pRecord, &iFieldCount);
ok(SUCCEEDED(hr), "Record_FiledCountGet failed, hresult 0x%08x\n", hr);
ok(iFieldCount == 1, "Record_FieldCountGet result was %d but expected 1\n", iFieldCount);
todo_wine
{
hr = Record_FieldCountGet(pRecord, &iFieldCount);
ok(SUCCEEDED(hr), "Record_FiledCountGet failed, hresult 0x%08x\n", hr);
ok(iFieldCount == 1, "Record_FieldCountGet result was %d but expected 1\n", iFieldCount);
}
IDispatch_Release(pRecord);
}