dpnet: Handle unknown service GUID in enum_services_providers.

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-24 06:45:29 +00:00 committed by Alexandre Julliard
parent e3781c84ab
commit 83cce966f4
2 changed files with 14 additions and 2 deletions

View File

@ -147,10 +147,10 @@ HRESULT enum_services_providers(const GUID * const service, DPN_SERVICE_PROVIDER
if(!returned || !buf_size) if(!returned || !buf_size)
return E_POINTER; return E_POINTER;
*returned = 0;
if(!service) if(!service)
{ {
*returned = 0;
res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, serviceproviders, 0, KEY_READ, &key); res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, serviceproviders, 0, KEY_READ, &key);
if(res == ERROR_FILE_NOT_FOUND) if(res == ERROR_FILE_NOT_FOUND)
return DPNERR_DOESNOTEXIST; return DPNERR_DOESNOTEXIST;

View File

@ -211,6 +211,12 @@ static void test_enum_service_providers(void)
} }
ok(HeapFree(GetProcessHeap(), 0, serv_prov_info), "Failed freeing server provider info\n"); ok(HeapFree(GetProcessHeap(), 0, serv_prov_info), "Failed freeing server provider info\n");
/* Invalid GUID */
items = 88;
hr = IDirectPlay8Client_EnumServiceProviders(client, &appguid, NULL, serv_prov_info, &size, &items, 0);
ok(hr == DPNERR_DOESNOTEXIST, "IDirectPlay8Peer_EnumServiceProviders failed with %x\n", hr);
ok(items == 88, "Found adapter %d\n", items);
} }
static void test_enum_hosts(void) static void test_enum_hosts(void)
@ -571,6 +577,12 @@ static void test_enum_service_providers_peer(void)
serv_prov_info -= items; /* set pointer back */ serv_prov_info -= items; /* set pointer back */
ok(HeapFree(GetProcessHeap(), 0, serv_prov_info), "Failed freeing server provider info\n"); ok(HeapFree(GetProcessHeap(), 0, serv_prov_info), "Failed freeing server provider info\n");
/* Invalid GUID */
items = 88;
hr = IDirectPlay8Peer_EnumServiceProviders(peer, &appguid, NULL, serv_prov_info, &size, &items, 0);
ok(hr == DPNERR_DOESNOTEXIST, "IDirectPlay8Peer_EnumServiceProviders failed with %x\n", hr);
ok(items == 88, "Found adapter %d\n", items);
} }
static void test_enum_hosts_peer(void) static void test_enum_hosts_peer(void)