[PATCH 3/3] dpnet: Implement IDirectPlay8Thread Initialize
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Tue Feb 14 22:36:26 CST 2017
In order to get the tests to pass, msghandler needed
to be reset in Close.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
dlls/dpnet/dpnet_private.h | 8 ++++++--
dlls/dpnet/tests/thread.c | 5 ++++-
dlls/dpnet/threadpool.c | 21 ++++++++++++++++++++-
3 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/dlls/dpnet/dpnet_private.h b/dlls/dpnet/dpnet_private.h
index 49c349520d..7b6de4a861 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 ce1b144156..37c226f99d 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 9e13ffb537..37a05e2384 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;
}
--
2.11.0
More information about the wine-patches
mailing list