diff --git a/dlls/dpvoice/Makefile.in b/dlls/dpvoice/Makefile.in index 186a44edfe6..25334b5cafb 100644 --- a/dlls/dpvoice/Makefile.in +++ b/dlls/dpvoice/Makefile.in @@ -3,7 +3,8 @@ IMPORTS = dxguid uuid C_SRCS = \ client.c \ - main.c + main.c \ + server.c RC_SRCS = version.rc diff --git a/dlls/dpvoice/dvoice_private.h b/dlls/dpvoice/dvoice_private.h index a008924e070..0ee2658b643 100644 --- a/dlls/dpvoice/dvoice_private.h +++ b/dlls/dpvoice/dvoice_private.h @@ -21,5 +21,6 @@ #define __DVOICE_PRIVATE_H__ extern HRESULT DPVOICE_CreateDirectPlayVoiceClient(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj) DECLSPEC_HIDDEN; +extern HRESULT DPVOICE_CreateDirectPlayVoiceServer(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj) DECLSPEC_HIDDEN; #endif diff --git a/dlls/dpvoice/main.c b/dlls/dpvoice/main.c index 84f739c5a37..608d1cd642c 100644 --- a/dlls/dpvoice/main.c +++ b/dlls/dpvoice/main.c @@ -95,6 +95,7 @@ static const IClassFactoryVtbl DICF_Vtbl = { static IClassFactoryImpl DPVOICE_CFS[] = { { { &DICF_Vtbl }, 1, &CLSID_DirectPlayVoiceClient, DPVOICE_CreateDirectPlayVoiceClient }, + { { &DICF_Vtbl }, 1, &CLSID_DirectPlayVoiceServer, DPVOICE_CreateDirectPlayVoiceServer }, { { NULL }, 0, NULL, NULL } }; diff --git a/dlls/dpvoice/server.c b/dlls/dpvoice/server.c new file mode 100644 index 00000000000..eb2c9ed7b1e --- /dev/null +++ b/dlls/dpvoice/server.c @@ -0,0 +1,196 @@ + /* + * DirectPlay Voice Server Interface + * + * Copyright (C) 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 + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "objbase.h" + +#include "wine/unicode.h" +#include "wine/debug.h" + +#include "dvoice.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dpvoice); + +typedef struct IDirectPlayVoiceServerImpl +{ + IDirectPlayVoiceServer IDirectPlayVoiceServer_iface; + LONG ref; +} IDirectPlayVoiceServerImpl; + +static inline IDirectPlayVoiceServerImpl *impl_from_IDirectPlayVoiceServer(IDirectPlayVoiceServer *iface) +{ + return CONTAINING_RECORD(iface, IDirectPlayVoiceServerImpl, IDirectPlayVoiceServer_iface); +} + +static HRESULT WINAPI dpvserver_QueryInterface(IDirectPlayVoiceServer *iface, REFIID riid, void **ppv) +{ + if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectPlayVoiceServer)) + { + IUnknown_AddRef(iface); + *ppv = iface; + return S_OK; + } + + WARN("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ppv); + return E_NOINTERFACE; +} + +static ULONG WINAPI dpvserver_AddRef(IDirectPlayVoiceServer *iface) +{ + IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%u\n", This, ref); + + return ref; +} +static ULONG WINAPI dpvserver_Release(IDirectPlayVoiceServer *iface) +{ + IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%u\n", This, ref); + + if (!ref) + { + HeapFree(GetProcessHeap(), 0, This); + } + return ref; +} + +static HRESULT WINAPI dpvserver_Initialize(IDirectPlayVoiceServer *iface, IUnknown *lpVoid, PDVMESSAGEHANDLER pMessageHandler, + void *pUserContext, DWORD *lpdwMessageMask, DWORD dwMessageMaskElements) +{ + IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface); + FIXME("%p %p %p %p %p %d\n", This, lpVoid, pMessageHandler, pUserContext,lpdwMessageMask, dwMessageMaskElements); + return E_NOTIMPL; +} + +static HRESULT WINAPI dpvserver_StartSession(IDirectPlayVoiceServer *iface, PDVSESSIONDESC pSessionDesc, DWORD dwFlags) +{ + IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface); + FIXME("%p %p %d\n", This, pSessionDesc, dwFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI dpvserver_StopSession(IDirectPlayVoiceServer *iface, DWORD dwFlags) +{ + IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface); + FIXME("%p %d\n", This, dwFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI dpvserver_GetSessionDesc(IDirectPlayVoiceServer *iface, PDVSESSIONDESC pvSessionDesc) +{ + IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface); + FIXME("%p %p\n", This, pvSessionDesc); + return E_NOTIMPL; +} + +static HRESULT WINAPI dpvserver_SetSessionDesc(IDirectPlayVoiceServer *iface, PDVSESSIONDESC pSessionDesc) +{ + IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface); + FIXME("%p %p\n", This, pSessionDesc); + return E_NOTIMPL; +} + +static HRESULT WINAPI dpvserver_GetCaps(IDirectPlayVoiceServer *iface, PDVCAPS pDVCaps) +{ + IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface); + FIXME("%p %p\n", This, pDVCaps); + return E_NOTIMPL; +} + +static HRESULT WINAPI dpvserver_GetCompressionTypes(IDirectPlayVoiceServer *iface, void *pData, DWORD *pdwDataSize, + DWORD *pdwNumElements, DWORD dwFlags) +{ + IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface); + FIXME("%p %p %p %p %d\n", This, pData, pdwDataSize, pdwNumElements, dwFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI dpvserver_SetTransmitTargets(IDirectPlayVoiceServer *iface, DVID dvSource, PDVID pdvIDTargets, + DWORD dwNumTargets, DWORD dwFlags) +{ + IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface); + FIXME("%p %d %p %d %d\n", This, dvSource, pdvIDTargets, dwNumTargets, dwFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI dpvserver_GetTransmitTargets(IDirectPlayVoiceServer *iface, DVID dvSource, PDVID pdvIDTargets, + DWORD *pdwNumTargets, DWORD dwFlags) +{ + IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface); + FIXME("%p %d %p %p %d\n", This, dvSource, pdvIDTargets, pdwNumTargets, dwFlags); + return E_NOTIMPL; +} + +static HRESULT WINAPI dpvserver_SetNotifyMask(IDirectPlayVoiceServer *iface, DWORD *pdwMessageMask, DWORD dwMessageMaskElements) +{ + IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface); + FIXME("%p %p %d\n", This, pdwMessageMask, dwMessageMaskElements); + return E_NOTIMPL; +} + +static const IDirectPlayVoiceServerVtbl DirectPlayVoiceServer_Vtbl = +{ + dpvserver_QueryInterface, + dpvserver_AddRef, + dpvserver_Release, + dpvserver_Initialize, + dpvserver_StartSession, + dpvserver_StopSession, + dpvserver_GetSessionDesc, + dpvserver_SetSessionDesc, + dpvserver_GetCaps, + dpvserver_GetCompressionTypes, + dpvserver_SetTransmitTargets, + dpvserver_GetTransmitTargets, + dpvserver_SetNotifyMask +}; + +HRESULT DPVOICE_CreateDirectPlayVoiceServer(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj) +{ + IDirectPlayVoiceServerImpl* server; + HRESULT ret; + + TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppobj); + + *ppobj = NULL; + + server = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlayVoiceServerImpl)); + if (!server) + return E_OUTOFMEMORY; + + server->IDirectPlayVoiceServer_iface.lpVtbl = &DirectPlayVoiceServer_Vtbl; + server->ref = 1; + + ret = IDirectPlayVoiceServer_QueryInterface(&server->IDirectPlayVoiceServer_iface, riid, ppobj); + IDirectPlayVoiceServer_Release(&server->IDirectPlayVoiceServer_iface); + + return ret; +}