https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b4fb97827024f9c09e62b…
commit b4fb97827024f9c09e62b1784759d3e74e329ee8
Author:     winesync <ros-dev(a)reactos.org>
AuthorDate: Sat Mar 12 15:11:52 2022 +0100
Commit:     Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Mar 20 19:27:36 2022 +0100
    [WINESYNC] msi: Make MsiDatabaseIsTablePersistent() RPC-compatible.
    Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
    Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
    Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
    wine commit id 252dd11f20a7ac2285d4f082f3ab3f3168f494dc by Zebediah Figura
<z.figura12(a)gmail.com>
---
 dll/win32/msi/database.c                 |  5 ++---
 dll/win32/msi/msiquery.c                 |  9 +--------
 dll/win32/msi/winemsi.idl                |  2 +-
 modules/rostests/winetests/msi/custom.c  |  3 +++
 modules/rostests/winetests/msi/install.c | 16 ++++++++++++++++
 5 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/dll/win32/msi/database.c b/dll/win32/msi/database.c
index 08b47c05068..01680d8627f 100644
--- a/dll/win32/msi/database.c
+++ b/dll/win32/msi/database.c
@@ -2017,10 +2017,9 @@ MSIDBSTATE WINAPI MsiGetDatabaseState( MSIHANDLE handle )
     return ret;
 }
-HRESULT __cdecl remote_DatabaseIsTablePersistent(MSIHANDLE db, LPCWSTR table,
MSICONDITION *persistent)
+MSICONDITION __cdecl remote_DatabaseIsTablePersistent(MSIHANDLE db, LPCWSTR table)
 {
-    *persistent = MsiDatabaseIsTablePersistentW(db, table);
-    return S_OK;
+    return MsiDatabaseIsTablePersistentW(db, table);
 }
 HRESULT __cdecl remote_DatabaseGetPrimaryKeys(MSIHANDLE db, LPCWSTR table, MSIHANDLE
*keys)
diff --git a/dll/win32/msi/msiquery.c b/dll/win32/msi/msiquery.c
index 1ba30763f71..fb99c961b2b 100644
--- a/dll/win32/msi/msiquery.c
+++ b/dll/win32/msi/msiquery.c
@@ -1024,19 +1024,12 @@ MSICONDITION WINAPI MsiDatabaseIsTablePersistentW(
     db = msihandle2msiinfo( hDatabase, MSIHANDLETYPE_DATABASE );
     if( !db )
     {
-        HRESULT hr;
-        MSICONDITION condition;
         MSIHANDLE remote;
         if (!(remote = msi_get_remote(hDatabase)))
             return MSICONDITION_ERROR;
-        hr = remote_DatabaseIsTablePersistent(remote, szTableName, &condition);
-
-        if (FAILED(hr))
-            return MSICONDITION_ERROR;
-
-        return condition;
+        return remote_DatabaseIsTablePersistent(remote, szTableName);
     }
     r = MSI_DatabaseIsTablePersistent( db, szTableName );
diff --git a/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl
index c1585834db8..86f03e3daa0 100644
--- a/dll/win32/msi/winemsi.idl
+++ b/dll/win32/msi/winemsi.idl
@@ -56,7 +56,7 @@ struct wire_record {
 ]
 interface IWineMsiRemote
 {
-    HRESULT remote_DatabaseIsTablePersistent( [in] MSIHANDLE db, [in] LPCWSTR table,
[out] MSICONDITION *persistent );
+    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 );
     HRESULT remote_DatabaseOpenView( [in] MSIHANDLE db, [in] LPCWSTR query, [out]
MSIHANDLE *view );
diff --git a/modules/rostests/winetests/msi/custom.c
b/modules/rostests/winetests/msi/custom.c
index 00dcab36b0d..07569946623 100644
--- a/modules/rostests/winetests/msi/custom.c
+++ b/modules/rostests/winetests/msi/custom.c
@@ -249,6 +249,9 @@ static void test_db(MSIHANDLE hinst)
     hdb = MsiGetActiveDatabase(hinst);
     ok(hinst, hdb, "MsiGetActiveDatabase failed\n");
+    r = MsiDatabaseIsTablePersistentA(hdb, "Test");
+    ok(hinst, r == MSICONDITION_TRUE, "got %u\n", r);
+
     r = MsiCloseHandle(hdb);
     ok(hinst, !r, "got %u\n", r);
 }
diff --git a/modules/rostests/winetests/msi/install.c
b/modules/rostests/winetests/msi/install.c
index 62fb81f9fc4..41a77cdb4ed 100644
--- a/modules/rostests/winetests/msi/install.c
+++ b/modules/rostests/winetests/msi/install.c
@@ -4108,11 +4108,25 @@ static INT CALLBACK ok_callback(void *context, UINT message_type,
MSIHANDLE reco
 static void test_customaction1(void)
 {
+    MSIHANDLE hdb, record;
     UINT r;
     create_database(msifile, ca1_tables, sizeof(ca1_tables) / sizeof(msi_table));
     add_custom_dll();
+    /* create a test table */
+    MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb);
+    run_query(hdb, 0, "CREATE TABLE `Test` (`Name` CHAR(10), `Number` INTEGER,
`Data` OBJECT PRIMARY KEY `Name`)");
+    create_file("unus", 10);
+    create_file("duo", 10);
+    record = MsiCreateRecord(1);
+    MsiRecordSetStreamA(record, 1, "unus");
+    run_query(hdb, record, "INSERT INTO `Test` (`Name`, `Number`, `Data`) VALUES
('one', 1, ?)");
+    MsiRecordSetStreamA(record, 1, "duo");
+    run_query(hdb, record, "INSERT INTO `Test` (`Name`, `Number`, `Data`) VALUES
('two', 2, ?)");
+    MsiDatabaseCommit(hdb);
+    MsiCloseHandle(hdb);
+
     MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
     r = MsiInstallProductA(msifile, "MAIN_TEST=1");
@@ -4136,6 +4150,8 @@ static void test_customaction1(void)
     ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n",
r);
     DeleteFileA(msifile);
+    DeleteFileA("unus");
+    DeleteFileA("duo");
 }
 static void test_customaction51(void)