Commit c6bd4d8c authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

msi: Make MsiDatabaseOpenView() RPC-compatible.

parent 252dd11f
......@@ -1923,8 +1923,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);
}
......@@ -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 );
......
......@@ -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);
}
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment