Alistair Leslie-Hughes : dpnet: Implement IDirectPlay8Thread Initialize.

Alexandre Julliard julliard at winehq.org
Wed Feb 15 16:06:24 CST 2017


Module: wine
Branch: master
Commit: da5e8d088796462a9967a54059980f240565ad68
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=da5e8d088796462a9967a54059980f240565ad68

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Wed Feb 15 04:36:26 2017 +0000

dpnet: Implement IDirectPlay8Thread Initialize.

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>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 49c3495..7b6de4a 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 ce1b144..37c226f 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 9e13ffb..37a05e2 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;
 }
 




More information about the wine-cvs mailing list