Commit 6eb0015d authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

dpnet: Add basic validation in IDirectPlay8Client EnumHosts.

parent db1d1940
...@@ -145,8 +145,20 @@ static HRESULT WINAPI IDirectPlay8ClientImpl_EnumHosts(IDirectPlay8Client *iface ...@@ -145,8 +145,20 @@ static HRESULT WINAPI IDirectPlay8ClientImpl_EnumHosts(IDirectPlay8Client *iface
const DWORD dwFlags) const DWORD dwFlags)
{ {
IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface); IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
FIXME("(%p):(%p,%p,%x): Stub\n", This, pvUserContext, pAsyncHandle, dwFlags);
return DPN_OK; 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, static HRESULT WINAPI IDirectPlay8ClientImpl_CancelAsyncOperation(IDirectPlay8Client *iface,
......
...@@ -254,22 +254,22 @@ static void test_enum_hosts(void) ...@@ -254,22 +254,22 @@ static void test_enum_hosts(void)
data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, caps.dwMaxEnumPayloadSize + 1); 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); 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, hr = IDirectPlay8Client_EnumHosts(client, &appdesc, host, local, data, caps.dwMaxEnumPayloadSize + 1,
INFINITE, 0, INFINITE, NULL, &async, DPNENUMHOSTS_SYNC); 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; async = 0;
hr = IDirectPlay8Client_EnumHosts(client, &appdesc, host, local, data, caps.dwMaxEnumPayloadSize + 1, INFINITE, 0, hr = IDirectPlay8Client_EnumHosts(client, &appdesc, host, local, data, caps.dwMaxEnumPayloadSize + 1, INFINITE, 0,
INFINITE, NULL, &async, 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"); ok(!async, "Handle returned\n");
async = 0; async = 0;
hr = IDirectPlay8Client_EnumHosts(client, &appdesc, host, local, data, caps.dwMaxEnumPayloadSize, INFINITE, 0, INFINITE, hr = IDirectPlay8Client_EnumHosts(client, &appdesc, host, local, data, caps.dwMaxEnumPayloadSize, INFINITE, 0, INFINITE,
NULL, &async, 0); 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"); todo_wine ok(async, "No Handle returned\n");
/* This CancelAsyncOperation doesn't generate a DPN_MSGID_ASYNC_OP_COMPLETE */ /* This CancelAsyncOperation doesn't generate a DPN_MSGID_ASYNC_OP_COMPLETE */
...@@ -279,15 +279,15 @@ static void test_enum_hosts(void) ...@@ -279,15 +279,15 @@ static void test_enum_hosts(void)
/* No Initialize has been called on client2. */ /* No Initialize has been called on client2. */
hr = IDirectPlay8Client_EnumHosts(client2, &appdesc, host, local, NULL, 0, INFINITE, 0, INFINITE, NULL, &async, 0); 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. */ /* Since we are running asynchronously, EnumHosts returns DPNSUCCESS_PENDING. */
hr = IDirectPlay8Client_EnumHosts(client, &appdesc, host, local, NULL, 0, INFINITE, 0, INFINITE, NULL, &async, 0); 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"); todo_wine ok(async, "No Handle returned\n");
hr = IDirectPlay8Client_EnumHosts(client, &appdesc, host, local, NULL, 0, INFINITE, 0, INFINITE, NULL, &async2, 0); 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, "No Handle returned\n");
todo_wine ok(async2 != async, "Same handle returned.\n"); todo_wine ok(async2 != async, "Same handle returned.\n");
......
...@@ -164,7 +164,7 @@ static void test_enum_hosts(void) ...@@ -164,7 +164,7 @@ static void test_enum_hosts(void)
ok(hr == S_OK, "IDirectPlay8Address failed with 0x%08x\n", hr); 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); 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"); todo_wine ok(async, "No Handle returned\n");
hr = IDirectPlay8ThreadPool_GetThreadCount(pool1, -1, &threadcnt, 0); hr = IDirectPlay8ThreadPool_GetThreadCount(pool1, -1, &threadcnt, 0);
...@@ -172,7 +172,7 @@ static void test_enum_hosts(void) ...@@ -172,7 +172,7 @@ static void test_enum_hosts(void)
todo_wine ok(threadcnt == 6, "got %d\n", threadcnt); todo_wine ok(threadcnt == 6, "got %d\n", threadcnt);
hr = IDirectPlay8Client_EnumHosts(client, &appdesc, host, local, NULL, 0, INFINITE, 0, INFINITE, NULL, &async2, 0); 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); WaitForSingleObject(enumevent, 1000);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment