ole32: Fix comparison data for antimoniker.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-01-24 12:21:30 +03:00 committed by Alexandre Julliard
parent 9a4959de4a
commit 31f5f9da80
2 changed files with 36 additions and 8 deletions

View File

@ -540,19 +540,18 @@ static ULONG WINAPI AntiMonikerROTDataImpl_Release(IROTData* iface)
* AntiMonikerIROTData_GetComparisonData * AntiMonikerIROTData_GetComparisonData
******************************************************************************/ ******************************************************************************/
static HRESULT WINAPI static HRESULT WINAPI
AntiMonikerROTDataImpl_GetComparisonData(IROTData* iface, BYTE* pbData, AntiMonikerROTDataImpl_GetComparisonData(IROTData *iface, BYTE *data, ULONG data_len, ULONG *data_req)
ULONG cbMax, ULONG* pcbData)
{ {
DWORD constant = 1; AntiMonikerImpl *moniker = impl_from_IROTData(iface);
TRACE("(%p, %u, %p)\n", pbData, cbMax, pcbData); TRACE("%p, %p, %u, %p.\n", iface, data, data_len, data_req);
*pcbData = sizeof(CLSID) + sizeof(DWORD); *data_req = sizeof(CLSID) + sizeof(DWORD);
if (cbMax < *pcbData) if (data_len < *data_req)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy(pbData, &CLSID_AntiMoniker, sizeof(CLSID)); memcpy(data, &CLSID_AntiMoniker, sizeof(CLSID));
memcpy(pbData+sizeof(CLSID), &constant, sizeof(DWORD)); memcpy(data + sizeof(CLSID), &moniker->count, sizeof(moniker->count));
return S_OK; return S_OK;
} }

View File

@ -1412,11 +1412,27 @@ static const BYTE expected_anti_moniker_marshal_data[] =
0x01,0x00,0x00,0x00, 0x01,0x00,0x00,0x00,
}; };
static const BYTE expected_anti_moniker_marshal_data2[] =
{
0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00,
0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x05,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,
0x02,0x00,0x00,0x00,
};
static const BYTE expected_anti_moniker_saved_data[] = static const BYTE expected_anti_moniker_saved_data[] =
{ {
0x01,0x00,0x00,0x00, 0x01,0x00,0x00,0x00,
}; };
static const BYTE expected_anti_moniker_saved_data2[] =
{
0x02,0x00,0x00,0x00,
};
static const BYTE expected_anti_moniker_comparison_data[] = static const BYTE expected_anti_moniker_comparison_data[] =
{ {
0x05,0x03,0x00,0x00,0x00,0x00,0x00,0x00, 0x05,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
@ -1424,6 +1440,13 @@ static const BYTE expected_anti_moniker_comparison_data[] =
0x01,0x00,0x00,0x00, 0x01,0x00,0x00,0x00,
}; };
static const BYTE expected_anti_moniker_comparison_data2[] =
{
0x05,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,
0x02,0x00,0x00,0x00,
};
static const BYTE expected_gc_moniker_marshal_data[] = static const BYTE expected_gc_moniker_marshal_data[] =
{ {
0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00, 0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00,
@ -2330,6 +2353,12 @@ todo_wine
hr = IMoniker_Load(moniker, stream); hr = IMoniker_Load(moniker, stream);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
test_moniker("anti moniker 2", moniker,
expected_anti_moniker_marshal_data2, sizeof(expected_anti_moniker_marshal_data2),
expected_anti_moniker_saved_data2, sizeof(expected_anti_moniker_saved_data2),
expected_anti_moniker_comparison_data2, sizeof(expected_anti_moniker_comparison_data2),
20, L"\\..\\..");
hr = IMoniker_IsEqual(moniker, moniker2); hr = IMoniker_IsEqual(moniker, moniker2);
ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr); ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);