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:
parent
c86d81d550
commit
7c609f07b4
|
@ -377,9 +377,9 @@ static HRESULT WINAPI IDirectPlay8AddressImpl_GetComponentByName(IDirectPlay8Add
|
||||||
struct component *entry;
|
struct component *entry;
|
||||||
DWORD i;
|
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;
|
return E_POINTER;
|
||||||
|
|
||||||
for(i=0; i < This->comp_count; i++)
|
for(i=0; i < This->comp_count; i++)
|
||||||
|
|
|
@ -123,6 +123,15 @@ static void address_addcomponents(void)
|
||||||
hr = IDirectPlay8Address_AddComponent(localaddr, DPNA_KEY_HOSTNAME, &localhost, sizeof(localhost)+2, DPNA_DATATYPE_STRING);
|
hr = IDirectPlay8Address_AddComponent(localaddr, DPNA_KEY_HOSTNAME, &localhost, sizeof(localhost)+2, DPNA_DATATYPE_STRING);
|
||||||
ok(hr == DPNERR_INVALIDPARAM, "got 0x%08x\n", hr);
|
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);
|
size = sizeof(buffer);
|
||||||
hr = IDirectPlay8Address_GetComponentByName(localaddr, DPNA_KEY_HOSTNAME, buffer, &size, &type);
|
hr = IDirectPlay8Address_GetComponentByName(localaddr, DPNA_KEY_HOSTNAME, buffer, &size, &type);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
|
Loading…
Reference in New Issue