Commit 072c58e3 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

dpnet: Share message handler between IDirectPlay8ThreadPool objects.

parent 7584e082
......@@ -122,10 +122,6 @@ struct IDirectPlay8ThreadPoolImpl
{
IDirectPlay8ThreadPool IDirectPlay8ThreadPool_iface;
LONG ref;
PFNDPNMESSAGEHANDLER msghandler;
DWORD flags;
void *usercontext;
};
/**
......
......@@ -70,7 +70,7 @@ static void create_threadpool(void)
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IDirectPlay8ThreadPool_Initialize(pool2, NULL, &DirectPlayThreadHandler, 0);
todo_wine ok(hr == DPNERR_ALREADYINITIALIZED, "got 0x%08x\n", hr);
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);
......@@ -103,7 +103,7 @@ static void create_threadpool(void)
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IDirectPlay8ThreadPool_Close(pool2, 0);
todo_wine ok(hr == DPNERR_UNINITIALIZED, "got 0x%08x\n", hr);
ok(hr == DPNERR_UNINITIALIZED, "got 0x%08x\n", hr);
IDirectPlay8ThreadPool_Release(pool1);
IDirectPlay8ThreadPool_Release(pool2);
......@@ -226,13 +226,13 @@ static void test_singleton(void)
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IDirectPlay8ThreadPool_Initialize(pool2, NULL, &DirectPlayThreadHandler, 0);
todo_wine ok(hr == DPNERR_ALREADYINITIALIZED, "got 0x%08x\n", hr);
ok(hr == DPNERR_ALREADYINITIALIZED, "got 0x%08x\n", hr);
hr = IDirectPlay8ThreadPool_Close(pool1, 0);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IDirectPlay8ThreadPool_Close(pool2, 0);
todo_wine ok(hr == DPNERR_UNINITIALIZED, "got 0x%08x\n", hr);
ok(hr == DPNERR_UNINITIALIZED, "got 0x%08x\n", hr);
IDirectPlay8ThreadPool_Release(pool1);
IDirectPlay8ThreadPool_Release(pool2);
......
......@@ -36,6 +36,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(dpnet);
static PFNDPNMESSAGEHANDLER threadpool_msghandler = NULL;
static DWORD threadpool_flags = 0;
static void *threadpool_usercontext = NULL;
static inline IDirectPlay8ThreadPoolImpl *impl_from_IDirectPlay8ThreadPool(IDirectPlay8ThreadPool *iface)
{
return CONTAINING_RECORD(iface, IDirectPlay8ThreadPoolImpl, IDirectPlay8ThreadPool_iface);
......@@ -89,12 +93,12 @@ static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_Initialize(IDirectPlay8ThreadPo
if(!pfn)
return DPNERR_INVALIDPARAM;
if(This->msghandler)
if(threadpool_msghandler)
return DPNERR_ALREADYINITIALIZED;
This->msghandler = pfn;
This->flags = dwFlags;
This->usercontext = pvUserContext;
threadpool_msghandler = pfn;
threadpool_flags = dwFlags;
threadpool_usercontext = pvUserContext;
return DPN_OK;
}
......@@ -106,7 +110,10 @@ static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_Close(IDirectPlay8ThreadPool *i
FIXME("(%p)->(%x)\n", This, dwFlags);
This->msghandler = NULL;
if(!threadpool_msghandler)
return DPNERR_UNINITIALIZED;
threadpool_msghandler = NULL;
return DPN_OK;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment