4 * Copyright 2004 Raphael Junqueira
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.
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.
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
32 #include "wine/debug.h"
35 #include "dpnet_private.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(dpnet);
39 static inline IDirectPlay8AddressImpl *impl_from_IDirectPlay8Address(IDirectPlay8Address *iface)
41 return CONTAINING_RECORD(iface, IDirectPlay8AddressImpl, IDirectPlay8Address_iface);
44 /* IDirectPlay8Address IUnknown parts follow: */
45 static HRESULT WINAPI IDirectPlay8AddressImpl_QueryInterface(IDirectPlay8Address *iface,
46 REFIID riid, void **ppv)
48 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectPlay8Address)) {
49 IUnknown_AddRef(iface);
54 WARN("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ppv);
58 static ULONG WINAPI IDirectPlay8AddressImpl_AddRef(IDirectPlay8Address *iface)
60 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
61 ULONG refCount = InterlockedIncrement(&This->ref);
63 TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
68 static ULONG WINAPI IDirectPlay8AddressImpl_Release(IDirectPlay8Address *iface)
70 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
71 ULONG refCount = InterlockedDecrement(&This->ref);
73 TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
76 HeapFree(GetProcessHeap(), 0, This);
81 /* returns name of given GUID */
82 static const char *debugstr_SP(const GUID *id) {
83 static const guid_info guids[] = {
86 GE(CLSID_DP8SP_TCPIP),
87 GE(CLSID_DP8SP_SERIAL),
92 if (!id) return "(null)";
94 for (i = 0; i < sizeof(guids)/sizeof(guids[0]); i++) {
95 if (IsEqualGUID(id, guids[i].guid))
98 /* if we didn't find it, act like standard debugstr_guid */
99 return debugstr_guid(id);
102 /* IDirectPlay8Address Interface follow: */
104 static HRESULT WINAPI IDirectPlay8AddressImpl_BuildFromURLW(IDirectPlay8Address *iface,
105 WCHAR *pwszSourceURL)
107 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
108 TRACE("(%p, %s): stub\n", This, debugstr_w(pwszSourceURL));
112 static HRESULT WINAPI IDirectPlay8AddressImpl_BuildFromURLA(IDirectPlay8Address *iface,
115 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
116 TRACE("(%p, %s): stub\n", This, pszSourceURL);
120 static HRESULT WINAPI IDirectPlay8AddressImpl_Duplicate(IDirectPlay8Address *iface,
121 IDirectPlay8Address **ppdpaNewAddress)
123 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
124 TRACE("(%p, %p): stub\n", This, ppdpaNewAddress);
128 static HRESULT WINAPI IDirectPlay8AddressImpl_SetEqual(IDirectPlay8Address *iface,
129 IDirectPlay8Address *pdpaAddress)
131 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
132 TRACE("(%p, %p): stub\n", This, pdpaAddress);
136 static HRESULT WINAPI IDirectPlay8AddressImpl_IsEqual(IDirectPlay8Address *iface,
137 IDirectPlay8Address *pdpaAddress)
139 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
140 TRACE("(%p, %p): stub\n", This, pdpaAddress);
144 static HRESULT WINAPI IDirectPlay8AddressImpl_Clear(IDirectPlay8Address *iface)
146 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
147 TRACE("(%p): stub\n", This);
151 static HRESULT WINAPI IDirectPlay8AddressImpl_GetURLW(IDirectPlay8Address *iface, WCHAR *pwszURL,
154 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
155 TRACE("(%p): stub\n", This);
159 static HRESULT WINAPI IDirectPlay8AddressImpl_GetURLA(IDirectPlay8Address *iface, CHAR *pszURL,
162 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
163 TRACE("(%p): stub\n", This);
167 static HRESULT WINAPI IDirectPlay8AddressImpl_GetSP(IDirectPlay8Address *iface, GUID *pguidSP)
169 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
171 TRACE("(%p, %p)\n", iface, pguidSP);
173 *pguidSP = This->SP_guid;
177 static HRESULT WINAPI IDirectPlay8AddressImpl_GetUserData(IDirectPlay8Address *iface,
178 void *pvUserData, DWORD *pdwBufferSize)
180 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
181 TRACE("(%p): stub\n", This);
185 static HRESULT WINAPI IDirectPlay8AddressImpl_SetSP(IDirectPlay8Address *iface,
186 const GUID *const pguidSP)
188 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
190 TRACE("(%p, %s)\n", iface, debugstr_SP(pguidSP));
192 This->SP_guid = *pguidSP;
196 static HRESULT WINAPI IDirectPlay8AddressImpl_SetUserData(IDirectPlay8Address *iface,
197 const void *const pvUserData, const DWORD dwDataSize)
199 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
200 TRACE("(%p): stub\n", This);
204 static HRESULT WINAPI IDirectPlay8AddressImpl_GetNumComponents(IDirectPlay8Address *iface,
205 DWORD *pdwNumComponents)
207 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
208 TRACE("(%p): stub\n", This);
212 static HRESULT WINAPI IDirectPlay8AddressImpl_GetComponentByName(IDirectPlay8Address *iface,
213 const WCHAR *const pwszName, void *pvBuffer, DWORD *pdwBufferSize, DWORD *pdwDataType)
215 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
216 TRACE("(%p): stub\n", This);
220 static HRESULT WINAPI IDirectPlay8AddressImpl_GetComponentByIndex(IDirectPlay8Address *iface,
221 const DWORD dwComponentID, WCHAR *pwszName, DWORD *pdwNameLen, void *pvBuffer,
222 DWORD *pdwBufferSize, DWORD *pdwDataType)
224 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
225 TRACE("(%p): stub\n", This);
229 static HRESULT WINAPI IDirectPlay8AddressImpl_AddComponent(IDirectPlay8Address *iface,
230 const WCHAR *const pwszName, const void* const lpvData, const DWORD dwDataSize,
231 const DWORD dwDataType)
233 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
234 TRACE("(%p, %s, %p, %u, %x): stub\n", This, debugstr_w(pwszName), lpvData, dwDataSize, dwDataType);
236 if (NULL == lpvData) return DPNERR_INVALIDPOINTER;
237 switch (dwDataType) {
238 case DPNA_DATATYPE_DWORD:
239 if (sizeof(DWORD) != dwDataSize) return DPNERR_INVALIDPARAM;
240 TRACE("(%p, %u): DWORD Type -> %u\n", lpvData, dwDataSize, *(const DWORD*) lpvData);
242 case DPNA_DATATYPE_GUID:
243 if (sizeof(GUID) != dwDataSize) return DPNERR_INVALIDPARAM;
244 TRACE("(%p, %u): GUID Type -> %s\n", lpvData, dwDataSize, debugstr_guid(lpvData));
246 case DPNA_DATATYPE_STRING:
247 TRACE("(%p, %u): STRING Type -> %s\n", lpvData, dwDataSize, (const CHAR*) lpvData);
249 case DPNA_DATATYPE_BINARY:
250 TRACE("(%p, %u): BINARY Type\n", lpvData, dwDataSize);
257 static HRESULT WINAPI IDirectPlay8AddressImpl_GetDevice(IDirectPlay8Address *iface, GUID *pDevGuid) {
258 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
259 TRACE("(%p): stub\n", This);
263 static HRESULT WINAPI IDirectPlay8AddressImpl_SetDevice(IDirectPlay8Address *iface,
264 const GUID *const devGuid)
266 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
267 TRACE("(%p, %s): stub\n", This, debugstr_guid(devGuid));
271 static HRESULT WINAPI IDirectPlay8AddressImpl_BuildFromDirectPlay4Address(IDirectPlay8Address *iface,
272 void *pvAddress, DWORD dwDataSize)
274 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
275 TRACE("(%p): stub\n", This);
279 static const IDirectPlay8AddressVtbl DirectPlay8Address_Vtbl =
281 IDirectPlay8AddressImpl_QueryInterface,
282 IDirectPlay8AddressImpl_AddRef,
283 IDirectPlay8AddressImpl_Release,
284 IDirectPlay8AddressImpl_BuildFromURLW,
285 IDirectPlay8AddressImpl_BuildFromURLA,
286 IDirectPlay8AddressImpl_Duplicate,
287 IDirectPlay8AddressImpl_SetEqual,
288 IDirectPlay8AddressImpl_IsEqual,
289 IDirectPlay8AddressImpl_Clear,
290 IDirectPlay8AddressImpl_GetURLW,
291 IDirectPlay8AddressImpl_GetURLA,
292 IDirectPlay8AddressImpl_GetSP,
293 IDirectPlay8AddressImpl_GetUserData,
294 IDirectPlay8AddressImpl_SetSP,
295 IDirectPlay8AddressImpl_SetUserData,
296 IDirectPlay8AddressImpl_GetNumComponents,
297 IDirectPlay8AddressImpl_GetComponentByName,
298 IDirectPlay8AddressImpl_GetComponentByIndex,
299 IDirectPlay8AddressImpl_AddComponent,
300 IDirectPlay8AddressImpl_GetDevice,
301 IDirectPlay8AddressImpl_SetDevice,
302 IDirectPlay8AddressImpl_BuildFromDirectPlay4Address
305 HRESULT DPNET_CreateDirectPlay8Address(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) {
306 IDirectPlay8AddressImpl* client;
308 TRACE("(%p, %s, %p)\n", punkOuter, debugstr_guid(riid), ppobj);
310 client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8AddressImpl));
311 if (NULL == client) {
313 return E_OUTOFMEMORY;
315 client->IDirectPlay8Address_iface.lpVtbl = &DirectPlay8Address_Vtbl;
316 client->ref = 0; /* will be inited with QueryInterface */
317 return IDirectPlay8AddressImpl_QueryInterface (&client->IDirectPlay8Address_iface, riid, ppobj);