winecfg: Update Korean resource.
[wine/hramrach.git] / dlls / dpnet / address.c
blobd3f34982b2b1616b5de5ace568a1ef29edc6f16c
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "config.h"
24 #include <stdarg.h>
26 #define COBJMACROS
27 #include "windef.h"
28 #include "winbase.h"
29 #include "wingdi.h"
30 #include "winuser.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 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);
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 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);
61 return refCount;
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);
70 if (!refCount) {
71 HeapFree(GetProcessHeap(), 0, This);
73 return refCount;
76 /* returns name of given GUID */
77 static const char *debugstr_SP(const GUID *id) {
78 static const guid_info guids[] = {
79 /* CLSIDs */
80 GE(CLSID_DP8SP_IPX),
81 GE(CLSID_DP8SP_TCPIP),
82 GE(CLSID_DP8SP_SERIAL),
83 GE(CLSID_DP8SP_MODEM)
85 unsigned int i;
87 if (!id) return "(null)";
89 for (i = 0; i < sizeof(guids)/sizeof(guids[0]); i++) {
90 if (IsEqualGUID(id, guids[i].guid))
91 return guids[i].name;
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));
102 return DPN_OK;
105 static HRESULT WINAPI IDirectPlay8AddressImpl_BuildFromURLA(PDIRECTPLAY8ADDRESS iface, CHAR* pszSourceURL) {
106 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
107 TRACE("(%p, %s): stub\n", This, pszSourceURL);
108 return DPN_OK;
111 static HRESULT WINAPI IDirectPlay8AddressImpl_Duplicate(PDIRECTPLAY8ADDRESS iface, PDIRECTPLAY8ADDRESS* ppdpaNewAddress) {
112 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
113 TRACE("(%p, %p): stub\n", This, ppdpaNewAddress);
114 return DPN_OK;
117 static HRESULT WINAPI IDirectPlay8AddressImpl_SetEqual(PDIRECTPLAY8ADDRESS iface, PDIRECTPLAY8ADDRESS pdpaAddress) {
118 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
119 TRACE("(%p, %p): stub\n", This, pdpaAddress);
120 return DPN_OK;
123 static HRESULT WINAPI IDirectPlay8AddressImpl_IsEqual(PDIRECTPLAY8ADDRESS iface, PDIRECTPLAY8ADDRESS pdpaAddress) {
124 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
125 TRACE("(%p, %p): stub\n", This, pdpaAddress);
126 return DPN_OK;
129 static HRESULT WINAPI IDirectPlay8AddressImpl_Clear(PDIRECTPLAY8ADDRESS iface) {
130 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
131 TRACE("(%p): stub\n", This);
132 return DPN_OK;
135 static HRESULT WINAPI IDirectPlay8AddressImpl_GetURLW(PDIRECTPLAY8ADDRESS iface, WCHAR* pwszURL, PDWORD pdwNumChars) {
136 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
137 TRACE("(%p): stub\n", This);
138 return DPN_OK;
141 static HRESULT WINAPI IDirectPlay8AddressImpl_GetURLA(PDIRECTPLAY8ADDRESS iface, CHAR* pszURL, PDWORD pdwNumChars) {
142 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
143 TRACE("(%p): stub\n", This);
144 return DPN_OK;
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;
151 return DPN_OK;
154 static HRESULT WINAPI IDirectPlay8AddressImpl_GetUserData(PDIRECTPLAY8ADDRESS iface, LPVOID pvUserData, PDWORD pdwBufferSize) {
155 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
156 TRACE("(%p): stub\n", This);
157 return DPN_OK;
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;
164 return DPN_OK;
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);
170 return DPN_OK;
173 static HRESULT WINAPI IDirectPlay8AddressImpl_GetNumComponents(PDIRECTPLAY8ADDRESS iface, PDWORD pdwNumComponents) {
174 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
175 TRACE("(%p): stub\n", This);
176 return DPN_OK;
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);
182 return DPN_OK;
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);
189 return DPN_OK;
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);
202 break;
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));
206 break;
207 case DPNA_DATATYPE_STRING:
208 TRACE("(%p, %u): STRING Type -> %s\n", lpvData, dwDataSize, (const CHAR*) lpvData);
209 break;
210 case DPNA_DATATYPE_BINARY:
211 TRACE("(%p, %u): BINARY Type\n", lpvData, dwDataSize);
212 break;
215 return DPN_OK;
218 static HRESULT WINAPI IDirectPlay8AddressImpl_GetDevice(PDIRECTPLAY8ADDRESS iface, GUID* pDevGuid) {
219 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
220 TRACE("(%p): stub\n", This);
221 return DPN_OK;
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));
227 return DPN_OK;
230 static HRESULT WINAPI IDirectPlay8AddressImpl_BuildFromDirectPlay4Address(PDIRECTPLAY8ADDRESS iface, LPVOID pvAddress, DWORD dwDataSize) {
231 IDirectPlay8AddressImpl *This = (IDirectPlay8AddressImpl *)iface;
232 TRACE("(%p): stub\n", This);
233 return DPN_OK;
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) {
269 *ppobj = NULL;
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);