https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9943fe3a6501b2c90e0b1…
commit 9943fe3a6501b2c90e0b14434cdb2473746f9382
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sat Mar 12 15:11:56 2022 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Mar 20 19:27:38 2022 +0100
[WINESYNC] msi: Make MsiDatabaseGetPrimaryKeys() 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 ed0a8dd3bfb5dbe6899cd1315c366d9fd833f060 by Zebediah Figura
<z.figura12(a)gmail.com>
---
dll/win32/msi/database.c | 11 ++++++++---
dll/win32/msi/msiquery.c | 15 ++++++---------
dll/win32/msi/winemsi.idl | 2 +-
modules/rostests/winetests/msi/custom.c | 22 ++++++++++++++++++++++
4 files changed, 37 insertions(+), 13 deletions(-)
diff --git a/dll/win32/msi/database.c b/dll/win32/msi/database.c
index 5ea4ec47261..26a274c9a84 100644
--- a/dll/win32/msi/database.c
+++ b/dll/win32/msi/database.c
@@ -2022,10 +2022,15 @@ MSICONDITION __cdecl remote_DatabaseIsTablePersistent(MSIHANDLE
db, LPCWSTR tabl
return MsiDatabaseIsTablePersistentW(db, table);
}
-HRESULT __cdecl remote_DatabaseGetPrimaryKeys(MSIHANDLE db, LPCWSTR table, MSIHANDLE
*keys)
+UINT __cdecl remote_DatabaseGetPrimaryKeys(MSIHANDLE db, LPCWSTR table, struct
wire_record **rec)
{
- UINT r = MsiDatabaseGetPrimaryKeysW(db, table, keys);
- return HRESULT_FROM_WIN32(r);
+ MSIHANDLE handle;
+ UINT r = MsiDatabaseGetPrimaryKeysW(db, table, &handle);
+ *rec = NULL;
+ if (!r)
+ *rec = marshal_record(handle);
+ MsiCloseHandle(handle);
+ return r;
}
HRESULT __cdecl remote_DatabaseGetSummaryInformation(MSIHANDLE db, UINT updatecount,
MSIHANDLE *suminfo)
diff --git a/dll/win32/msi/msiquery.c b/dll/win32/msi/msiquery.c
index e3bcfd86cc0..42ee8c79d02 100644
--- a/dll/win32/msi/msiquery.c
+++ b/dll/win32/msi/msiquery.c
@@ -998,23 +998,20 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysW( MSIHANDLE hdb,
db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE );
if( !db )
{
+ struct wire_record *wire_rec = NULL;
MSIHANDLE remote;
- HRESULT hr;
if (!(remote = msi_get_remote(hdb)))
return ERROR_INVALID_HANDLE;
- hr = remote_DatabaseGetPrimaryKeys(remote, table, phRec);
-
- if (FAILED(hr))
+ r = remote_DatabaseGetPrimaryKeys(remote, table, &wire_rec);
+ if (!r)
{
- if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
- return HRESULT_CODE(hr);
-
- return ERROR_FUNCTION_FAILED;
+ r = unmarshal_record(wire_rec, phRec);
+ free_remote_record(wire_rec);
}
- return ERROR_SUCCESS;
+ return r;
}
r = MSI_DatabaseGetPrimaryKeys( db, table, &rec );
diff --git a/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl
index 3fbd6d26a1d..28c3ab10003 100644
--- a/dll/win32/msi/winemsi.idl
+++ b/dll/win32/msi/winemsi.idl
@@ -66,7 +66,7 @@ interface IWineMsiRemote
[in] struct wire_record *record, [out] struct wire_record **refreshed );
MSICONDITION remote_DatabaseIsTablePersistent( [in] MSIHANDLE db, [in] LPCWSTR table
);
- HRESULT remote_DatabaseGetPrimaryKeys( [in] MSIHANDLE db, [in] LPCWSTR table, [out]
MSIHANDLE *keys );
+ UINT remote_DatabaseGetPrimaryKeys( [in] MSIHANDLE db, [in, string] LPCWSTR table,
[out] struct wire_record **keys );
HRESULT remote_DatabaseGetSummaryInformation( [in] MSIHANDLE db, [in] UINT
updatecount, [out] MSIHANDLE *suminfo );
UINT remote_DatabaseOpenView( [in] MSIHANDLE db, [in, string] LPCWSTR query, [out]
MSIHANDLE *view );
diff --git a/modules/rostests/winetests/msi/custom.c
b/modules/rostests/winetests/msi/custom.c
index 79d90f04233..cdefefd6cdd 100644
--- a/modules/rostests/winetests/msi/custom.c
+++ b/modules/rostests/winetests/msi/custom.c
@@ -391,6 +391,28 @@ static void test_db(MSIHANDLE hinst)
r = MsiCloseHandle(view);
ok(hinst, !r, "got %u\n", r);
+ /* test MsiDatabaseGetPrimaryKeys() */
+ r = MsiDatabaseGetPrimaryKeysA(hdb, "Test", &rec);
+ ok(hinst, !r, "got %u\n", r);
+
+ r = MsiRecordGetFieldCount(rec);
+ ok(hinst, r == 1, "got %d\n", r);
+
+ sz = sizeof(buffer);
+ r = MsiRecordGetStringA(rec, 0, buffer, &sz);
+ ok(hinst, !r, "got %u\n", r);
+ ok(hinst, sz == strlen(buffer), "got size %u\n", sz);
+ ok(hinst, !strcmp(buffer, "Test"), "got '%s'\n",
buffer);
+
+ sz = sizeof(buffer);
+ r = MsiRecordGetStringA(rec, 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(rec);
+ ok(hinst, !r, "got %u\n", r);
+
r = MsiCloseHandle(hdb);
ok(hinst, !r, "got %u\n", r);
}