diff --git a/dlls/dpnet/dpnet_private.h b/dlls/dpnet/dpnet_private.h index 49c349520d2..7b6de4a8614 100644 --- a/dlls/dpnet/dpnet_private.h +++ b/dlls/dpnet/dpnet_private.h @@ -120,8 +120,12 @@ struct IDirectPlay8LobbiedApplicationImpl */ struct IDirectPlay8ThreadPoolImpl { - IDirectPlay8ThreadPool IDirectPlay8ThreadPool_iface; - LONG ref; + IDirectPlay8ThreadPool IDirectPlay8ThreadPool_iface; + LONG ref; + + PFNDPNMESSAGEHANDLER msghandler; + DWORD flags; + void *usercontext; }; /** diff --git a/dlls/dpnet/tests/thread.c b/dlls/dpnet/tests/thread.c index ce1b1441561..37c226f99d0 100644 --- a/dlls/dpnet/tests/thread.c +++ b/dlls/dpnet/tests/thread.c @@ -64,7 +64,7 @@ static void create_threadpool(void) ok(hr == S_OK, "got 0x%08x\n", hr); hr = IDirectPlay8ThreadPool_Initialize(pool1, NULL, NULL, 0); - todo_wine ok(hr == DPNERR_INVALIDPARAM, "got 0x%08x\n", hr); + ok(hr == DPNERR_INVALIDPARAM, "got 0x%08x\n", hr); hr = IDirectPlay8ThreadPool_Initialize(pool1, NULL, &DirectPlayThreadHandler, 0); ok(hr == S_OK, "got 0x%08x\n", hr); @@ -133,6 +133,9 @@ static void test_enum_hosts(void) hr = IDirectPlay8ThreadPool_Initialize(pool1, NULL, &DirectPlayThreadHandler, 0); ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IDirectPlay8ThreadPool_Initialize(pool1, NULL, &DirectPlayThreadHandler, 0); + ok(hr == DPNERR_ALREADYINITIALIZED, "got 0x%08x\n", hr); + hr = IDirectPlay8ThreadPool_GetThreadCount(pool1, -1, &threadcnt, 0); ok(hr == S_OK, "got 0x%08x\n", hr); ok(threadcnt == 0, "got %d\n", threadcnt); diff --git a/dlls/dpnet/threadpool.c b/dlls/dpnet/threadpool.c index 9e13ffb537c..37a05e23841 100644 --- a/dlls/dpnet/threadpool.c +++ b/dlls/dpnet/threadpool.c @@ -82,13 +82,32 @@ static ULONG WINAPI IDirectPlay8ThreadPoolImpl_Release(IDirectPlay8ThreadPool *i static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_Initialize(IDirectPlay8ThreadPool *iface, void * const pvUserContext, const PFNDPNMESSAGEHANDLER pfn, const DWORD dwFlags) { - FIXME("(%p)->(%p,%p,%x): stub\n", iface, pvUserContext, pfn, dwFlags); + IDirectPlay8ThreadPoolImpl *This = impl_from_IDirectPlay8ThreadPool(iface); + + TRACE("(%p)->(%p,%p,%x)\n", This, pvUserContext, pfn, dwFlags); + + if(!pfn) + return DPNERR_INVALIDPARAM; + + if(This->msghandler) + return DPNERR_ALREADYINITIALIZED; + + This->msghandler = pfn; + This->flags = dwFlags; + This->usercontext = pvUserContext; + return DPN_OK; } static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_Close(IDirectPlay8ThreadPool *iface, const DWORD dwFlags) { + IDirectPlay8ThreadPoolImpl *This = impl_from_IDirectPlay8ThreadPool(iface); + + FIXME("(%p)->(%x)\n", This, dwFlags); + + This->msghandler = NULL; + return DPN_OK; }