dpnet: Stub interface IDirectPlay8LobbyClient (try 3)
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Fri May 16 04:55:10 CDT 2014
Hi,
Corrected Naming. If I've missed one, then when the offending function
is implemented it can be changed then.
Removed LVOID macros.
Changelog:
dpnet: Stub interface IDirectPlay8LobbyClient
Best Regards
Alistair Leslie-Hughes
-------------- next part --------------
>From f56a86d28ea9041262a5f65553f44b5d2a7ee548 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Mon, 12 May 2014 15:19:03 +1000
Subject: [PATCH] Stub interface IDirectPlay8LobbyClient
To: wine-patches <wine-patches at winehq.org>
---
dlls/dpnet/Makefile.in | 1 +
dlls/dpnet/dpnet_main.c | 1 +
dlls/dpnet/dpnet_private.h | 1 +
dlls/dpnet/lobbyclient.c | 197 +++++++++++++++++++++++++++++++++++++++++
dlls/dpnet/tests/Makefile.in | 1 +
dlls/dpnet/tests/lobbyclient.c | 63 +++++++++++++
6 files changed, 264 insertions(+)
create mode 100644 dlls/dpnet/lobbyclient.c
create mode 100644 dlls/dpnet/tests/lobbyclient.c
diff --git a/dlls/dpnet/Makefile.in b/dlls/dpnet/Makefile.in
index 541e104..70ccef0 100644
--- a/dlls/dpnet/Makefile.in
+++ b/dlls/dpnet/Makefile.in
@@ -7,6 +7,7 @@ C_SRCS = \
client.c \
dpnet_main.c \
lobbiedapp.c \
+ lobbyclient.c \
peer.c \
server.c \
threadpool.c
diff --git a/dlls/dpnet/dpnet_main.c b/dlls/dpnet/dpnet_main.c
index 29cbb79..042b95a 100644
--- a/dlls/dpnet/dpnet_main.c
+++ b/dlls/dpnet/dpnet_main.c
@@ -122,6 +122,7 @@ static IClassFactoryImpl DPNET_CFS[] = {
{ { &DICF_Vtbl }, 1, &CLSID_DirectPlay8Peer, DPNET_CreateDirectPlay8Peer },
{ { &DICF_Vtbl }, 1, &CLSID_DirectPlay8Address, DPNET_CreateDirectPlay8Address },
{ { &DICF_Vtbl }, 1, &CLSID_DirectPlay8LobbiedApplication, DPNET_CreateDirectPlay8LobbiedApp },
+ { { &DICF_Vtbl }, 1, &CLSID_DirectPlay8LobbyClient, DPNET_CreateDirectPlay8LobbyClient },
{ { &DICF_Vtbl }, 1, &CLSID_DirectPlay8ThreadPool, DPNET_CreateDirectPlay8ThreadPool},
{ { NULL }, 0, NULL, NULL }
};
diff --git a/dlls/dpnet/dpnet_private.h b/dlls/dpnet/dpnet_private.h
index 6b4b35d..d6f572b 100644
--- a/dlls/dpnet/dpnet_private.h
+++ b/dlls/dpnet/dpnet_private.h
@@ -127,6 +127,7 @@ extern HRESULT DPNET_CreateDirectPlay8Peer(LPCLASSFACTORY iface, LPUNKNOWN punkO
extern HRESULT DPNET_CreateDirectPlay8Address(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN;
extern HRESULT DPNET_CreateDirectPlay8LobbiedApp(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN;
extern HRESULT DPNET_CreateDirectPlay8ThreadPool(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN;
+extern HRESULT DPNET_CreateDirectPlay8LobbyClient(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj) DECLSPEC_HIDDEN;
extern void init_dpn_sp_caps(DPN_SP_CAPS *dpnspcaps) DECLSPEC_HIDDEN;
diff --git a/dlls/dpnet/lobbyclient.c b/dlls/dpnet/lobbyclient.c
new file mode 100644
index 0000000..8a43bc8
--- /dev/null
+++ b/dlls/dpnet/lobbyclient.c
@@ -0,0 +1,197 @@
+/*
+ * Direct Play Lobby Client
+ *
+ * Copyright 2014 Alistair Leslie-Hughes
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ */
+#include "config.h"
+
+#include <stdarg.h>
+
+#define COBJMACROS
+#include "windef.h"
+#include "winbase.h"
+#include "wine/debug.h"
+
+#include "dplay8.h"
+#include "dplobby8.h"
+#include "dpnet_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dpnet);
+
+typedef struct IDirectPlay8LobbyClientImpl
+{
+ IDirectPlay8LobbyClient IDirectPlay8LobbyClient_iface;
+ LONG ref;
+} IDirectPlay8LobbyClientImpl;
+
+static inline IDirectPlay8LobbyClientImpl *impl_from_IDirectPlay8LobbyClient(IDirectPlay8LobbyClient *iface)
+{
+ return CONTAINING_RECORD(iface, IDirectPlay8LobbyClientImpl, IDirectPlay8LobbyClient_iface);
+}
+
+
+static HRESULT WINAPI lobbyclient_QueryInterface(IDirectPlay8LobbyClient *iface, REFIID riid, void **obj)
+{
+ IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
+
+ if (IsEqualGUID(riid, &IID_IUnknown) ||
+ IsEqualGUID(riid, &IID_IDirectPlay8LobbyClient))
+ {
+ *obj = &This->IDirectPlay8LobbyClient_iface;
+ IUnknown_AddRef( (IUnknown*)*obj);
+
+ return DPN_OK;
+ }
+
+ WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),obj);
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI lobbyclient_AddRef(IDirectPlay8LobbyClient *iface)
+{
+ IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
+ ULONG ref = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p) ref=%u\n", This, ref);
+
+ return ref;
+}
+
+static ULONG WINAPI lobbyclient_Release(IDirectPlay8LobbyClient *iface)
+{
+ IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
+ ULONG ref = InterlockedDecrement(&This->ref);
+
+ TRACE("(%p) ref=%u\n", This, ref);
+
+ if (!ref)
+ {
+ HeapFree(GetProcessHeap(), 0, This);
+ }
+
+ return ref;
+}
+
+static HRESULT WINAPI lobbyclient_Initialize(IDirectPlay8LobbyClient *iface, void *context, PFNDPNMESSAGEHANDLER msghandler, DWORD flags)
+{
+ IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
+
+ FIXME("(%p)->(%p %p %x)\n", This, context, msghandler, flags);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI lobbyclient_EnumLocalPrograms(IDirectPlay8LobbyClient *iface, GUID* guidapplication, BYTE *enumdata, DWORD *enumDataSize, DWORD *items, DWORD flags)
+{
+ IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
+
+ FIXME("(%p)->(%p %p %p %p %x)\n", This, guidapplication, enumdata, enumDataSize, items, flags);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI lobbyclient_ConnectApplication(IDirectPlay8LobbyClient *iface, DPL_CONNECT_INFO *connectioninfo, void *connectioncontext, DPNHANDLE *application, DWORD timeout, DWORD flags)
+{
+ IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
+
+ FIXME("(%p)->(%p %p %p %u %x)\n", This, connectioninfo, connectioncontext, application, timeout, flags);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI lobbyclient_Send(IDirectPlay8LobbyClient *iface, DPNHANDLE connection, BYTE *buffer, DWORD buffersize, DWORD flags)
+{
+ IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
+
+ FIXME("(%p)->(%d %p %u %x)\n", This, connection, buffer, buffersize, flags);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI lobbyclient_ReleaseApplication(IDirectPlay8LobbyClient *iface, DPNHANDLE connection, DWORD flags)
+{
+ IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
+
+ FIXME("(%p)->(%d %x)\n", This, connection, flags);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI lobbyclient_Close(IDirectPlay8LobbyClient *iface, DWORD flags)
+{
+ IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
+
+ FIXME("(%p)->(%x)\n", This, flags);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI lobbyclient_GetConnectionSettings(IDirectPlay8LobbyClient *iface, DPNHANDLE connection, DPL_CONNECTION_SETTINGS *sessioninfo, DWORD *infosize, DWORD flags)
+{
+ IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
+
+ FIXME("(%p)->(%d %p %p %x)\n", This, connection, sessioninfo, infosize, flags);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI lobbyclient_SetConnectionSettings(IDirectPlay8LobbyClient *iface, DPNHANDLE connection, const DPL_CONNECTION_SETTINGS *sessioninfo, DWORD flags)
+{
+ IDirectPlay8LobbyClientImpl *This = impl_from_IDirectPlay8LobbyClient(iface);
+
+ FIXME("(%p)->(%d %p %x)\n", This, connection, sessioninfo, flags);
+
+ return E_NOTIMPL;
+}
+
+static const IDirectPlay8LobbyClientVtbl DirectPlay8LobbiedClient_Vtbl =
+{
+ lobbyclient_QueryInterface,
+ lobbyclient_AddRef,
+ lobbyclient_Release,
+ lobbyclient_Initialize,
+ lobbyclient_EnumLocalPrograms,
+ lobbyclient_ConnectApplication,
+ lobbyclient_Send,
+ lobbyclient_ReleaseApplication,
+ lobbyclient_Close,
+ lobbyclient_GetConnectionSettings,
+ lobbyclient_SetConnectionSettings
+};
+
+HRESULT DPNET_CreateDirectPlay8LobbyClient(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **obj)
+{
+ IDirectPlay8LobbyClientImpl *client;
+ HRESULT ret;
+
+ TRACE("%p (%p, %s, %p)\n", iface, pUnkOuter, debugstr_guid(riid), obj);
+
+ client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8LobbyClientImpl));
+ if (!client) {
+ *obj = NULL;
+ return E_OUTOFMEMORY;
+ }
+
+ client->IDirectPlay8LobbyClient_iface.lpVtbl = &DirectPlay8LobbiedClient_Vtbl;
+ client->ref = 1;
+
+ ret = lobbyclient_QueryInterface(&client->IDirectPlay8LobbyClient_iface, riid, obj);
+ lobbyclient_Release(&client->IDirectPlay8LobbyClient_iface);
+
+ return ret;
+}
diff --git a/dlls/dpnet/tests/Makefile.in b/dlls/dpnet/tests/Makefile.in
index f6e45ea..5b97aa1 100644
--- a/dlls/dpnet/tests/Makefile.in
+++ b/dlls/dpnet/tests/Makefile.in
@@ -4,5 +4,6 @@ IMPORTS = dxguid uuid dpnet ole32
C_SRCS = \
address.c \
client.c \
+ lobbyclient.c \
peer.c \
server.c
diff --git a/dlls/dpnet/tests/lobbyclient.c b/dlls/dpnet/tests/lobbyclient.c
new file mode 100644
index 0000000..585ea14
--- /dev/null
+++ b/dlls/dpnet/tests/lobbyclient.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2014 Alistair Leslie-Hughes
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define WIN32_LEAN_AND_MEAN
+#include <dplay8.h>
+#include <dplobby8.h>
+
+#include "wine/test.h"
+
+static HRESULT WINAPI DirectPlayLobbyMessageHandler(void *context, DWORD message_id, void* buffer)
+{
+ trace("DirectPlayLobbyMessageHandler: 0x%08x\n", message_id);
+ return S_OK;
+}
+
+void create_lobbyclient(void)
+{
+ HRESULT hr;
+ IDirectPlay8LobbyClient *client = NULL;
+
+ hr = CoCreateInstance( &CLSID_DirectPlay8LobbyClient, NULL, CLSCTX_ALL, &IID_IDirectPlay8LobbyClient, (void**)&client);
+ ok(hr == S_OK, "Failed to create object\n");
+ if(SUCCEEDED(hr))
+ {
+ hr = IDirectPlay8LobbyClient_Initialize(client, NULL, DirectPlayLobbyMessageHandler, 0);
+ todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = IDirectPlay8LobbyClient_Close(client, 0);
+ todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ IDirectPlay8LobbyClient_Release(client);
+ }
+}
+
+
+START_TEST(lobbyclient)
+{
+ HRESULT hr;
+
+ hr = CoInitialize(0);
+ ok(hr == S_OK, "failed to init com\n");
+ if(hr != S_OK)
+ return;
+
+ create_lobbyclient();
+
+ CoUninitialize();
+}
--
1.9.1
More information about the wine-patches
mailing list