https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ce495d7a38ee058588cd1a1895530c0204e5a1f1

commit ce495d7a38ee058588cd1a1895530c0204e5a1f1
Author:     winesync <[email protected]>
AuthorDate: Sat Mar 12 15:11:53 2022 +0100
Commit:     Mark Jansen <[email protected]>
CommitDate: Sun Mar 20 19:27:37 2022 +0100

    [WINESYNC] msi: Make MsiViewExecute() RPC-compatible.
    
    Signed-off-by: Zebediah Figura <[email protected]>
    Signed-off-by: Hans Leidekker <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id afb5eede24c35308d2370fd3b492545aed607ce6 by Zebediah Figura 
<[email protected]>
---
 dll/win32/msi/msiquery.c                | 39 +++++++++++++++++++++++++--------
 dll/win32/msi/record.c                  |  6 +++++
 dll/win32/msi/winemsi.idl               |  2 ++
 modules/rostests/winetests/msi/custom.c | 20 ++++++++++++++++-
 4 files changed, 57 insertions(+), 10 deletions(-)

diff --git a/dll/win32/msi/msiquery.c b/dll/win32/msi/msiquery.c
index 9518c5958ae..bfc239a53d5 100644
--- a/dll/win32/msi/msiquery.c
+++ b/dll/win32/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/dll/win32/msi/record.c b/dll/win32/msi/record.c
index 7b53d86edfe..4c504eac472 100644
--- a/dll/win32/msi/record.c
+++ b/dll/win32/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/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl
index 54e6eb890b3..e698f76e202 100644
--- a/dll/win32/msi/winemsi.idl
+++ b/dll/win32/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 );
diff --git a/modules/rostests/winetests/msi/custom.c 
b/modules/rostests/winetests/msi/custom.c
index e7a56ae1cee..8a0a20aff05 100644
--- a/modules/rostests/winetests/msi/custom.c
+++ b/modules/rostests/winetests/msi/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);
 

Reply via email to