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 /* IDirectPlay8Address IUnknown parts follow: */
40 static HRESULT WINAPI IDirectPlay8AddressImpl_QueryInterface(PDIRECTPLAY8ADDRESS iface, REFIID riid, LPVOID *ppobj)
42 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
44 if (IsEqualGUID(riid, &IID_IUnknown)
45 || IsEqualGUID(riid, &IID_IDirectPlay8Address)) {
46 IUnknown_AddRef(iface);
51 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
55 static ULONG WINAPI IDirectPlay8AddressImpl_AddRef(PDIRECTPLAY8ADDRESS iface) {
56 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
57 ULONG refCount = InterlockedIncrement(&This->ref);
59 TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
64 static ULONG WINAPI IDirectPlay8AddressImpl_Release(PDIRECTPLAY8ADDRESS iface) {
65 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
66 ULONG refCount = InterlockedDecrement(&This->ref);
68 TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
71 HeapFree(GetProcessHeap(), 0, This);
76 /* returns name of given GUID */
77 static const char *debugstr_SP(const GUID *id) {
78 static const guid_info guids[] = {
81 GE(CLSID_DP8SP_TCPIP),
82 GE(CLSID_DP8SP_SERIAL),
87 if (!id) return "(null)";
89 for (i = 0; i < sizeof(guids)/sizeof(guids[0]); i++) {
90 if (IsEqualGUID(id, guids[i].guid))
93 /* if we didn't find it, act like standard debugstr_guid */
94 return debugstr_guid(id);
97 /* IDirectPlay8Address Interface follow: */
99 static HRESULT WINAPI IDirectPlay8AddressImpl_BuildFromURLW(PDIRECTPLAY8ADDRESS iface, WCHAR* pwszSourceURL) {
100 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
101 TRACE("(%p, %s): stub\n", This, debugstr_w(pwszSourceURL));
105 static HRESULT WINAPI IDirectPlay8AddressImpl_BuildFromURLA(PDIRECTPLAY8ADDRESS iface, CHAR* pszSourceURL) {
106 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
107 TRACE("(%p, %s): stub\n", This, pszSourceURL);
111 static HRESULT WINAPI IDirectPlay8AddressImpl_Duplicate(PDIRECTPLAY8ADDRESS iface, PDIRECTPLAY8ADDRESS* ppdpaNewAddress) {
112 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
113 TRACE("(%p, %p): stub\n", This, ppdpaNewAddress);
117 static HRESULT WINAPI IDirectPlay8AddressImpl_SetEqual(PDIRECTPLAY8ADDRESS iface, PDIRECTPLAY8ADDRESS pdpaAddress) {
118 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
119 TRACE("(%p, %p): stub\n", This, pdpaAddress);
123 static HRESULT WINAPI IDirectPlay8AddressImpl_IsEqual(PDIRECTPLAY8ADDRESS iface, PDIRECTPLAY8ADDRESS pdpaAddress) {
124 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
125 TRACE("(%p, %p): stub\n", This, pdpaAddress);
129 static HRESULT WINAPI IDirectPlay8AddressImpl_Clear(PDIRECTPLAY8ADDRESS iface) {
130 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
131 TRACE("(%p): stub\n", This);
135 static HRESULT WINAPI IDirectPlay8AddressImpl_GetURLW(PDIRECTPLAY8ADDRESS iface, WCHAR* pwszURL, PDWORD pdwNumChars) {
136 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
137 TRACE("(%p): stub\n", This);
141 static HRESULT WINAPI IDirectPlay8AddressImpl_GetURLA(PDIRECTPLAY8ADDRESS iface, CHAR* pszURL, PDWORD pdwNumChars) {
142 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
143 TRACE("(%p): stub\n", This);
147 static HRESULT WINAPI IDirectPlay8AddressImpl_GetSP(PDIRECTPLAY8ADDRESS iface, GUID* pguidSP) {
148 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
149 TRACE("(%p, %p)\n", iface, pguidSP);
150 *pguidSP = This->SP_guid;
154 static HRESULT WINAPI IDirectPlay8AddressImpl_GetUserData(PDIRECTPLAY8ADDRESS iface, LPVOID pvUserData, PDWORD pdwBufferSize) {
155 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
156 TRACE("(%p): stub\n", This);
160 static HRESULT WINAPI IDirectPlay8AddressImpl_SetSP(PDIRECTPLAY8ADDRESS iface, CONST GUID* CONST pguidSP) {
161 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
162 TRACE("(%p, %s)\n", iface, debugstr_SP(pguidSP));
163 This->SP_guid = *pguidSP;
167 static HRESULT WINAPI IDirectPlay8AddressImpl_SetUserData(PDIRECTPLAY8ADDRESS iface, CONST void* CONST pvUserData, CONST DWORD dwDataSize) {
168 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
169 TRACE("(%p): stub\n", This);
173 static HRESULT WINAPI IDirectPlay8AddressImpl_GetNumComponents(PDIRECTPLAY8ADDRESS iface, PDWORD pdwNumComponents) {
174 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
175 TRACE("(%p): stub\n", This);
179 static HRESULT WINAPI IDirectPlay8AddressImpl_GetComponentByName(PDIRECTPLAY8ADDRESS iface, CONST WCHAR* CONST pwszName, LPVOID pvBuffer, PDWORD pdwBufferSize, PDWORD pdwDataType) {
180 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
181 TRACE("(%p): stub\n", This);
185 static HRESULT WINAPI IDirectPlay8AddressImpl_GetComponentByIndex(PDIRECTPLAY8ADDRESS iface, CONST DWORD dwComponentID, WCHAR* pwszName,
186 PDWORD pdwNameLen, void* pvBuffer, PDWORD pdwBufferSize, PDWORD pdwDataType) {
187 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
188 TRACE("(%p): stub\n", This);
192 static HRESULT WINAPI IDirectPlay8AddressImpl_AddComponent(PDIRECTPLAY8ADDRESS iface, CONST WCHAR* CONST pwszName,
193 CONST void* CONST lpvData, CONST DWORD dwDataSize, CONST DWORD dwDataType) {
194 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
195 TRACE("(%p, %s, %p, %u, %x): stub\n", This, debugstr_w(pwszName), lpvData, dwDataSize, dwDataType);
197 if (NULL == lpvData) return DPNERR_INVALIDPOINTER;
198 switch (dwDataType) {
199 case DPNA_DATATYPE_DWORD:
200 if (sizeof(DWORD) != dwDataSize) return DPNERR_INVALIDPARAM;
201 TRACE("(%p, %u): DWORD Type -> %u\n", lpvData, dwDataSize, *(const DWORD*) lpvData);
203 case DPNA_DATATYPE_GUID:
204 if (sizeof(GUID) != dwDataSize) return DPNERR_INVALIDPARAM;
205 TRACE("(%p, %u): GUID Type -> %s\n", lpvData, dwDataSize, debugstr_guid(lpvData));
207 case DPNA_DATATYPE_STRING:
208 TRACE("(%p, %u): STRING Type -> %s\n", lpvData, dwDataSize, (const CHAR*) lpvData);
210 case DPNA_DATATYPE_BINARY:
211 TRACE("(%p, %u): BINARY Type\n", lpvData, dwDataSize);
218 static HRESULT WINAPI IDirectPlay8AddressImpl_GetDevice(PDIRECTPLAY8ADDRESS iface, GUID* pDevGuid) {
219 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
220 TRACE("(%p): stub\n", This);
224 static HRESULT WINAPI IDirectPlay8AddressImpl_SetDevice(PDIRECTPLAY8ADDRESS iface, CONST GUID* CONST devGuid) {
225 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
226 TRACE("(%p, %s): stub\n", This, debugstr_guid(devGuid));
230 static HRESULT WINAPI IDirectPlay8AddressImpl_BuildFromDirectPlay4Address(PDIRECTPLAY8ADDRESS iface, LPVOID pvAddress, DWORD dwDataSize) {
231 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
232 TRACE("(%p): stub\n", This);
236 static const IDirectPlay8AddressVtbl DirectPlay8Address_Vtbl =
238 IDirectPlay8AddressImpl_QueryInterface,
239 IDirectPlay8AddressImpl_AddRef,
240 IDirectPlay8AddressImpl_Release,
241 IDirectPlay8AddressImpl_BuildFromURLW,
242 IDirectPlay8AddressImpl_BuildFromURLA,
243 IDirectPlay8AddressImpl_Duplicate,
244 IDirectPlay8AddressImpl_SetEqual,
245 IDirectPlay8AddressImpl_IsEqual,
246 IDirectPlay8AddressImpl_Clear,
247 IDirectPlay8AddressImpl_GetURLW,
248 IDirectPlay8AddressImpl_GetURLA,
249 IDirectPlay8AddressImpl_GetSP,
250 IDirectPlay8AddressImpl_GetUserData,
251 IDirectPlay8AddressImpl_SetSP,
252 IDirectPlay8AddressImpl_SetUserData,
253 IDirectPlay8AddressImpl_GetNumComponents,
254 IDirectPlay8AddressImpl_GetComponentByName,
255 IDirectPlay8AddressImpl_GetComponentByIndex,
256 IDirectPlay8AddressImpl_AddComponent,
257 IDirectPlay8AddressImpl_GetDevice,
258 IDirectPlay8AddressImpl_SetDevice,
259 IDirectPlay8AddressImpl_BuildFromDirectPlay4Address
262 HRESULT DPNET_CreateDirectPlay8Address(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) {
263 IDirectPlay8AddressImpl* client;
265 TRACE("(%p, %s, %p)\n", punkOuter, debugstr_guid(riid), ppobj);
267 client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8AddressImpl));
268 if (NULL == client) {
270 return E_OUTOFMEMORY;
272 client->lpVtbl = &DirectPlay8Address_Vtbl;
273 client->ref = 0; /* will be inited with QueryInterface */
274 return IDirectPlay8AddressImpl_QueryInterface ((PDIRECTPLAY8ADDRESS)client, riid, ppobj);