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

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

    [WINESYNC] msi: Make MsiViewGetColumnInfo() 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 cea37419f1d16798ca24ad14712f14dac136f7d6 by Zebediah Figura 
<[email protected]>
---
 dll/win32/msi/msiquery.c                | 30 ++++++++++++++++++++++++++++--
 dll/win32/msi/winemsi.idl               |  2 ++
 modules/rostests/winetests/msi/custom.c | 12 ++++++++++++
 3 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/dll/win32/msi/msiquery.c b/dll/win32/msi/msiquery.c
index 682881ee716..e73701f9253 100644
--- a/dll/win32/msi/msiquery.c
+++ b/dll/win32/msi/msiquery.c
@@ -603,8 +603,23 @@ UINT WINAPI MsiViewGetColumnInfo(MSIHANDLE hView, 
MSICOLINFO info, MSIHANDLE *hR
         return ERROR_INVALID_PARAMETER;
 
     query = msihandle2msiinfo( hView, MSIHANDLETYPE_VIEW );
-    if( !query )
-        return ERROR_INVALID_HANDLE;
+    if (!query)
+    {
+        struct wire_record *wire_rec = NULL;
+        MSIHANDLE remote;
+
+        if (!(remote = msi_get_remote(hView)))
+            return ERROR_INVALID_HANDLE;
+
+        r = remote_ViewGetColumnInfo(remote, info, &wire_rec);
+        if (!r)
+        {
+            r = unmarshal_record(wire_rec, hRec);
+            free_remote_record(wire_rec);
+        }
+
+        return r;
+    }
 
     r = MSI_ViewGetColumnInfo( query, info, &rec );
     if ( r == ERROR_SUCCESS )
@@ -1091,3 +1106,14 @@ UINT __cdecl remote_ViewFetch(MSIHANDLE view, struct 
wire_record **rec)
     MsiCloseHandle(handle);
     return r;
 }
+
+UINT __cdecl remote_ViewGetColumnInfo(MSIHANDLE view, MSICOLINFO info, struct 
wire_record **rec)
+{
+    MSIHANDLE handle;
+    UINT r = MsiViewGetColumnInfo(view, info, &handle);
+    *rec = NULL;
+    if (!r)
+        *rec = marshal_record(handle);
+    MsiCloseHandle(handle);
+    return r;
+}
diff --git a/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl
index 74b59234793..628091b9b4c 100644
--- a/dll/win32/msi/winemsi.idl
+++ b/dll/win32/msi/winemsi.idl
@@ -27,6 +27,7 @@ typedef int INSTALLMESSAGE;
 typedef int MSICONDITION;
 typedef int MSIRUNMODE;
 typedef int INSTALLSTATE;
+typedef int MSICOLINFO;
 
 #define MSIFIELD_NULL   0
 #define MSIFIELD_INT    1
@@ -59,6 +60,7 @@ interface IWineMsiRemote
     UINT remote_ViewClose( [in] MSIHANDLE view );
     UINT remote_ViewExecute( [in] MSIHANDLE view, [in, unique] struct 
wire_record *record );
     UINT remote_ViewFetch( [in] MSIHANDLE view, [out] struct wire_record 
**record );
+    UINT remote_ViewGetColumnInfo( [in] MSIHANDLE view, [in] MSICOLINFO info, 
[out] 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 );
diff --git a/modules/rostests/winetests/msi/custom.c 
b/modules/rostests/winetests/msi/custom.c
index 3d7ebb99f34..d6b186c635a 100644
--- a/modules/rostests/winetests/msi/custom.c
+++ b/modules/rostests/winetests/msi/custom.c
@@ -263,6 +263,18 @@ static void test_db(MSIHANDLE hinst)
     r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `Test`", &view);
     ok(hinst, !r, "got %u\n", r);
 
+    r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec2);
+    ok(hinst, !r, "got %u\n", r);
+
+    sz = sizeof(buffer);
+    r = MsiRecordGetStringA(rec2, 1, buffer, &sz);
+    ok(hinst, !r, "got %u\n", r);
+    ok(hinst, sz == strlen(buffer), "got size %u\n", sz);
+    ok(hinst, !strcmp(buffer, "Name"), "got '%s'\n", buffer);
+
+    r = MsiCloseHandle(rec2);
+    ok(hinst, !r, "got %u\n", r);
+
     r = MsiViewExecute(view, 0);
     ok(hinst, !r, "got %u\n", r);
 

Reply via email to