dpnet: Fill the DPN_SP_CAPS structure in IDirectPlay8Peer_GetSPCaps with some sane values + tests.

This commit is contained in:
Louis Lenders 2011-09-23 23:17:58 +02:00 committed by Alexandre Julliard
parent 7c65ab91ad
commit fed06a562e
2 changed files with 44 additions and 2 deletions

View File

@ -389,9 +389,24 @@ static HRESULT WINAPI IDirectPlay8PeerImpl_SetSPCaps(IDirectPlay8Peer *iface, co
static HRESULT WINAPI IDirectPlay8PeerImpl_GetSPCaps(IDirectPlay8Peer *iface, const GUID * const pguidSP,
DPN_SP_CAPS * const pdpspCaps, const DWORD dwFlags)
{
FIXME("(%p)->(%p,%p,%x): stub\n", iface, pguidSP, pdpspCaps, dwFlags);
TRACE("(%p)->(%p,%p,%x)\n", iface, pguidSP, pdpspCaps, dwFlags);
return DPNERR_GENERIC;
if(pdpspCaps->dwSize != sizeof(DPN_SP_CAPS))
{
return DPNERR_INVALIDPARAM;
}
pdpspCaps->dwFlags = DPNSPCAPS_SUPPORTSDPNSRV | DPNSPCAPS_SUPPORTSBROADCAST |
DPNSPCAPS_SUPPORTSALLADAPTERS | DPNSPCAPS_SUPPORTSTHREADPOOL;
pdpspCaps->dwNumThreads = 3;
pdpspCaps->dwDefaultEnumCount = 5;
pdpspCaps->dwDefaultEnumRetryInterval = 1500;
pdpspCaps->dwDefaultEnumTimeout = 1500;
pdpspCaps->dwMaxEnumPayloadSize = 983;
pdpspCaps->dwBuffersPerThread = 1;
pdpspCaps->dwSystemBufferSize = 8192;
return DPN_OK;
}
static HRESULT WINAPI IDirectPlay8PeerImpl_GetConnectionInfo(IDirectPlay8Peer *iface, const DPNID dpnid,

View File

@ -115,6 +115,32 @@ static void test_enum_service_providers(void)
ok(HeapFree(GetProcessHeap(), 0, serv_prov_info), "Failed freeing server provider info\n");
}
static void test_get_sp_caps(void)
{
DPN_SP_CAPS caps;
HRESULT hr;
memset(&caps, 0, sizeof(DPN_SP_CAPS));
hr = IDirectPlay8Peer_GetSPCaps(peer, &CLSID_DP8SP_TCPIP, &caps, 0);
ok(hr == DPNERR_INVALIDPARAM, "GetSPCaps unexpectedly returned %x\n", hr);
caps.dwSize = sizeof(DPN_SP_CAPS);
hr = IDirectPlay8Peer_GetSPCaps(peer, &CLSID_DP8SP_TCPIP, &caps, 0);
ok(hr == DPN_OK, "GetSPCaps failed with %x\n", hr);
ok(caps.dwFlags == (DPNSPCAPS_SUPPORTSDPNSRV | DPNSPCAPS_SUPPORTSBROADCAST | DPNSPCAPS_SUPPORTSALLADAPTERS |
DPNSPCAPS_SUPPORTSTHREADPOOL), "provider unexpectedly misses some capability flags\n");
ok(caps.dwNumThreads == 3, "expected 3, got %d\n", caps.dwNumThreads);
ok(caps.dwDefaultEnumCount == 5, "expected 5, got %d\n", caps.dwDefaultEnumCount);
ok(caps.dwDefaultEnumRetryInterval == 1500, "expected 1500, got %d\n", caps.dwDefaultEnumRetryInterval);
ok(caps.dwDefaultEnumTimeout == 1500, "expected 1500, got %d\n", caps.dwDefaultEnumTimeout);
ok(caps.dwMaxEnumPayloadSize == 983, "expected 983, got %d\n", caps.dwMaxEnumPayloadSize);
ok(caps.dwBuffersPerThread == 1, "expected 1, got %d\n", caps.dwBuffersPerThread);
ok(caps.dwSystemBufferSize == 8192, "expected 8192, got %d\n", caps.dwSystemBufferSize);
}
static void test_cleanup_dp(void)
{
HRESULT hr;
@ -132,5 +158,6 @@ START_TEST(peer)
{
test_init_dp();
test_enum_service_providers();
test_get_sp_caps();
test_cleanup_dp();
}