Zebediah Figura : msi: Make MsiDatabaseIsTablePersistent() RPC-compatible.

Alexandre Julliard julliard at winehq.org
Thu Apr 19 16:54:19 CDT 2018


Module: wine
Branch: master
Commit: 252dd11f20a7ac2285d4f082f3ab3f3168f494dc
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=252dd11f20a7ac2285d4f082f3ab3f3168f494dc

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed Apr 18 18:40:03 2018 -0500

msi: Make MsiDatabaseIsTablePersistent() RPC-compatible.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msi/database.c      |  5 ++---
 dlls/msi/msiquery.c      |  9 +--------
 dlls/msi/tests/custom.c  |  3 +++
 dlls/msi/tests/install.c | 16 ++++++++++++++++
 dlls/msi/winemsi.idl     |  2 +-
 5 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/dlls/msi/database.c b/dlls/msi/database.c
index d3eb910..c1309a5 100644
--- a/dlls/msi/database.c
+++ b/dlls/msi/database.c
@@ -1906,10 +1906,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/dlls/msi/msiquery.c b/dlls/msi/msiquery.c
index 1ba3076..fb99c96 100644
--- a/dlls/msi/msiquery.c
+++ b/dlls/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/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c
index 00dcab3..0756994 100644
--- a/dlls/msi/tests/custom.c
+++ b/dlls/msi/tests/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/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 62fb81f..41a77cd 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/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)
diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl
index c158583..86f03e3 100644
--- a/dlls/msi/winemsi.idl
+++ b/dlls/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 );




More information about the wine-cvs mailing list