[PATCH 5/6] msi: Make MsiViewExecute() RPC-compatible.

Zebediah Figura z.figura12 at gmail.com
Wed Apr 18 18:40:05 CDT 2018


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/msi/msiquery.c     | 39 ++++++++++++++++++++++++++++++---------
 dlls/msi/record.c       |  6 ++++++
 dlls/msi/tests/custom.c | 20 +++++++++++++++++++-
 dlls/msi/winemsi.idl    |  2 ++
 4 files changed, 57 insertions(+), 10 deletions(-)

diff --git a/dlls/msi/msiquery.c b/dlls/msi/msiquery.c
index 9518c59..bfc239a 100644
--- a/dlls/msi/msiquery.c
+++ b/dlls/msi/msiquery.c
@@ -458,25 +458,32 @@ UINT WINAPI MsiViewExecute(MSIHANDLE hView, MSIHANDLE hRec)
     
     TRACE("%d %d\n", hView, hRec);
 
-    query = msihandle2msiinfo( hView, MSIHANDLETYPE_VIEW );
-    if( !query )
-        return ERROR_INVALID_HANDLE;
-
     if( hRec )
     {
         rec = msihandle2msiinfo( hRec, MSIHANDLETYPE_RECORD );
         if( !rec )
-        {
-            ret = ERROR_INVALID_HANDLE;
-            goto out;
-        }
+            return ERROR_INVALID_HANDLE;
+    }
+
+    query = msihandle2msiinfo( hView, MSIHANDLETYPE_VIEW );
+    if( !query )
+    {
+        MSIHANDLE remote;
+
+        if (!(remote = msi_get_remote(hView)))
+            return ERROR_INVALID_HANDLE;
+
+        ret = remote_ViewExecute(remote, rec ? (struct wire_record *)&rec->count : NULL);
+
+        if (rec)
+            msiobj_release(&rec->hdr);
+        return ret;
     }
 
     msiobj_lock( &rec->hdr );
     ret = MSI_ViewExecute( query, rec );
     msiobj_unlock( &rec->hdr );
 
-out:
     msiobj_release( &query->hdr );
     if( rec )
         msiobj_release( &rec->hdr );
@@ -1033,3 +1040,17 @@ MSICONDITION WINAPI MsiDatabaseIsTablePersistentW(
 
     return r;
 }
+
+UINT __cdecl remote_ViewExecute(MSIHANDLE view, struct wire_record *remote_rec)
+{
+    MSIHANDLE rec = 0;
+    UINT r;
+
+    if ((r = unmarshal_record(remote_rec, &rec)))
+        return r;
+
+    r = MsiViewExecute(view, rec);
+
+    MsiCloseHandle(rec);
+    return r;
+}
diff --git a/dlls/msi/record.c b/dlls/msi/record.c
index 7b53d86..4c504ea 100644
--- a/dlls/msi/record.c
+++ b/dlls/msi/record.c
@@ -1061,6 +1061,12 @@ UINT unmarshal_record(const struct wire_record *in, MSIHANDLE *out)
     unsigned int i;
     UINT r;
 
+    if (!in)
+    {
+        *out = 0;
+        return ERROR_SUCCESS;
+    }
+
     rec = MSI_CreateRecord(in->count);
     if (!rec) return ERROR_OUTOFMEMORY;
 
diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c
index e7a56ae..8a0a20a 100644
--- a/dlls/msi/tests/custom.c
+++ b/dlls/msi/tests/custom.c
@@ -243,7 +243,7 @@ static void test_props(MSIHANDLE hinst)
 
 static void test_db(MSIHANDLE hinst)
 {
-    MSIHANDLE hdb, view;
+    MSIHANDLE hdb, view, rec;
     UINT r;
 
     hdb = MsiGetActiveDatabase(hinst);
@@ -261,6 +261,24 @@ static void test_db(MSIHANDLE hinst)
     r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `Test`", &view);
     ok(hinst, !r, "got %u\n", r);
 
+    r = MsiViewExecute(view, 0);
+    ok(hinst, !r, "got %u\n", r);
+
+    r = MsiCloseHandle(view);
+    ok(hinst, !r, "got %u\n", r);
+
+    r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `Test` WHERE `Name` = ?", &view);
+    ok(hinst, !r, "got %u\n", r);
+
+    rec = MsiCreateRecord(1);
+    MsiRecordSetStringA(rec, 1, "one");
+
+    r = MsiViewExecute(view, rec);
+    ok(hinst, !r, "got %u\n", r);
+
+    r = MsiCloseHandle(rec);
+    ok(hinst, !r, "got %u\n", r);
+
     r = MsiCloseHandle(view);
     ok(hinst, !r, "got %u\n", r);
 
diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl
index 54e6eb8..e698f76 100644
--- a/dlls/msi/winemsi.idl
+++ b/dlls/msi/winemsi.idl
@@ -56,6 +56,8 @@ struct wire_record {
 ]
 interface IWineMsiRemote
 {
+    UINT remote_ViewExecute( [in] MSIHANDLE view, [in, unique] struct wire_record *record );
+
     MSICONDITION remote_DatabaseIsTablePersistent( [in] MSIHANDLE db, [in] LPCWSTR table );
     HRESULT remote_DatabaseGetPrimaryKeys( [in] MSIHANDLE db, [in] LPCWSTR table, [out] MSIHANDLE *keys );
     HRESULT remote_DatabaseGetSummaryInformation( [in] MSIHANDLE db, [in] UINT updatecount, [out] MSIHANDLE *suminfo );
-- 
2.7.4




More information about the wine-devel mailing list