https://git.reactos.org/?p=reactos.git;a=commitdiff;h=00684fb4104d5591a4046…
commit 00684fb4104d5591a40460042cdd37367eb80ef5
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:37 2022 +0100
[WINESYNC] msi: Make MsiDatabaseOpenView() 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 c6bd4d8c35de1ae452a5b5bec69d4779c813b37f by Zebediah Figura
<z.figura12(a)gmail.com>
---
dll/win32/msi/database.c | 5 ++---
dll/win32/msi/msiquery.c | 27 +++++++++++----------------
dll/win32/msi/winemsi.idl | 2 +-
modules/rostests/winetests/msi/custom.c | 14 +++++++++++++-
4 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/dll/win32/msi/database.c b/dll/win32/msi/database.c
index 01680d8627f..5ea4ec47261 100644
--- a/dll/win32/msi/database.c
+++ b/dll/win32/msi/database.c
@@ -2034,8 +2034,7 @@ HRESULT __cdecl remote_DatabaseGetSummaryInformation(MSIHANDLE db,
UINT updateco
return HRESULT_FROM_WIN32(r);
}
-HRESULT __cdecl remote_DatabaseOpenView(MSIHANDLE db, LPCWSTR query, MSIHANDLE *view)
+UINT __cdecl remote_DatabaseOpenView(MSIHANDLE db, LPCWSTR query, MSIHANDLE *view)
{
- UINT r = MsiDatabaseOpenViewW(db, query, view);
- return HRESULT_FROM_WIN32(r);
+ return MsiDatabaseOpenViewW(db, query, view);
}
diff --git a/dll/win32/msi/msiquery.c b/dll/win32/msi/msiquery.c
index fb99c961b2b..9518c5958ae 100644
--- a/dll/win32/msi/msiquery.c
+++ b/dll/win32/msi/msiquery.c
@@ -116,9 +116,6 @@ UINT MSI_DatabaseOpenViewW(MSIDATABASE *db,
TRACE("%s %p\n", debugstr_w(szQuery), pView);
- if( !szQuery)
- return ERROR_INVALID_PARAMETER;
-
/* pre allocate a handle to hold a pointer to the view */
query = alloc_msiobject( MSIHANDLETYPE_VIEW, sizeof (MSIQUERY),
MSI_CloseView );
@@ -247,26 +244,24 @@ UINT WINAPI MsiDatabaseOpenViewW(MSIHANDLE hdb,
TRACE("%s %p\n", debugstr_w(szQuery), phView);
+ if (!phView)
+ return ERROR_INVALID_PARAMETER;
+
+ if (!szQuery)
+ return ERROR_BAD_QUERY_SYNTAX;
+
db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE );
if( !db )
{
- MSIHANDLE remote;
- HRESULT hr;
+ MSIHANDLE remote, remote_view;
if (!(remote = msi_get_remote(hdb)))
return ERROR_INVALID_HANDLE;
- hr = remote_DatabaseOpenView(remote, szQuery, phView);
-
- if (FAILED(hr))
- {
- if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
- return HRESULT_CODE(hr);
-
- return ERROR_FUNCTION_FAILED;
- }
-
- return ERROR_SUCCESS;
+ ret = remote_DatabaseOpenView(remote, szQuery, &remote_view);
+ if (!ret)
+ *phView = alloc_msi_remote_handle(remote_view);
+ return ret;
}
ret = MSI_DatabaseOpenViewW( db, szQuery, &query );
diff --git a/dll/win32/msi/winemsi.idl b/dll/win32/msi/winemsi.idl
index 86f03e3daa0..54e6eb890b3 100644
--- a/dll/win32/msi/winemsi.idl
+++ b/dll/win32/msi/winemsi.idl
@@ -59,7 +59,7 @@ interface IWineMsiRemote
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 );
+ UINT remote_DatabaseOpenView( [in] MSIHANDLE db, [in, string] LPCWSTR query, [out]
MSIHANDLE *view );
MSIHANDLE remote_GetActiveDatabase( [in] MSIHANDLE hinst );
UINT remote_GetProperty( [in] MSIHANDLE hinst, [in, string] LPCWSTR property, [out,
string] LPWSTR *value, [out] DWORD *size );
diff --git a/modules/rostests/winetests/msi/custom.c
b/modules/rostests/winetests/msi/custom.c
index 07569946623..e7a56ae1cee 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;
+ MSIHANDLE hdb, view;
UINT r;
hdb = MsiGetActiveDatabase(hinst);
@@ -252,6 +252,18 @@ static void test_db(MSIHANDLE hinst)
r = MsiDatabaseIsTablePersistentA(hdb, "Test");
ok(hinst, r == MSICONDITION_TRUE, "got %u\n", r);
+ r = MsiDatabaseOpenViewA(hdb, NULL, &view);
+ ok(hinst, r == ERROR_BAD_QUERY_SYNTAX, "got %u\n", r);
+
+ r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `Test`", NULL);
+ ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
+
+ r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `Test`", &view);
+ ok(hinst, !r, "got %u\n", r);
+
+ r = MsiCloseHandle(view);
+ ok(hinst, !r, "got %u\n", r);
+
r = MsiCloseHandle(hdb);
ok(hinst, !r, "got %u\n", r);
}