dpnet: Return a TCP/IP provider in IDirectPlay8PeerImpl_EnumServiceProviders.

This commit is contained in:
Louis Lenders 2011-09-18 22:26:49 +02:00 committed by Alexandre Julliard
parent 7029559ed6
commit 4a4678ca70
2 changed files with 56 additions and 10 deletions

View File

@ -95,8 +95,53 @@ static HRESULT WINAPI IDirectPlay8PeerImpl_EnumServiceProviders(IDirectPlay8Peer
DPN_SERVICE_PROVIDER_INFO * const pSPInfoBuffer, DWORD * const pcbEnumData,
DWORD * const pcReturned, const DWORD dwFlags)
{
FIXME("(%p)->(%p,%p,%p,%p,%p,%x): stub\n", iface, pguidServiceProvider, pguidApplication, pSPInfoBuffer, pcbEnumData, pcReturned, dwFlags);
return DPNERR_GENERIC;
static const WCHAR dp_providerW[] = {'D','i','r','e','c','t','P','l','a','y','8',' ','T','C','P','/','I','P',' ',
'S','e','r','v','i','c','e',' ','P','r','o','v','i','d','e','r','\0'};
static const WCHAR dp_adapterW[] = {'L','o','c','a','l',' ','A','r','e','a',' ','C','o','n','n','e','c','t','i','o','n',
' ','-',' ','I','P','v','4','\0'};
static const GUID adapter_guid = {0x4ce725f6, 0xd3c0, 0xdade, {0xba, 0x6f, 0x11, 0xf9, 0x65, 0xbc, 0x42, 0x99}};
DWORD req_size;
TRACE("(%p)->(%p,%p,%p,%p,%p,%x): stub\n", iface, pguidServiceProvider, pguidApplication, pSPInfoBuffer,
pcbEnumData, pcReturned, dwFlags);
if(!pguidServiceProvider)
{
req_size = sizeof(DPN_SERVICE_PROVIDER_INFO) + sizeof(dp_providerW);
}
else if(IsEqualGUID(pguidServiceProvider, &CLSID_DP8SP_TCPIP))
{
req_size = sizeof(DPN_SERVICE_PROVIDER_INFO) + sizeof(dp_adapterW);
}
else
{
FIXME("Application requested a provider we don't handle (yet)\n");
*pcReturned = 0;
return DPNERR_DOESNOTEXIST;
}
if(*pcbEnumData < req_size)
{
*pcbEnumData = req_size;
return DPNERR_BUFFERTOOSMALL;
}
pSPInfoBuffer->pwszName = (LPWSTR)(pSPInfoBuffer + sizeof(DPN_SERVICE_PROVIDER_INFO));
if(!pguidServiceProvider)
{
lstrcpyW(pSPInfoBuffer->pwszName, dp_providerW);
pSPInfoBuffer->guid = CLSID_DP8SP_TCPIP;
}
else
{
lstrcpyW(pSPInfoBuffer->pwszName, dp_adapterW);
pSPInfoBuffer->guid = adapter_guid;
}
*pcReturned = 1;
return DPN_OK;
}
static HRESULT WINAPI IDirectPlay8PeerImpl_CancelAsyncOperation(IDirectPlay8Peer *iface,

View File

@ -67,14 +67,14 @@ static void test_enum_service_providers(void)
items = 0;
hr = IDirectPlay8Peer_EnumServiceProviders(peer, NULL, NULL, NULL, &size, &items, 0);
todo_wine ok(hr == DPNERR_BUFFERTOOSMALL, "IDirectPlay8Peer_EnumServiceProviders failed with %x\n", hr);
todo_wine ok(size != 0, "size is unexpectedly 0\n");
ok(hr == DPNERR_BUFFERTOOSMALL, "IDirectPlay8Peer_EnumServiceProviders failed with %x\n", hr);
ok(size != 0, "size is unexpectedly 0\n");
serv_prov_info = (DPN_SERVICE_PROVIDER_INFO*) HeapAlloc(GetProcessHeap(), 0, size);
hr = IDirectPlay8Peer_EnumServiceProviders(peer, NULL, NULL, serv_prov_info, &size, &items, 0);
todo_wine ok(hr == S_OK, "IDirectPlay8Peer_EnumServiceProviders failed with %x\n", hr);
todo_wine ok(items != 0, "Found unexpectedly no service providers\n");
ok(hr == S_OK, "IDirectPlay8Peer_EnumServiceProviders failed with %x\n", hr);
ok(items != 0, "Found unexpectedly no service providers\n");
trace("number of items found: %d\n", items);
@ -93,14 +93,15 @@ static void test_enum_service_providers(void)
items = 0;
hr = IDirectPlay8Peer_EnumServiceProviders(peer, &CLSID_DP8SP_TCPIP, NULL, NULL, &size, &items, 0);
todo_wine ok(hr == DPNERR_BUFFERTOOSMALL, "IDirectPlay8Peer_EnumServiceProviders failed with %x\n", hr);
todo_wine ok(size != 0, "size is unexpectedly 0\n");
ok(hr == DPNERR_BUFFERTOOSMALL, "IDirectPlay8Peer_EnumServiceProviders failed with %x\n", hr);
ok(size != 0, "size is unexpectedly 0\n");
serv_prov_info = (DPN_SERVICE_PROVIDER_INFO*) HeapAlloc(GetProcessHeap(), 0, size);
hr = IDirectPlay8Peer_EnumServiceProviders(peer, &CLSID_DP8SP_TCPIP, NULL, serv_prov_info, &size, &items, 0);
todo_wine ok(hr == S_OK, "IDirectPlay8Peer_EnumServiceProviders failed with %x\n", hr);
todo_wine ok(items != 0, "Found unexpectedly no adapter\n");
ok(hr == S_OK, "IDirectPlay8Peer_EnumServiceProviders failed with %x\n", hr);
ok(items != 0, "Found unexpectedly no adapter\n");
for (i=0;i<items;i++)
{