ReactOS 0.4.17-dev-934-g091855f
server.c
Go to the documentation of this file.
1 /*
2 * DirectPlay Voice Server Interface
3 *
4 * Copyright (C) 2014 Alistair Leslie-Hughes
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include <stdarg.h>
22
23#define COBJMACROS
24#include "windef.h"
25#include "winbase.h"
26#include "wingdi.h"
27#include "winuser.h"
28#include "objbase.h"
29
30#include "wine/debug.h"
31
32#include "dvoice.h"
33
35
37{
38 IDirectPlayVoiceServer IDirectPlayVoiceServer_iface;
41
43{
44 static const DVCOMPRESSIONINFO pcm_type =
45 {80, {0x8de12fd4,0x7cb3,0x48ce,{0xa7,0xe8,0x9c,0x47,0xa2,0x2e,0x8a,0xc5}}, NULL, NULL, 0, 64000};
46 static const WCHAR pcm_name[] = L"MS-PCM 64 kbit/s";
47
49 LPWSTR string_loc;
50
51 if (!pdwDataSize || !pdwNumElements)
53
54 if (dwFlags)
55 return DVERR_INVALIDFLAGS;
56
57 *pdwNumElements = 1;
58
59 if (*pdwDataSize < sizeof(pcm_type) + sizeof(pcm_name))
60 {
62 }
63 else if (!pData)
64 {
66 }
67 else
68 {
69 string_loc = (LPWSTR)((char*)pData + sizeof(pcm_type));
70 memcpy(pData, &pcm_type, sizeof(pcm_type));
71 memcpy(string_loc, pcm_name, sizeof(pcm_name));
72 pData->lpszName = string_loc;
73 ret = DV_OK;
74 }
75
76 *pdwDataSize = sizeof(pcm_type) + sizeof(pcm_name);
77 return ret;
78}
79
80static inline IDirectPlayVoiceServerImpl *impl_from_IDirectPlayVoiceServer(IDirectPlayVoiceServer *iface)
81{
82 return CONTAINING_RECORD(iface, IDirectPlayVoiceServerImpl, IDirectPlayVoiceServer_iface);
83}
84
85static HRESULT WINAPI dpvserver_QueryInterface(IDirectPlayVoiceServer *iface, REFIID riid, void **ppv)
86{
87 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectPlayVoiceServer))
88 {
89 IUnknown_AddRef(iface);
90 *ppv = iface;
91 return S_OK;
92 }
93
94 WARN("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ppv);
95 return E_NOINTERFACE;
96}
97
98static ULONG WINAPI dpvserver_AddRef(IDirectPlayVoiceServer *iface)
99{
102
103 TRACE("(%p) ref=%lu\n", This, ref);
104
105 return ref;
106}
107
108static ULONG WINAPI dpvserver_Release(IDirectPlayVoiceServer *iface)
109{
112
113 TRACE("(%p) ref=%lu\n", This, ref);
114
115 if (!ref)
116 {
118 }
119 return ref;
120}
121
122static HRESULT WINAPI dpvserver_Initialize(IDirectPlayVoiceServer *iface, IUnknown *lpVoid, PDVMESSAGEHANDLER pMessageHandler,
123 void *pUserContext, DWORD *lpdwMessageMask, DWORD dwMessageMaskElements)
124{
126 FIXME("%p %p %p %p %p %ld\n", This, lpVoid, pMessageHandler, pUserContext,lpdwMessageMask, dwMessageMaskElements);
127 return E_NOTIMPL;
128}
129
130static HRESULT WINAPI dpvserver_StartSession(IDirectPlayVoiceServer *iface, PDVSESSIONDESC pSessionDesc, DWORD dwFlags)
131{
133 FIXME("%p %p %ld\n", This, pSessionDesc, dwFlags);
134 return E_NOTIMPL;
135}
136
137static HRESULT WINAPI dpvserver_StopSession(IDirectPlayVoiceServer *iface, DWORD dwFlags)
138{
140 FIXME("%p %ld\n", This, dwFlags);
141 return E_NOTIMPL;
142}
143
144static HRESULT WINAPI dpvserver_GetSessionDesc(IDirectPlayVoiceServer *iface, PDVSESSIONDESC pvSessionDesc)
145{
147 FIXME("%p %p\n", This, pvSessionDesc);
148 return E_NOTIMPL;
149}
150
151static HRESULT WINAPI dpvserver_SetSessionDesc(IDirectPlayVoiceServer *iface, PDVSESSIONDESC pSessionDesc)
152{
154 FIXME("%p %p\n", This, pSessionDesc);
155 return E_NOTIMPL;
156}
157
158static HRESULT WINAPI dpvserver_GetCaps(IDirectPlayVoiceServer *iface, PDVCAPS pDVCaps)
159{
161 FIXME("%p %p\n", This, pDVCaps);
162 return E_NOTIMPL;
163}
164
165static HRESULT WINAPI dpvserver_GetCompressionTypes(IDirectPlayVoiceServer *iface, void *pData, DWORD *pdwDataSize,
166 DWORD *pdwNumElements, DWORD dwFlags)
167{
169 FIXME("%p %p %p %p %ld semi-stub\n", This, pData, pdwDataSize, pdwNumElements, dwFlags);
170 return DPVOICE_GetCompressionTypes(pData, pdwDataSize, pdwNumElements, dwFlags);
171}
172
173static HRESULT WINAPI dpvserver_SetTransmitTargets(IDirectPlayVoiceServer *iface, DVID dvSource, PDVID pdvIDTargets,
174 DWORD dwNumTargets, DWORD dwFlags)
175{
177 FIXME("%p %ld %p %ld %ld\n", This, dvSource, pdvIDTargets, dwNumTargets, dwFlags);
178 return E_NOTIMPL;
179}
180
181static HRESULT WINAPI dpvserver_GetTransmitTargets(IDirectPlayVoiceServer *iface, DVID dvSource, PDVID pdvIDTargets,
182 DWORD *pdwNumTargets, DWORD dwFlags)
183{
185 FIXME("%p %ld %p %p %ld\n", This, dvSource, pdvIDTargets, pdwNumTargets, dwFlags);
186 return E_NOTIMPL;
187}
188
189static HRESULT WINAPI dpvserver_SetNotifyMask(IDirectPlayVoiceServer *iface, DWORD *pdwMessageMask, DWORD dwMessageMaskElements)
190{
192 FIXME("%p %p %ld\n", This, pdwMessageMask, dwMessageMaskElements);
193 return E_NOTIMPL;
194}
195
196static const IDirectPlayVoiceServerVtbl DirectPlayVoiceServer_Vtbl =
197{
211};
212
214{
216 HRESULT ret;
217
218 TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppobj);
219
220 *ppobj = NULL;
221
223 if (!server)
224 return E_OUTOFMEMORY;
225
226 server->IDirectPlayVoiceServer_iface.lpVtbl = &DirectPlayVoiceServer_Vtbl;
227 server->ref = 1;
228
229 ret = IDirectPlayVoiceServer_QueryInterface(&server->IDirectPlayVoiceServer_iface, riid, ppobj);
230 IDirectPlayVoiceServer_Release(&server->IDirectPlayVoiceServer_iface);
231
232 return ret;
233}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112
static ULONG WINAPI dpvserver_Release(IDirectPlayVoiceServer *iface)
Definition: server.c:108
static HRESULT WINAPI dpvserver_Initialize(IDirectPlayVoiceServer *iface, IUnknown *lpVoid, PDVMESSAGEHANDLER pMessageHandler, void *pUserContext, DWORD *lpdwMessageMask, DWORD dwMessageMaskElements)
Definition: server.c:122
static const IDirectPlayVoiceServerVtbl DirectPlayVoiceServer_Vtbl
Definition: server.c:196
static HRESULT WINAPI dpvserver_SetNotifyMask(IDirectPlayVoiceServer *iface, DWORD *pdwMessageMask, DWORD dwMessageMaskElements)
Definition: server.c:189
static HRESULT WINAPI dpvserver_StopSession(IDirectPlayVoiceServer *iface, DWORD dwFlags)
Definition: server.c:137
static HRESULT WINAPI dpvserver_GetCompressionTypes(IDirectPlayVoiceServer *iface, void *pData, DWORD *pdwDataSize, DWORD *pdwNumElements, DWORD dwFlags)
Definition: server.c:165
static IDirectPlayVoiceServerImpl * impl_from_IDirectPlayVoiceServer(IDirectPlayVoiceServer *iface)
Definition: server.c:80
HRESULT DPVOICE_GetCompressionTypes(DVCOMPRESSIONINFO *pData, DWORD *pdwDataSize, DWORD *pdwNumElements, DWORD dwFlags)
Definition: server.c:42
static HRESULT WINAPI dpvserver_GetCaps(IDirectPlayVoiceServer *iface, PDVCAPS pDVCaps)
Definition: server.c:158
static HRESULT WINAPI dpvserver_StartSession(IDirectPlayVoiceServer *iface, PDVSESSIONDESC pSessionDesc, DWORD dwFlags)
Definition: server.c:130
static HRESULT WINAPI dpvserver_GetTransmitTargets(IDirectPlayVoiceServer *iface, DVID dvSource, PDVID pdvIDTargets, DWORD *pdwNumTargets, DWORD dwFlags)
Definition: server.c:181
static HRESULT WINAPI dpvserver_GetSessionDesc(IDirectPlayVoiceServer *iface, PDVSESSIONDESC pvSessionDesc)
Definition: server.c:144
static HRESULT WINAPI dpvserver_QueryInterface(IDirectPlayVoiceServer *iface, REFIID riid, void **ppv)
Definition: server.c:85
static HRESULT WINAPI dpvserver_SetSessionDesc(IDirectPlayVoiceServer *iface, PDVSESSIONDESC pSessionDesc)
Definition: server.c:151
HRESULT DPVOICE_CreateDirectPlayVoiceServer(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj)
Definition: server.c:213
static HRESULT WINAPI dpvserver_SetTransmitTargets(IDirectPlayVoiceServer *iface, DVID dvSource, PDVID pdvIDTargets, DWORD dwNumTargets, DWORD dwFlags)
Definition: server.c:173
static ULONG WINAPI dpvserver_AddRef(IDirectPlayVoiceServer *iface)
Definition: server.c:98
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
HRESULT(PASCAL * PDVMESSAGEHANDLER)(PVOID pvUserContext, DWORD dwMessageType, LPVOID lpMessage)
Definition: dvoice.h:57
#define IDirectPlayVoiceServer_QueryInterface(p, a, b)
Definition: dvoice.h:435
DWORD DVID
Definition: dvoice.h:60
#define IDirectPlayVoiceServer_Release(p)
Definition: dvoice.h:437
#define DVERR_INVALIDFLAGS
Definition: dvoice.h:312
#define DVERR_BUFFERTOOSMALL
Definition: dvoice.h:309
#define DVERR_INVALIDPOINTER
Definition: dvoice.h:350
DWORD * PDVID
Definition: dvoice.h:60
#define DV_OK
Definition: dvoice.h:304
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define TRACE(s)
Definition: solgame.cpp:4
Definition: dvoice.h:143
IDirectPlayVoiceServer IDirectPlayVoiceServer_iface
Definition: server.c:38
Definition: send.c:48
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
uint16_t * LPWSTR
Definition: typedefs.h:56
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:3479