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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #include "wine/debug.h"
35 #include "dpnet_private.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(dpnet);
39 /* IDirectPlay8Address IUnknown parts follow: */
40 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 IDirectPlay8AddressImpl_AddRef(iface);
51 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
55 ULONG WINAPI IDirectPlay8AddressImpl_AddRef(PDIRECTPLAY8ADDRESS iface) {
56 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
57 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
61 ULONG WINAPI IDirectPlay8AddressImpl_Release(PDIRECTPLAY8ADDRESS iface) {
62 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
63 ULONG ref = --This->ref;
64 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
66 HeapFree(GetProcessHeap(), 0, This);
71 /* IDirectPlay8Address Interface follow: */
73 HRESULT WINAPI IDirectPlay8AddressImpl_BuildFromURLW(PDIRECTPLAY8ADDRESS iface, WCHAR* pwszSourceURL) {
74 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
75 TRACE("(%p, %s): stub\n", This, debugstr_w(pwszSourceURL));
79 HRESULT WINAPI IDirectPlay8AddressImpl_BuildFromURLA(PDIRECTPLAY8ADDRESS iface, CHAR* pszSourceURL) {
80 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
81 TRACE("(%p, %s): stub\n", This, pszSourceURL);
85 HRESULT WINAPI IDirectPlay8AddressImpl_Duplicate(PDIRECTPLAY8ADDRESS iface, PDIRECTPLAY8ADDRESS* ppdpaNewAddress) {
86 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
87 TRACE("(%p, %p): stub\n", This, ppdpaNewAddress);
91 HRESULT WINAPI IDirectPlay8AddressImpl_SetEqual(PDIRECTPLAY8ADDRESS iface, PDIRECTPLAY8ADDRESS pdpaAddress) {
92 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
93 TRACE("(%p, %p): stub\n", This, pdpaAddress);
97 HRESULT WINAPI IDirectPlay8AddressImpl_IsEqual(PDIRECTPLAY8ADDRESS iface, PDIRECTPLAY8ADDRESS pdpaAddress) {
98 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
99 TRACE("(%p, %p): stub\n", This, pdpaAddress);
103 HRESULT WINAPI IDirectPlay8AddressImpl_Clear(PDIRECTPLAY8ADDRESS iface) {
104 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
105 TRACE("(%p): stub\n", This);
109 HRESULT WINAPI IDirectPlay8AddressImpl_GetURLW(PDIRECTPLAY8ADDRESS iface, WCHAR* pwszURL, PDWORD pdwNumChars) {
110 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
111 TRACE("(%p): stub\n", This);
115 HRESULT WINAPI IDirectPlay8AddressImpl_GetURLA(PDIRECTPLAY8ADDRESS iface, CHAR* pszURL, PDWORD pdwNumChars) {
116 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
117 TRACE("(%p): stub\n", This);
121 HRESULT WINAPI IDirectPlay8AddressImpl_GetSP(PDIRECTPLAY8ADDRESS iface, GUID* pguidSP) {
122 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
123 TRACE("(%p, %p)\n", iface, pguidSP);
124 memcpy(pguidSP, &This->SP_guid, sizeof(GUID));
128 HRESULT WINAPI IDirectPlay8AddressImpl_GetUserData(PDIRECTPLAY8ADDRESS iface, LPVOID pvUserData, PDWORD pdwBufferSize) {
129 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
130 TRACE("(%p): stub\n", This);
134 HRESULT WINAPI IDirectPlay8AddressImpl_SetSP(PDIRECTPLAY8ADDRESS iface, CONST GUID* CONST pguidSP) {
135 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
136 TRACE("(%p, %s)\n", iface, debugstr_SP(pguidSP));
137 memcpy(&This->SP_guid, pguidSP, sizeof(GUID));
141 HRESULT WINAPI IDirectPlay8AddressImpl_SetUserData(PDIRECTPLAY8ADDRESS iface, CONST void* CONST pvUserData, CONST DWORD dwDataSize) {
142 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
143 TRACE("(%p): stub\n", This);
147 HRESULT WINAPI IDirectPlay8AddressImpl_GetNumComponents(PDIRECTPLAY8ADDRESS iface, PDWORD pdwNumComponents) {
148 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
149 TRACE("(%p): stub\n", This);
153 HRESULT WINAPI IDirectPlay8AddressImpl_GetComponentByName(PDIRECTPLAY8ADDRESS iface, CONST WCHAR* CONST pwszName, LPVOID pvBuffer, PDWORD pdwBufferSize, PDWORD pdwDataType) {
154 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
155 TRACE("(%p): stub\n", This);
159 HRESULT WINAPI IDirectPlay8AddressImpl_GetComponentByIndex(PDIRECTPLAY8ADDRESS iface, CONST DWORD dwComponentID, WCHAR* pwszName,
160 PDWORD pdwNameLen, void* pvBuffer, PDWORD pdwBufferSize, PDWORD pdwDataType) {
161 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
162 TRACE("(%p): stub\n", This);
166 HRESULT WINAPI IDirectPlay8AddressImpl_AddComponent(PDIRECTPLAY8ADDRESS iface, CONST WCHAR* CONST pwszName,
167 CONST void* CONST lpvData, CONST DWORD dwDataSize, CONST DWORD dwDataType) {
168 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
169 TRACE("(%p, %s, %p, %lu, %lx): stub\n", This, debugstr_w(pwszName), lpvData, dwDataSize, dwDataType);
171 if (NULL == lpvData) return DPNERR_INVALIDPOINTER;
172 switch (dwDataType) {
173 case DPNA_DATATYPE_DWORD:
174 if (sizeof(DWORD) != dwDataSize) return DPNERR_INVALIDPARAM;
175 TRACE("(%p, %lu): DWORD Type -> %lu \n", lpvData, dwDataSize, *(DWORD*) lpvData);
177 case DPNA_DATATYPE_GUID:
178 if (sizeof(GUID) != dwDataSize) return DPNERR_INVALIDPARAM;
179 TRACE("(%p, %lu): GUID Type -> %s \n", lpvData, dwDataSize, debugstr_guid((GUID*) lpvData));
181 case DPNA_DATATYPE_STRING:
182 TRACE("(%p, %lu): STRING Type -> %s \n", lpvData, dwDataSize, (CHAR*) lpvData);
184 case DPNA_DATATYPE_BINARY:
185 TRACE("(%p, %lu): BINARY Type\n", lpvData, dwDataSize);
192 HRESULT WINAPI IDirectPlay8AddressImpl_GetDevice(PDIRECTPLAY8ADDRESS iface, GUID* pDevGuid) {
193 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
194 TRACE("(%p): stub\n", This);
198 HRESULT WINAPI IDirectPlay8AddressImpl_SetDevice(PDIRECTPLAY8ADDRESS iface, CONST GUID* CONST devGuid) {
199 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
200 TRACE("(%p, %s): stub\n", This, debugstr_guid(devGuid));
204 HRESULT WINAPI IDirectPlay8AddressImpl_BuildFromDirectPlay4Address(PDIRECTPLAY8ADDRESS iface, LPVOID pvAddress, DWORD dwDataSize) {
205 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
206 TRACE("(%p): stub\n", This);
210 IDirectPlay8AddressVtbl DirectPlay8Address_Vtbl =
212 IDirectPlay8AddressImpl_QueryInterface,
213 IDirectPlay8AddressImpl_AddRef,
214 IDirectPlay8AddressImpl_Release,
215 IDirectPlay8AddressImpl_BuildFromURLW,
216 IDirectPlay8AddressImpl_BuildFromURLA,
217 IDirectPlay8AddressImpl_Duplicate,
218 IDirectPlay8AddressImpl_SetEqual,
219 IDirectPlay8AddressImpl_IsEqual,
220 IDirectPlay8AddressImpl_Clear,
221 IDirectPlay8AddressImpl_GetURLW,
222 IDirectPlay8AddressImpl_GetURLA,
223 IDirectPlay8AddressImpl_GetSP,
224 IDirectPlay8AddressImpl_GetUserData,
225 IDirectPlay8AddressImpl_SetSP,
226 IDirectPlay8AddressImpl_SetUserData,
227 IDirectPlay8AddressImpl_GetNumComponents,
228 IDirectPlay8AddressImpl_GetComponentByName,
229 IDirectPlay8AddressImpl_GetComponentByIndex,
230 IDirectPlay8AddressImpl_AddComponent,
231 IDirectPlay8AddressImpl_GetDevice,
232 IDirectPlay8AddressImpl_SetDevice,
233 IDirectPlay8AddressImpl_BuildFromDirectPlay4Address
236 HRESULT DPNET_CreateDirectPlay8Address(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) {
237 IDirectPlay8AddressImpl* client;
239 TRACE("(%p, %s, %p)\n", punkOuter, debugstr_guid(riid), ppobj);
241 client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8AddressImpl));
242 if (NULL == client) {
244 return E_OUTOFMEMORY;
246 client->lpVtbl = &DirectPlay8Address_Vtbl;
247 client->ref = 0; /* will be inited with QueryInterface */
248 return IDirectPlay8AddressImpl_QueryInterface ((PDIRECTPLAY8ADDRESS)client, riid, ppobj);
251 /* returns name of given GUID */
252 const char *debugstr_SP(const GUID *id) {
253 static const guid_info guids[] = {
256 GE(CLSID_DP8SP_TCPIP),
257 GE(CLSID_DP8SP_SERIAL),
258 GE(CLSID_DP8SP_MODEM)
262 if (!id) return "(null)";
264 for (i = 0; i < sizeof(guids)/sizeof(guids[0]); i++) {
265 if (IsEqualGUID(id, &guids[i].guid))
266 return guids[i].name;
268 /* if we didn't find it, act like standard debugstr_guid */
269 return debugstr_guid(id);