Removed some uses of the non-standard ICOM_THIS macro.
[wine/multimedia.git] / dlls / dpnet / address.c
blob4737a2ab5b451a5a59b6218c8bc670cd3eecb53c
1 /*
2 * DirectPlay8 Address
3 *
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
22 #include "config.h"
24 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wingdi.h"
29 #include "winuser.h"
30 #include "winreg.h"
31 #include "objbase.h"
32 #include "wine/debug.h"
34 #include "dplay8.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);
47 *ppobj = This;
48 return DPN_OK;
51 WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
52 return E_NOINTERFACE;
55 ULONG WINAPI IDirectPlay8AddressImpl_AddRef(PDIRECTPLAY8ADDRESS iface) {
56 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
57 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
58 return ++(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);
65 if (ref == 0) {
66 HeapFree(GetProcessHeap(), 0, This);
68 return ref;
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));
76 return DPN_OK;
79 HRESULT WINAPI IDirectPlay8AddressImpl_BuildFromURLA(PDIRECTPLAY8ADDRESS iface, CHAR* pszSourceURL) {
80 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
81 TRACE("(%p, %s): stub\n", This, pszSourceURL);
82 return DPN_OK;
85 HRESULT WINAPI IDirectPlay8AddressImpl_Duplicate(PDIRECTPLAY8ADDRESS iface, PDIRECTPLAY8ADDRESS* ppdpaNewAddress) {
86 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
87 TRACE("(%p, %p): stub\n", This, ppdpaNewAddress);
88 return DPN_OK;
91 HRESULT WINAPI IDirectPlay8AddressImpl_SetEqual(PDIRECTPLAY8ADDRESS iface, PDIRECTPLAY8ADDRESS pdpaAddress) {
92 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
93 TRACE("(%p, %p): stub\n", This, pdpaAddress);
94 return DPN_OK;
97 HRESULT WINAPI IDirectPlay8AddressImpl_IsEqual(PDIRECTPLAY8ADDRESS iface, PDIRECTPLAY8ADDRESS pdpaAddress) {
98 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
99 TRACE("(%p, %p): stub\n", This, pdpaAddress);
100 return DPN_OK;
103 HRESULT WINAPI IDirectPlay8AddressImpl_Clear(PDIRECTPLAY8ADDRESS iface) {
104 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
105 TRACE("(%p): stub\n", This);
106 return DPN_OK;
109 HRESULT WINAPI IDirectPlay8AddressImpl_GetURLW(PDIRECTPLAY8ADDRESS iface, WCHAR* pwszURL, PDWORD pdwNumChars) {
110 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
111 TRACE("(%p): stub\n", This);
112 return DPN_OK;
115 HRESULT WINAPI IDirectPlay8AddressImpl_GetURLA(PDIRECTPLAY8ADDRESS iface, CHAR* pszURL, PDWORD pdwNumChars) {
116 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
117 TRACE("(%p): stub\n", This);
118 return DPN_OK;
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));
125 return DPN_OK;
128 HRESULT WINAPI IDirectPlay8AddressImpl_GetUserData(PDIRECTPLAY8ADDRESS iface, LPVOID pvUserData, PDWORD pdwBufferSize) {
129 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
130 TRACE("(%p): stub\n", This);
131 return DPN_OK;
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));
138 return DPN_OK;
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);
144 return DPN_OK;
147 HRESULT WINAPI IDirectPlay8AddressImpl_GetNumComponents(PDIRECTPLAY8ADDRESS iface, PDWORD pdwNumComponents) {
148 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
149 TRACE("(%p): stub\n", This);
150 return DPN_OK;
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);
156 return DPN_OK;
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);
163 return DPN_OK;
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);
176 break;
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));
180 break;
181 case DPNA_DATATYPE_STRING:
182 TRACE("(%p, %lu): STRING Type -> %s \n", lpvData, dwDataSize, (CHAR*) lpvData);
183 break;
184 case DPNA_DATATYPE_BINARY:
185 TRACE("(%p, %lu): BINARY Type\n", lpvData, dwDataSize);
186 break;
189 return DPN_OK;
192 HRESULT WINAPI IDirectPlay8AddressImpl_GetDevice(PDIRECTPLAY8ADDRESS iface, GUID* pDevGuid) {
193 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
194 TRACE("(%p): stub\n", This);
195 return DPN_OK;
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));
201 return DPN_OK;
204 HRESULT WINAPI IDirectPlay8AddressImpl_BuildFromDirectPlay4Address(PDIRECTPLAY8ADDRESS iface, LPVOID pvAddress, DWORD dwDataSize) {
205 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
206 TRACE("(%p): stub\n", This);
207 return DPN_OK;
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) {
243 *ppobj = NULL;
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[] = {
254 /* CLSIDs */
255 GE(CLSID_DP8SP_IPX),
256 GE(CLSID_DP8SP_TCPIP),
257 GE(CLSID_DP8SP_SERIAL),
258 GE(CLSID_DP8SP_MODEM)
260 unsigned int i;
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);