diff --git a/patches/dpnet-Server-EnumServiceProviders/0001-dpnet-Implement-IDirectPlay8Server-EnumServicePro.patch b/patches/dpnet-Server-EnumServiceProviders/0001-dpnet-Implement-IDirectPlay8Server-EnumServicePro.patch new file mode 100644 index 00000000..9a68c506 --- /dev/null +++ b/patches/dpnet-Server-EnumServiceProviders/0001-dpnet-Implement-IDirectPlay8Server-EnumServicePro.patch @@ -0,0 +1,144 @@ +From cca287da02e2946705ad89f6e8c052b68199ad31 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Tue, 1 Jun 2021 17:15:44 +1000 +Subject: [PATCH v3] dpnet: Implement IDirectPlay8Server EnumServiceProviders + +Signed-off-by: Alistair Leslie-Hughes +--- + dlls/dpnet/server.c | 14 ++++++- + dlls/dpnet/tests/server.c | 86 +++++++++++++++++++++++++++++++++++++++ + 2 files changed, 98 insertions(+), 2 deletions(-) + +diff --git a/dlls/dpnet/server.c b/dlls/dpnet/server.c +index 977771697ac..26dd76388b1 100644 +--- a/dlls/dpnet/server.c ++++ b/dlls/dpnet/server.c +@@ -126,9 +126,19 @@ static HRESULT WINAPI IDirectPlay8ServerImpl_EnumServiceProviders(IDirectPlay8Se + PDWORD pcReturned, DWORD dwFlags) + { + IDirectPlay8ServerImpl *This = impl_from_IDirectPlay8Server(iface); +- FIXME("(%p)->(%s %s %p %p %p %d)\n", This, debugstr_guid(pguidServiceProvider), debugstr_guid(pguidApplication), ++ TRACE("(%p)->(%s %s %p %p %p %d)\n", This, debugstr_guid(pguidServiceProvider), debugstr_guid(pguidApplication), + pSPInfoBuffer, pcbEnumData, pcReturned, dwFlags); +- return E_NOTIMPL; ++ ++ if(!This->msghandler) ++ return DPNERR_UNINITIALIZED; ++ ++ if(dwFlags) ++ FIXME("Unhandled flags %x\n", dwFlags); ++ ++ if(pguidApplication) ++ FIXME("Application guid %s is currently being ignored\n", debugstr_guid(pguidApplication)); ++ ++ return enum_services_providers(pguidServiceProvider, pSPInfoBuffer, pcbEnumData, pcReturned); + } + + static HRESULT WINAPI IDirectPlay8ServerImpl_CancelAsyncOperation(IDirectPlay8Server *iface, DPNHANDLE hAsyncHandle, DWORD dwFlags) +diff --git a/dlls/dpnet/tests/server.c b/dlls/dpnet/tests/server.c +index 74a0e5adfcf..ae7e876522d 100644 +--- a/dlls/dpnet/tests/server.c ++++ b/dlls/dpnet/tests/server.c +@@ -184,6 +184,91 @@ static void test_server_info(void) + } + } + ++static void test_enum_service_providers(void) ++{ ++ DPN_SERVICE_PROVIDER_INFO *serv_prov_info; ++ IDirectPlay8Server *server = NULL; ++ DWORD items, size; ++ DWORD i; ++ HRESULT hr; ++ ++ hr = CoCreateInstance( &CLSID_DirectPlay8Server, NULL, CLSCTX_ALL, &IID_IDirectPlay8Server, (LPVOID*)&server); ++ ok(hr == S_OK, "Failed to create IDirectPlay8Server object\n"); ++ if (FAILED(hr)) ++ return; ++ ++ size = 0; ++ items = 0; ++ hr = IDirectPlay8Server_EnumServiceProviders(server, NULL, NULL, serv_prov_info, &size, &items, 0); ++ ok(hr == DPNERR_UNINITIALIZED, "got %x\n", hr); ++ ++ hr = IDirectPlay8Server_Initialize(server, NULL, DirectPlayMessageHandler, 0); ++ ok(hr == S_OK, "got 0x%08x\n", hr); ++ if (FAILED(hr)) ++ { ++ IDirectPlay8Server_Release(server); ++ return; ++ } ++ ++ size = 0; ++ items = 0; ++ ++ hr = IDirectPlay8Server_EnumServiceProviders(server, NULL, NULL, NULL, &size, NULL, 0); ++ ok(hr == E_POINTER, "IDirectPlay8Server_EnumServiceProviders failed with %x\n", hr); ++ ++ hr = IDirectPlay8Server_EnumServiceProviders(server, NULL, NULL, NULL, NULL, &items, 0); ++ ok(hr == E_POINTER, "IDirectPlay8Server_EnumServiceProviders failed with %x\n", hr); ++ ++ hr = IDirectPlay8Server_EnumServiceProviders(server, NULL, NULL, NULL, &size, &items, 0); ++ ok(hr == DPNERR_BUFFERTOOSMALL, "IDirectPlay8Server_EnumServiceProviders failed with %x\n", hr); ++ ok(size != 0, "size is unexpectedly 0\n"); ++ ++ serv_prov_info = HeapAlloc(GetProcessHeap(), 0, size); ++ ++ hr = IDirectPlay8Server_EnumServiceProviders(server, NULL, NULL, serv_prov_info, &size, &items, 0); ++ ok(hr == S_OK, "IDirectPlay8Server_EnumServiceProviders failed with %x\n", hr); ++ ok(items != 0, "Found unexpectedly no service providers\n"); ++ ++ trace("number of items found: %d\n", items); ++ ++ for (i=0;i