[PATCH 3/3] dpnet: Implement IDirectPlay8Thread Initialize

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Fri Nov 11 01:02:47 CST 2016


Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/dpnet/dpnet_private.h |  4 ++++
 dlls/dpnet/tests/thread.c  |  4 ++--
 dlls/dpnet/threadpool.c    | 17 ++++++++++++++++-
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/dlls/dpnet/dpnet_private.h b/dlls/dpnet/dpnet_private.h
index 41313d1..48aceb6 100644
--- a/dlls/dpnet/dpnet_private.h
+++ b/dlls/dpnet/dpnet_private.h
@@ -125,6 +125,10 @@ struct IDirectPlay8LobbiedApplicationImpl
 struct IDirectPlay8ThreadPoolImpl
 {
     IDirectPlay8ThreadPool IDirectPlay8ThreadPool_iface;
+
+    PFNDPNMESSAGEHANDLER msghandler;
+    DWORD flags;
+    void *usercontext;
 };
 
 /**
diff --git a/dlls/dpnet/tests/thread.c b/dlls/dpnet/tests/thread.c
index 561178f..2e7e951 100644
--- a/dlls/dpnet/tests/thread.c
+++ b/dlls/dpnet/tests/thread.c
@@ -54,13 +54,13 @@ 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);
 
     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);
diff --git a/dlls/dpnet/threadpool.c b/dlls/dpnet/threadpool.c
index 3ce9731..01ad73d 100644
--- a/dlls/dpnet/threadpool.c
+++ b/dlls/dpnet/threadpool.c
@@ -76,7 +76,19 @@ 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): stub\n", iface, 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;
 }
 
@@ -137,6 +149,9 @@ static IDirectPlay8ThreadPool *get_threadpool(void)
             return NULL;
 
         obj->IDirectPlay8ThreadPool_iface.lpVtbl = &DirectPlay8ThreadPool_Vtbl;
+        obj->msghandler  = NULL;
+        obj->flags       = 0;
+        obj->usercontext = NULL;
 
         if (InterlockedCompareExchangePointer((void**)&threadpool, &obj->IDirectPlay8ThreadPool_iface, NULL))
             HeapFree(GetProcessHeap(), 0, obj);
-- 
2.10.2




More information about the wine-patches mailing list