Misha Koshelev : msi: automation: Implement Installer::CreateRecord.

Alexandre Julliard julliard at wine.codeweavers.com
Mon May 14 10:52:45 CDT 2007


Module: wine
Branch: master
Commit: 7eb3db632e592a05ff209b6965d13d2e5b8bdc63
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7eb3db632e592a05ff209b6965d13d2e5b8bdc63

Author: Misha Koshelev <mk144210 at bcm.edu>
Date:   Fri May 11 14:07:58 2007 -0500

msi: automation: Implement Installer::CreateRecord.

---

 dlls/msi/automation.c        |   24 ++++++++++++++++++++++++
 dlls/msi/msiserver.idl       |    2 ++
 dlls/msi/msiserver_dispids.h |    1 +
 dlls/msi/tests/automation.c  |   32 ++++++++++++++++----------------
 4 files changed, 43 insertions(+), 16 deletions(-)

diff --git a/dlls/msi/automation.c b/dlls/msi/automation.c
index 56f163a..d871fa2 100644
--- a/dlls/msi/automation.c
+++ b/dlls/msi/automation.c
@@ -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)
 	    {
diff --git a/dlls/msi/msiserver.idl b/dlls/msi/msiserver.idl
index cd6621f..e02f194 100644
--- a/dlls/msi/msiserver.idl
+++ b/dlls/msi/msiserver.idl
@@ -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,
diff --git a/dlls/msi/msiserver_dispids.h b/dlls/msi/msiserver_dispids.h
index e85f750..b65726e 100644
--- a/dlls/msi/msiserver_dispids.h
+++ b/dlls/msi/msiserver_dispids.h
@@ -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
diff --git a/dlls/msi/tests/automation.c b/dlls/msi/tests/automation.c
index cbe48d0..5a34459 100644
--- a/dlls/msi/tests/automation.c
+++ b/dlls/msi/tests/automation.c
@@ -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);
     }




More information about the wine-cvs mailing list