msi: Make MsiViewExecute() RPC-compatible.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2018-04-18 18:40:05 -05:00 committed by Alexandre Julliard
parent c6bd4d8c35
commit afb5eede24
4 changed files with 57 additions and 10 deletions

View File

@ -458,25 +458,32 @@ UINT WINAPI MsiViewExecute(MSIHANDLE hView, MSIHANDLE hRec)
TRACE("%d %d\n", hView, hRec);
query = msihandle2msiinfo( hView, MSIHANDLETYPE_VIEW );
if( !query )
return ERROR_INVALID_HANDLE;
if( hRec )
{
rec = msihandle2msiinfo( hRec, MSIHANDLETYPE_RECORD );
if( !rec )
{
ret = ERROR_INVALID_HANDLE;
goto out;
}
return ERROR_INVALID_HANDLE;
}
query = msihandle2msiinfo( hView, MSIHANDLETYPE_VIEW );
if( !query )
{
MSIHANDLE remote;
if (!(remote = msi_get_remote(hView)))
return ERROR_INVALID_HANDLE;
ret = remote_ViewExecute(remote, rec ? (struct wire_record *)&rec->count : NULL);
if (rec)
msiobj_release(&rec->hdr);
return ret;
}
msiobj_lock( &rec->hdr );
ret = MSI_ViewExecute( query, rec );
msiobj_unlock( &rec->hdr );
out:
msiobj_release( &query->hdr );
if( rec )
msiobj_release( &rec->hdr );
@ -1033,3 +1040,17 @@ MSICONDITION WINAPI MsiDatabaseIsTablePersistentW(
return r;
}
UINT __cdecl remote_ViewExecute(MSIHANDLE view, struct wire_record *remote_rec)
{
MSIHANDLE rec = 0;
UINT r;
if ((r = unmarshal_record(remote_rec, &rec)))
return r;
r = MsiViewExecute(view, rec);
MsiCloseHandle(rec);
return r;
}

View File

@ -1061,6 +1061,12 @@ UINT unmarshal_record(const struct wire_record *in, MSIHANDLE *out)
unsigned int i;
UINT r;
if (!in)
{
*out = 0;
return ERROR_SUCCESS;
}
rec = MSI_CreateRecord(in->count);
if (!rec) return ERROR_OUTOFMEMORY;

View File

@ -243,7 +243,7 @@ static void test_props(MSIHANDLE hinst)
static void test_db(MSIHANDLE hinst)
{
MSIHANDLE hdb, view;
MSIHANDLE hdb, view, rec;
UINT r;
hdb = MsiGetActiveDatabase(hinst);
@ -261,6 +261,24 @@ static void test_db(MSIHANDLE hinst)
r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `Test`", &view);
ok(hinst, !r, "got %u\n", r);
r = MsiViewExecute(view, 0);
ok(hinst, !r, "got %u\n", r);
r = MsiCloseHandle(view);
ok(hinst, !r, "got %u\n", r);
r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `Test` WHERE `Name` = ?", &view);
ok(hinst, !r, "got %u\n", r);
rec = MsiCreateRecord(1);
MsiRecordSetStringA(rec, 1, "one");
r = MsiViewExecute(view, rec);
ok(hinst, !r, "got %u\n", r);
r = MsiCloseHandle(rec);
ok(hinst, !r, "got %u\n", r);
r = MsiCloseHandle(view);
ok(hinst, !r, "got %u\n", r);

View File

@ -56,6 +56,8 @@ struct wire_record {
]
interface IWineMsiRemote
{
UINT remote_ViewExecute( [in] MSIHANDLE view, [in, unique] struct wire_record *record );
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 );