msi: Make MsiDatabaseGetPrimaryKeys() 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-19 23:44:17 -05:00 committed by Alexandre Julliard
parent 3a1d9bb915
commit ed0a8dd3bf
4 changed files with 37 additions and 13 deletions

View file

@ -1911,10 +1911,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)

View file

@ -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 );

View file

@ -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);
}

View file

@ -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 );