dpnet: Correct GetComponentByName to return the correct buffer size.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alistair Leslie-Hughes 2016-10-13 10:07:08 +00:00 committed by Alexandre Julliard
parent c86d81d550
commit 7c609f07b4
2 changed files with 11 additions and 2 deletions

View File

@ -377,9 +377,9 @@ static HRESULT WINAPI IDirectPlay8AddressImpl_GetComponentByName(IDirectPlay8Add
struct component *entry;
DWORD i;
TRACE("(%p)->(%p %p %p %p)\n", This, pwszName, pvBuffer, pdwBufferSize, pdwDataType);
TRACE("(%p)->(%s %p %p %p)\n", This, debugstr_w(pwszName), pvBuffer, pdwBufferSize, pdwDataType);
if(!pwszName || !pdwBufferSize || !pdwDataType || (!pvBuffer && pdwBufferSize))
if(!pwszName || !pdwBufferSize || !pdwDataType || (!pvBuffer && *pdwBufferSize))
return E_POINTER;
for(i=0; i < This->comp_count; i++)

View File

@ -123,6 +123,15 @@ static void address_addcomponents(void)
hr = IDirectPlay8Address_AddComponent(localaddr, DPNA_KEY_HOSTNAME, &localhost, sizeof(localhost)+2, DPNA_DATATYPE_STRING);
ok(hr == DPNERR_INVALIDPARAM, "got 0x%08x\n", hr);
size = 0;
hr = IDirectPlay8Address_GetComponentByName(localaddr, DPNA_KEY_HOSTNAME, NULL, &size, &type);
ok(hr == DPNERR_BUFFERTOOSMALL, "got 0x%08x\n", hr);
ok(size == sizeof(localhost), "Invalid string length: %d\n", size);
size = 1;
hr = IDirectPlay8Address_GetComponentByName(localaddr, DPNA_KEY_HOSTNAME, NULL, &size, &type);
ok(hr == E_POINTER, "got 0x%08x\n", hr);
size = sizeof(buffer);
hr = IDirectPlay8Address_GetComponentByName(localaddr, DPNA_KEY_HOSTNAME, buffer, &size, &type);
ok(hr == S_OK, "got 0x%08x\n", hr);