diff --git a/dlls/ole32/antimoniker.c b/dlls/ole32/antimoniker.c index 9b021290217..ff2e2870703 100644 --- a/dlls/ole32/antimoniker.c +++ b/dlls/ole32/antimoniker.c @@ -540,19 +540,18 @@ static ULONG WINAPI AntiMonikerROTDataImpl_Release(IROTData* iface) * AntiMonikerIROTData_GetComparisonData ******************************************************************************/ static HRESULT WINAPI -AntiMonikerROTDataImpl_GetComparisonData(IROTData* iface, BYTE* pbData, - ULONG cbMax, ULONG* pcbData) +AntiMonikerROTDataImpl_GetComparisonData(IROTData *iface, BYTE *data, ULONG data_len, ULONG *data_req) { - 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); - if (cbMax < *pcbData) + *data_req = sizeof(CLSID) + sizeof(DWORD); + if (data_len < *data_req) return E_OUTOFMEMORY; - memcpy(pbData, &CLSID_AntiMoniker, sizeof(CLSID)); - memcpy(pbData+sizeof(CLSID), &constant, sizeof(DWORD)); + memcpy(data, &CLSID_AntiMoniker, sizeof(CLSID)); + memcpy(data + sizeof(CLSID), &moniker->count, sizeof(moniker->count)); return S_OK; } diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index 65cd279b1a7..5fff7041ef6 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -1412,11 +1412,27 @@ static const BYTE expected_anti_moniker_marshal_data[] = 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[] = { 0x01,0x00,0x00,0x00, }; +static const BYTE expected_anti_moniker_saved_data2[] = +{ + 0x02,0x00,0x00,0x00, +}; + static const BYTE expected_anti_moniker_comparison_data[] = { 0x05,0x03,0x00,0x00,0x00,0x00,0x00,0x00, @@ -1424,6 +1440,13 @@ static const BYTE expected_anti_moniker_comparison_data[] = 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[] = { 0x4d,0x45,0x4f,0x57,0x04,0x00,0x00,0x00, @@ -2330,6 +2353,12 @@ todo_wine hr = IMoniker_Load(moniker, stream); 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); ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);