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 ICOM_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 ICOM_THIS(IDirectPlay8AddressImpl
,iface
);
57 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
61 ULONG WINAPI
IDirectPlay8AddressImpl_Release(PDIRECTPLAY8ADDRESS iface
) {
62 ICOM_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 ICOM_THIS(IDirectPlay8AddressImpl
,iface
);
75 TRACE("(%p, %s): stub\n", This
, debugstr_w(pwszSourceURL
));
79 HRESULT WINAPI
IDirectPlay8AddressImpl_BuildFromURLA(PDIRECTPLAY8ADDRESS iface
, CHAR
* pszSourceURL
) {
80 ICOM_THIS(IDirectPlay8AddressImpl
,iface
);
81 TRACE("(%p, %s): stub\n", This
, pszSourceURL
);
85 HRESULT WINAPI
IDirectPlay8AddressImpl_Duplicate(PDIRECTPLAY8ADDRESS iface
, PDIRECTPLAY8ADDRESS
* ppdpaNewAddress
) {
86 ICOM_THIS(IDirectPlay8AddressImpl
,iface
);
87 TRACE("(%p, %p): stub\n", This
, ppdpaNewAddress
);
91 HRESULT WINAPI
IDirectPlay8AddressImpl_SetEqual(PDIRECTPLAY8ADDRESS iface
, PDIRECTPLAY8ADDRESS pdpaAddress
) {
92 ICOM_THIS(IDirectPlay8AddressImpl
,iface
);
93 TRACE("(%p, %p): stub\n", This
, pdpaAddress
);
97 HRESULT WINAPI
IDirectPlay8AddressImpl_IsEqual(PDIRECTPLAY8ADDRESS iface
, PDIRECTPLAY8ADDRESS pdpaAddress
) {
98 ICOM_THIS(IDirectPlay8AddressImpl
,iface
);
99 TRACE("(%p, %p): stub\n", This
, pdpaAddress
);
103 HRESULT WINAPI
IDirectPlay8AddressImpl_Clear(PDIRECTPLAY8ADDRESS iface
) {
104 ICOM_THIS(IDirectPlay8AddressImpl
,iface
);
105 TRACE("(%p): stub\n", This
);
109 HRESULT WINAPI
IDirectPlay8AddressImpl_GetURLW(PDIRECTPLAY8ADDRESS iface
, WCHAR
* pwszURL
, PDWORD pdwNumChars
) {
110 ICOM_THIS(IDirectPlay8AddressImpl
,iface
);
111 TRACE("(%p): stub\n", This
);
115 HRESULT WINAPI
IDirectPlay8AddressImpl_GetURLA(PDIRECTPLAY8ADDRESS iface
, CHAR
* pszURL
, PDWORD pdwNumChars
) {
116 ICOM_THIS(IDirectPlay8AddressImpl
,iface
);
117 TRACE("(%p): stub\n", This
);
121 HRESULT WINAPI
IDirectPlay8AddressImpl_GetSP(PDIRECTPLAY8ADDRESS iface
, GUID
* pguidSP
) {
122 ICOM_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 ICOM_THIS(IDirectPlay8AddressImpl
,iface
);
130 TRACE("(%p): stub\n", This
);
134 HRESULT WINAPI
IDirectPlay8AddressImpl_SetSP(PDIRECTPLAY8ADDRESS iface
, CONST GUID
* CONST pguidSP
) {
135 ICOM_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 ICOM_THIS(IDirectPlay8AddressImpl
,iface
);
143 TRACE("(%p): stub\n", This
);
147 HRESULT WINAPI
IDirectPlay8AddressImpl_GetNumComponents(PDIRECTPLAY8ADDRESS iface
, PDWORD pdwNumComponents
) {
148 ICOM_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 ICOM_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 ICOM_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 ICOM_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 ICOM_THIS(IDirectPlay8AddressImpl
,iface
);
194 TRACE("(%p): stub\n", This
);
198 HRESULT WINAPI
IDirectPlay8AddressImpl_SetDevice(PDIRECTPLAY8ADDRESS iface
, CONST GUID
* CONST devGuid
) {
199 ICOM_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 ICOM_THIS(IDirectPlay8AddressImpl
,iface
);
206 TRACE("(%p): stub\n", This
);
210 IDirectPlay8AddressVtbl DirectPlay8Address_Vtbl
=
212 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
213 IDirectPlay8AddressImpl_QueryInterface
,
214 IDirectPlay8AddressImpl_AddRef
,
215 IDirectPlay8AddressImpl_Release
,
216 IDirectPlay8AddressImpl_BuildFromURLW
,
217 IDirectPlay8AddressImpl_BuildFromURLA
,
218 IDirectPlay8AddressImpl_Duplicate
,
219 IDirectPlay8AddressImpl_SetEqual
,
220 IDirectPlay8AddressImpl_IsEqual
,
221 IDirectPlay8AddressImpl_Clear
,
222 IDirectPlay8AddressImpl_GetURLW
,
223 IDirectPlay8AddressImpl_GetURLA
,
224 IDirectPlay8AddressImpl_GetSP
,
225 IDirectPlay8AddressImpl_GetUserData
,
226 IDirectPlay8AddressImpl_SetSP
,
227 IDirectPlay8AddressImpl_SetUserData
,
228 IDirectPlay8AddressImpl_GetNumComponents
,
229 IDirectPlay8AddressImpl_GetComponentByName
,
230 IDirectPlay8AddressImpl_GetComponentByIndex
,
231 IDirectPlay8AddressImpl_AddComponent
,
232 IDirectPlay8AddressImpl_GetDevice
,
233 IDirectPlay8AddressImpl_SetDevice
,
234 IDirectPlay8AddressImpl_BuildFromDirectPlay4Address
237 HRESULT
DPNET_CreateDirectPlay8Address(LPCLASSFACTORY iface
, LPUNKNOWN punkOuter
, REFIID riid
, LPVOID
*ppobj
) {
238 IDirectPlay8AddressImpl
* client
;
240 TRACE("(%p, %s, %p)\n", punkOuter
, debugstr_guid(riid
), ppobj
);
242 client
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectPlay8AddressImpl
));
243 if (NULL
== client
) {
245 return E_OUTOFMEMORY
;
247 client
->lpVtbl
= &DirectPlay8Address_Vtbl
;
248 client
->ref
= 0; /* will be inited with QueryInterface */
249 return IDirectPlay8AddressImpl_QueryInterface ((PDIRECTPLAY8ADDRESS
)client
, riid
, ppobj
);
252 /* returns name of given GUID */
253 const char *debugstr_SP(const GUID
*id
) {
254 static const guid_info guids
[] = {
257 GE(CLSID_DP8SP_TCPIP
),
258 GE(CLSID_DP8SP_SERIAL
),
259 GE(CLSID_DP8SP_MODEM
)
263 if (!id
) return "(null)";
265 for (i
= 0; i
< sizeof(guids
)/sizeof(guids
[0]); i
++) {
266 if (IsEqualGUID(id
, &guids
[i
].guid
))
267 return guids
[i
].name
;
269 /* if we didn't find it, act like standard debugstr_guid */
270 return debugstr_guid(id
);