dpnet: Add basic validation in IDirectPlay8Client EnumHosts.

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 2017-02-15 04:36:03 +00:00 committed by Alexandre Julliard
parent db1d194078
commit 6eb0015d08
3 changed files with 24 additions and 12 deletions

View File

@ -144,9 +144,21 @@ static HRESULT WINAPI IDirectPlay8ClientImpl_EnumHosts(IDirectPlay8Client *iface
const DWORD dwTimeOut, void * const pvUserContext, DPNHANDLE * const pAsyncHandle,
const DWORD dwFlags)
{
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
FIXME("(%p):(%p,%p,%x): Stub\n", This, pvUserContext, pAsyncHandle, dwFlags);
return DPN_OK;
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
FIXME("(%p):(%p,%p,%p,%p,%u,%u,%u,%u,%p,%p,%x)\n", This, pApplicationDesc, pAddrHost, pDeviceInfo, pUserEnumData,
dwUserEnumDataSize, dwEnumCount, dwRetryInterval, dwTimeOut, pvUserContext, pAsyncHandle, dwFlags);
if(!This->msghandler)
return DPNERR_UNINITIALIZED;
if((dwFlags & DPNENUMHOSTS_SYNC) && pAsyncHandle)
return DPNERR_INVALIDPARAM;
if(dwUserEnumDataSize > This->spcaps.dwMaxEnumPayloadSize)
return DPNERR_ENUMQUERYTOOLARGE;
return (dwFlags & DPNENUMHOSTS_SYNC) ? DPN_OK : DPNSUCCESS_PENDING;
}
static HRESULT WINAPI IDirectPlay8ClientImpl_CancelAsyncOperation(IDirectPlay8Client *iface,

View File

@ -254,22 +254,22 @@ static void test_enum_hosts(void)
data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, caps.dwMaxEnumPayloadSize + 1);
hr = IDirectPlay8Client_EnumHosts(client, &appdesc, host, local, NULL, 0, 2, 1000, 1000, NULL, &async, DPNENUMHOSTS_SYNC);
todo_wine ok(hr == DPNERR_INVALIDPARAM, "got 0x%08x\n", hr);
ok(hr == DPNERR_INVALIDPARAM, "got 0x%08x\n", hr);
hr = IDirectPlay8Client_EnumHosts(client, &appdesc, host, local, data, caps.dwMaxEnumPayloadSize + 1,
INFINITE, 0, INFINITE, NULL, &async, DPNENUMHOSTS_SYNC);
todo_wine ok(hr == DPNERR_INVALIDPARAM, "got 0x%08x\n", hr);
ok(hr == DPNERR_INVALIDPARAM, "got 0x%08x\n", hr);
async = 0;
hr = IDirectPlay8Client_EnumHosts(client, &appdesc, host, local, data, caps.dwMaxEnumPayloadSize + 1, INFINITE, 0,
INFINITE, NULL, &async, 0);
todo_wine ok(hr == DPNERR_ENUMQUERYTOOLARGE, "got 0x%08x\n", hr);
ok(hr == DPNERR_ENUMQUERYTOOLARGE, "got 0x%08x\n", hr);
ok(!async, "Handle returned\n");
async = 0;
hr = IDirectPlay8Client_EnumHosts(client, &appdesc, host, local, data, caps.dwMaxEnumPayloadSize, INFINITE, 0, INFINITE,
NULL, &async, 0);
todo_wine ok(hr == DPNSUCCESS_PENDING, "got 0x%08x\n", hr);
ok(hr == DPNSUCCESS_PENDING, "got 0x%08x\n", hr);
todo_wine ok(async, "No Handle returned\n");
/* This CancelAsyncOperation doesn't generate a DPN_MSGID_ASYNC_OP_COMPLETE */
@ -279,15 +279,15 @@ static void test_enum_hosts(void)
/* No Initialize has been called on client2. */
hr = IDirectPlay8Client_EnumHosts(client2, &appdesc, host, local, NULL, 0, INFINITE, 0, INFINITE, NULL, &async, 0);
todo_wine ok(hr == DPNERR_UNINITIALIZED, "IDirectPlay8Client_EnumHosts failed with 0x%08x\n", hr);
ok(hr == DPNERR_UNINITIALIZED, "IDirectPlay8Client_EnumHosts failed with 0x%08x\n", hr);
/* Since we are running asynchronously, EnumHosts returns DPNSUCCESS_PENDING. */
hr = IDirectPlay8Client_EnumHosts(client, &appdesc, host, local, NULL, 0, INFINITE, 0, INFINITE, NULL, &async, 0);
todo_wine ok(hr == DPNSUCCESS_PENDING, "IDirectPlay8Client_EnumHosts failed with 0x%08x\n", hr);
ok(hr == DPNSUCCESS_PENDING, "IDirectPlay8Client_EnumHosts failed with 0x%08x\n", hr);
todo_wine ok(async, "No Handle returned\n");
hr = IDirectPlay8Client_EnumHosts(client, &appdesc, host, local, NULL, 0, INFINITE, 0, INFINITE, NULL, &async2, 0);
todo_wine ok(hr == DPNSUCCESS_PENDING, "IDirectPlay8Client_EnumHosts failed with 0x%08x\n", hr);
ok(hr == DPNSUCCESS_PENDING, "IDirectPlay8Client_EnumHosts failed with 0x%08x\n", hr);
todo_wine ok(async2, "No Handle returned\n");
todo_wine ok(async2 != async, "Same handle returned.\n");

View File

@ -164,7 +164,7 @@ static void test_enum_hosts(void)
ok(hr == S_OK, "IDirectPlay8Address failed with 0x%08x\n", hr);
hr = IDirectPlay8Client_EnumHosts(client, &appdesc, host, local, NULL, 0, INFINITE, 0, INFINITE, NULL, &async, 0);
todo_wine ok(hr == DPNSUCCESS_PENDING, "IDirectPlay8Client_EnumHosts failed with 0x%08x\n", hr);
ok(hr == DPNSUCCESS_PENDING, "IDirectPlay8Client_EnumHosts failed with 0x%08x\n", hr);
todo_wine ok(async, "No Handle returned\n");
hr = IDirectPlay8ThreadPool_GetThreadCount(pool1, -1, &threadcnt, 0);
@ -172,7 +172,7 @@ static void test_enum_hosts(void)
todo_wine ok(threadcnt == 6, "got %d\n", threadcnt);
hr = IDirectPlay8Client_EnumHosts(client, &appdesc, host, local, NULL, 0, INFINITE, 0, INFINITE, NULL, &async2, 0);
todo_wine ok(hr == DPNSUCCESS_PENDING, "IDirectPlay8Client_EnumHosts failed with 0x%08x\n", hr);
ok(hr == DPNSUCCESS_PENDING, "IDirectPlay8Client_EnumHosts failed with 0x%08x\n", hr);
WaitForSingleObject(enumevent, 1000);