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

msi: Make MsiDatabaseGetPrimaryKeys() RPC-compatible.

parent 3a1d9bb9
......@@ -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)
......
......@@ -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 );
......
......@@ -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);
}
......
......@@ -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 );
......
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