maintainers: Update the Direct3D section.
[wine.git] / dlls / dpnet / address.c
blobdbb5f83f4533179f31c7db8661d1aae05873c7c5
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
23 #include <stdarg.h>
25 #define COBJMACROS
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wingdi.h"
29 #include "winuser.h"
30 #include "objbase.h"
32 #include "wine/debug.h"
34 #include "dpnet_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(dpnet);
39 static char *heap_strdupA( const char *str )
41 char *ret;
43 if (!str) return NULL;
44 if ((ret = HeapAlloc( GetProcessHeap(), 0, strlen(str) + 1 ))) strcpy( ret, str );
45 return ret;
48 static BOOL add_component(IDirectPlay8AddressImpl *This, struct component *item)
50 if(This->comp_count == This->comp_array_size)
52 struct component **temp;
54 temp = heap_realloc(This->components, sizeof(*temp) * This->comp_array_size * 2 );
55 if(!temp)
57 return FALSE;
60 This->comp_array_size *= 2;
61 This->components = temp;
64 This->components[This->comp_count] = item;
65 This->comp_count++;
67 return TRUE;
70 static inline IDirectPlay8AddressImpl *impl_from_IDirectPlay8Address(IDirectPlay8Address *iface)
72 return CONTAINING_RECORD(iface, IDirectPlay8AddressImpl, IDirectPlay8Address_iface);
75 /* IDirectPlay8Address IUnknown parts follow: */
76 static HRESULT WINAPI IDirectPlay8AddressImpl_QueryInterface(IDirectPlay8Address *iface,
77 REFIID riid, void **ppv)
79 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectPlay8Address)) {
80 IUnknown_AddRef(iface);
81 *ppv = iface;
82 return DPN_OK;
85 WARN("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ppv);
86 return E_NOINTERFACE;
89 static ULONG WINAPI IDirectPlay8AddressImpl_AddRef(IDirectPlay8Address *iface)
91 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
92 ULONG ref = InterlockedIncrement(&This->ref);
94 TRACE("(%p) ref=%lu\n", This, ref);
96 return ref;
99 static ULONG WINAPI IDirectPlay8AddressImpl_Release(IDirectPlay8Address *iface)
101 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
102 ULONG ref = InterlockedDecrement(&This->ref);
104 TRACE("(%p) ref=%lu\n", This, ref);
106 if (!ref)
108 struct component *entry;
109 DWORD i;
111 for(i=0; i < This->comp_count; i++)
113 entry = This->components[i];
115 switch(entry->type)
117 case DPNA_DATATYPE_STRING:
118 heap_free(entry->data.string);
119 break;
120 case DPNA_DATATYPE_STRING_ANSI:
121 heap_free(entry->data.ansi);
122 break;
123 case DPNA_DATATYPE_BINARY:
124 heap_free(entry->data.binary);
125 break;
128 heap_free(entry->name);
129 heap_free(entry);
132 heap_free(This->components);
133 heap_free(This);
135 return ref;
138 /* returns name of given GUID */
139 static const char *debugstr_SP(const GUID *id) {
140 static const guid_info guids[] = {
141 /* CLSIDs */
142 GE(CLSID_DP8SP_IPX),
143 GE(CLSID_DP8SP_TCPIP),
144 GE(CLSID_DP8SP_SERIAL),
145 GE(CLSID_DP8SP_MODEM)
147 unsigned int i;
149 if (!id) return "(null)";
151 for (i = 0; i < ARRAY_SIZE(guids); i++) {
152 if (IsEqualGUID(id, guids[i].guid))
153 return guids[i].name;
155 /* if we didn't find it, act like standard debugstr_guid */
156 return debugstr_guid(id);
159 /* IDirectPlay8Address Interface follow: */
161 static HRESULT WINAPI IDirectPlay8AddressImpl_BuildFromURLW(IDirectPlay8Address *iface,
162 WCHAR *pwszSourceURL)
164 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
165 TRACE("(%p, %s): stub\n", This, debugstr_w(pwszSourceURL));
166 return DPN_OK;
169 static HRESULT WINAPI IDirectPlay8AddressImpl_BuildFromURLA(IDirectPlay8Address *iface,
170 CHAR *pszSourceURL)
172 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
173 TRACE("(%p, %s): stub\n", This, pszSourceURL);
174 return DPN_OK;
177 static HRESULT WINAPI IDirectPlay8AddressImpl_Duplicate(IDirectPlay8Address *iface,
178 IDirectPlay8Address **ppdpaNewAddress)
180 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
181 IDirectPlay8Address *dup;
182 HRESULT hr;
184 TRACE("(%p, %p)\n", This, ppdpaNewAddress);
186 if(!ppdpaNewAddress)
187 return E_POINTER;
189 hr = DPNET_CreateDirectPlay8Address(NULL, NULL, &IID_IDirectPlay8Address, (LPVOID*)&dup);
190 if(hr == S_OK)
192 IDirectPlay8AddressImpl *DupThis = impl_from_IDirectPlay8Address(dup);
193 DWORD i;
195 DupThis->SP_guid = This->SP_guid;
196 DupThis->init = This->init;
198 for(i=0; i < This->comp_count; i++)
200 struct component *entry = This->components[i];
202 switch (entry->type)
204 case DPNA_DATATYPE_DWORD:
205 hr = IDirectPlay8Address_AddComponent(dup, entry->name, &entry->data.value, entry->size, entry->type);
206 break;
207 case DPNA_DATATYPE_GUID:
208 hr = IDirectPlay8Address_AddComponent(dup, entry->name, &entry->data.guid, entry->size, entry->type);
209 break;
210 case DPNA_DATATYPE_STRING:
211 hr = IDirectPlay8Address_AddComponent(dup, entry->name, entry->data.string, entry->size, entry->type);
212 break;
213 case DPNA_DATATYPE_STRING_ANSI:
214 hr = IDirectPlay8Address_AddComponent(dup, entry->name, entry->data.ansi, entry->size, entry->type);
215 break;
216 case DPNA_DATATYPE_BINARY:
217 hr = IDirectPlay8Address_AddComponent(dup, entry->name, entry->data.binary, entry->size, entry->type);
218 break;
221 if(hr != S_OK)
223 IDirectPlay8Address_Release(dup);
224 dup = NULL;
225 ERR("Failed to copy component: %s - 0x%08lx\n", debugstr_w(entry->name), hr);
226 break;
230 *ppdpaNewAddress = dup;
233 return hr;
236 static HRESULT WINAPI IDirectPlay8AddressImpl_SetEqual(IDirectPlay8Address *iface,
237 IDirectPlay8Address *pdpaAddress)
239 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
240 TRACE("(%p, %p): stub\n", This, pdpaAddress);
241 return DPN_OK;
244 static HRESULT WINAPI IDirectPlay8AddressImpl_IsEqual(IDirectPlay8Address *iface,
245 IDirectPlay8Address *pdpaAddress)
247 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
248 TRACE("(%p, %p): stub\n", This, pdpaAddress);
249 return DPN_OK;
252 static HRESULT WINAPI IDirectPlay8AddressImpl_Clear(IDirectPlay8Address *iface)
254 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
255 TRACE("(%p): stub\n", This);
256 return DPN_OK;
259 static HRESULT WINAPI IDirectPlay8AddressImpl_GetURLW(IDirectPlay8Address *iface, WCHAR *url, DWORD *length)
261 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
262 HRESULT hr = DPNERR_BUFFERTOOSMALL;
263 int i;
264 WCHAR buffer[1024];
265 int position = 0;
267 TRACE("(%p, %p, %p)\n", This, url, length);
269 if(!length || (!url && *length != 0))
270 return DPNERR_INVALIDPOINTER;
272 for(i=0; i < This->comp_count; i++)
274 struct component *entry = This->components[i];
276 if (position) buffer[position++] = ';';
278 switch(entry->type)
280 case DPNA_DATATYPE_GUID:
281 position += swprintf( &buffer[position], ARRAY_SIZE(buffer) - position,
282 L"%s=%%7B%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X%%7D",
283 entry->name, entry->data.guid.Data1, entry->data.guid.Data2, entry->data.guid.Data3,
284 entry->data.guid.Data4[0], entry->data.guid.Data4[1], entry->data.guid.Data4[2],
285 entry->data.guid.Data4[3], entry->data.guid.Data4[4], entry->data.guid.Data4[5],
286 entry->data.guid.Data4[6], entry->data.guid.Data4[7] );
288 break;
289 case DPNA_DATATYPE_STRING:
290 position += swprintf(&buffer[position], ARRAY_SIZE(buffer) - position, L"%s=%s", entry->name, entry->data.string);
291 break;
292 case DPNA_DATATYPE_DWORD:
293 position += swprintf(&buffer[position], ARRAY_SIZE(buffer) - position, L"%s=%ld", entry->name, entry->data.value);
294 break;
295 case DPNA_DATATYPE_STRING_ANSI:
296 position += swprintf(&buffer[position], ARRAY_SIZE(buffer) - position, L"%s=%hs", entry->name, entry->data.ansi);
297 break;
298 case DPNA_DATATYPE_BINARY:
299 default:
300 FIXME("Unsupported type %ld\n", entry->type);
303 buffer[position] = 0;
305 if(url && *length >= lstrlenW(buffer) + lstrlenW(DPNA_HEADER) + 1)
307 lstrcpyW(url, DPNA_HEADER);
308 lstrcatW(url, buffer);
309 hr = DPN_OK;
312 *length = lstrlenW(buffer) + lstrlenW(DPNA_HEADER) + 1;
314 return hr;
317 static HRESULT WINAPI IDirectPlay8AddressImpl_GetURLA(IDirectPlay8Address *iface, char *url, DWORD *length)
319 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
320 HRESULT hr;
321 WCHAR *buffer = NULL;
323 TRACE("(%p, %p %p)\n", This, url, length);
325 if(!length || (!url && *length != 0))
326 return DPNERR_INVALIDPOINTER;
328 if(url && *length)
329 buffer = heap_alloc(*length * sizeof(WCHAR));
331 hr = IDirectPlay8Address_GetURLW(iface, buffer, length);
332 if(hr == DPN_OK)
334 DWORD size;
335 size = WideCharToMultiByte(CP_ACP, 0, buffer, -1, NULL, 0, NULL, NULL);
336 if(size <= *length)
337 WideCharToMultiByte(CP_ACP, 0, buffer, -1, url, *length, NULL, NULL);
338 else
340 *length = size;
341 hr = DPNERR_BUFFERTOOSMALL;
344 heap_free(buffer);
345 return hr;
348 static HRESULT WINAPI IDirectPlay8AddressImpl_GetSP(IDirectPlay8Address *iface, GUID *pguidSP)
350 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
352 TRACE("(%p, %p)\n", iface, pguidSP);
354 if(!pguidSP)
355 return DPNERR_INVALIDPOINTER;
357 if(!This->init)
358 return DPNERR_DOESNOTEXIST;
360 *pguidSP = This->SP_guid;
361 return DPN_OK;
364 static HRESULT WINAPI IDirectPlay8AddressImpl_GetUserData(IDirectPlay8Address *iface,
365 void *pvUserData, DWORD *pdwBufferSize)
367 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
368 TRACE("(%p): stub\n", This);
369 return DPN_OK;
372 static HRESULT WINAPI IDirectPlay8AddressImpl_SetSP(IDirectPlay8Address *iface,
373 const GUID *const pguidSP)
375 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
377 TRACE("(%p, %s)\n", iface, debugstr_SP(pguidSP));
379 if(!pguidSP)
380 return DPNERR_INVALIDPOINTER;
382 This->init = TRUE;
383 This->SP_guid = *pguidSP;
385 IDirectPlay8Address_AddComponent(iface, DPNA_KEY_PROVIDER, &This->SP_guid, sizeof(GUID), DPNA_DATATYPE_GUID);
387 return DPN_OK;
390 static HRESULT WINAPI IDirectPlay8AddressImpl_SetUserData(IDirectPlay8Address *iface,
391 const void *const pvUserData, const DWORD dwDataSize)
393 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
394 TRACE("(%p): stub\n", This);
395 return DPN_OK;
398 static HRESULT WINAPI IDirectPlay8AddressImpl_GetNumComponents(IDirectPlay8Address *iface,
399 DWORD *pdwNumComponents)
401 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
402 TRACE("(%p): stub\n", This);
404 if(!pdwNumComponents)
405 return DPNERR_INVALIDPOINTER;
407 *pdwNumComponents = This->comp_count;
409 return DPN_OK;
412 static HRESULT WINAPI IDirectPlay8AddressImpl_GetComponentByName(IDirectPlay8Address *iface,
413 const WCHAR *const pwszName, void *pvBuffer, DWORD *pdwBufferSize, DWORD *pdwDataType)
415 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
416 struct component *entry;
417 DWORD i;
419 TRACE("(%p)->(%s %p %p %p)\n", This, debugstr_w(pwszName), pvBuffer, pdwBufferSize, pdwDataType);
421 if(!pwszName || !pdwBufferSize || !pdwDataType || (!pvBuffer && *pdwBufferSize))
422 return E_POINTER;
424 for(i=0; i < This->comp_count; i++)
426 entry = This->components[i];
428 if (lstrcmpW(pwszName, entry->name) == 0)
430 TRACE("Found %s\n", debugstr_w(pwszName));
432 if(*pdwBufferSize < entry->size)
434 *pdwBufferSize = entry->size;
435 return DPNERR_BUFFERTOOSMALL;
438 *pdwBufferSize = entry->size;
439 *pdwDataType = entry->type;
441 switch (entry->type)
443 case DPNA_DATATYPE_DWORD:
444 memcpy(pvBuffer, &entry->data.value, sizeof(DWORD));
445 break;
446 case DPNA_DATATYPE_GUID:
447 memcpy(pvBuffer, &entry->data.guid, sizeof(GUID));
448 break;
449 case DPNA_DATATYPE_STRING:
450 memcpy(pvBuffer, entry->data.string, entry->size);
451 break;
452 case DPNA_DATATYPE_STRING_ANSI:
453 memcpy(pvBuffer, entry->data.ansi, entry->size);
454 break;
455 case DPNA_DATATYPE_BINARY:
456 memcpy(pvBuffer, entry->data.binary, entry->size);
457 break;
460 return S_OK;
464 return DPNERR_DOESNOTEXIST;
467 static HRESULT WINAPI IDirectPlay8AddressImpl_GetComponentByIndex(IDirectPlay8Address *iface,
468 const DWORD dwComponentID, WCHAR *pwszName, DWORD *pdwNameLen, void *pvBuffer,
469 DWORD *pdwBufferSize, DWORD *pdwDataType)
471 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
472 struct component *entry;
473 int namesize;
475 TRACE("(%p)->(%lu %p %p %p %p %p)\n", This, dwComponentID, pwszName, pdwNameLen, pvBuffer, pdwBufferSize, pdwDataType);
477 if(!pdwNameLen || !pdwBufferSize || !pdwDataType)
479 WARN("Invalid buffer (%p, %p, %p)\n", pdwNameLen, pdwBufferSize, pdwDataType);
480 return DPNERR_INVALIDPOINTER;
483 if(dwComponentID > This->comp_count)
485 WARN("dwComponentID out of range\n");
486 return DPNERR_DOESNOTEXIST;
489 entry = This->components[dwComponentID];
491 namesize = lstrlenW(entry->name);
492 if(*pdwBufferSize < entry->size || *pdwNameLen < namesize)
494 WARN("Buffer too small\n");
496 *pdwNameLen = namesize + 1;
497 *pdwBufferSize = entry->size;
498 *pdwDataType = entry->type;
499 return DPNERR_BUFFERTOOSMALL;
502 if(!pwszName || !pvBuffer)
504 WARN("Invalid buffer (%p, %p)\n", pwszName, pvBuffer);
505 return DPNERR_INVALIDPOINTER;
508 lstrcpyW(pwszName, entry->name);
510 *pdwNameLen = namesize + 1;
511 *pdwBufferSize = entry->size;
512 *pdwDataType = entry->type;
514 switch (entry->type)
516 case DPNA_DATATYPE_DWORD:
517 *(DWORD*)pvBuffer = entry->data.value;
518 break;
519 case DPNA_DATATYPE_GUID:
520 *(GUID*)pvBuffer = entry->data.guid;
521 break;
522 case DPNA_DATATYPE_STRING:
523 memcpy(pvBuffer, entry->data.string, entry->size);
524 break;
525 case DPNA_DATATYPE_STRING_ANSI:
526 memcpy(pvBuffer, entry->data.ansi, entry->size);
527 break;
528 case DPNA_DATATYPE_BINARY:
529 memcpy(pvBuffer, entry->data.binary, entry->size);
530 break;
533 return S_OK;
536 static HRESULT WINAPI IDirectPlay8AddressImpl_AddComponent(IDirectPlay8Address *iface,
537 const WCHAR *const pwszName, const void* const lpvData, const DWORD dwDataSize,
538 const DWORD dwDataType)
540 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
541 struct component *entry;
542 BOOL found = FALSE;
543 DWORD i;
545 TRACE("(%p, %s, %p, %lu, %lx)\n", This, debugstr_w(pwszName), lpvData, dwDataSize, dwDataType);
547 if (NULL == lpvData)
548 return DPNERR_INVALIDPOINTER;
550 switch (dwDataType)
552 case DPNA_DATATYPE_DWORD:
553 if (sizeof(DWORD) != dwDataSize)
555 WARN("Invalid DWORD size, returning DPNERR_INVALIDPARAM\n");
556 return DPNERR_INVALIDPARAM;
558 break;
559 case DPNA_DATATYPE_GUID:
560 if (sizeof(GUID) != dwDataSize)
562 WARN("Invalid GUID size, returning DPNERR_INVALIDPARAM\n");
563 return DPNERR_INVALIDPARAM;
565 break;
566 case DPNA_DATATYPE_STRING:
567 if (((lstrlenW((WCHAR*)lpvData)+1)*sizeof(WCHAR)) != dwDataSize)
569 WARN("Invalid STRING size, returning DPNERR_INVALIDPARAM\n");
570 return DPNERR_INVALIDPARAM;
572 break;
573 case DPNA_DATATYPE_STRING_ANSI:
574 if ((strlen((const CHAR*)lpvData)+1) != dwDataSize)
576 WARN("Invalid ANSI size, returning DPNERR_INVALIDPARAM\n");
577 return DPNERR_INVALIDPARAM;
579 break;
582 for(i=0; i < This->comp_count; i++)
584 entry = This->components[i];
586 if (lstrcmpW(pwszName, entry->name) == 0)
588 TRACE("Found %s\n", debugstr_w(pwszName));
589 found = TRUE;
591 if(entry->type == DPNA_DATATYPE_STRING_ANSI)
592 heap_free(entry->data.ansi);
593 else if(entry->type == DPNA_DATATYPE_STRING)
594 heap_free(entry->data.string);
595 else if(entry->type == DPNA_DATATYPE_BINARY)
596 heap_free(entry->data.binary);
598 break;
602 if(!found)
604 /* Create a new one */
605 entry = heap_alloc(sizeof(struct component));
606 if(!entry)
607 return E_OUTOFMEMORY;
609 entry->name = heap_strdupW(pwszName);
610 if(!entry->name)
612 heap_free(entry);
613 return E_OUTOFMEMORY;
616 if(!add_component(This, entry))
618 heap_free(entry->name);
619 heap_free(entry);
620 return E_OUTOFMEMORY;
624 switch (dwDataType)
626 case DPNA_DATATYPE_DWORD:
627 entry->data.value = *(DWORD*)lpvData;
628 TRACE("(%p, %lu): DWORD Type -> %lu\n", lpvData, dwDataSize, *(const DWORD*) lpvData);
629 break;
630 case DPNA_DATATYPE_GUID:
631 entry->data.guid = *(GUID*)lpvData;
632 TRACE("(%p, %lu): GUID Type -> %s\n", lpvData, dwDataSize, debugstr_guid(lpvData));
633 break;
634 case DPNA_DATATYPE_STRING:
635 entry->data.string = heap_strdupW((WCHAR*)lpvData);
636 TRACE("(%p, %lu): STRING Type -> %s\n", lpvData, dwDataSize, debugstr_w((WCHAR*)lpvData));
637 break;
638 case DPNA_DATATYPE_STRING_ANSI:
639 entry->data.ansi = heap_strdupA((CHAR*)lpvData);
640 TRACE("(%p, %lu): ANSI STRING Type -> %s\n", lpvData, dwDataSize, (const CHAR*) lpvData);
641 break;
642 case DPNA_DATATYPE_BINARY:
643 entry->data.binary = heap_alloc(dwDataSize);
644 memcpy(entry->data.binary, lpvData, dwDataSize);
645 TRACE("(%p, %lu): BINARY Type\n", lpvData, dwDataSize);
646 break;
649 entry->type = dwDataType;
650 entry->size = dwDataSize;
652 return DPN_OK;
655 static HRESULT WINAPI IDirectPlay8AddressImpl_GetDevice(IDirectPlay8Address *iface, GUID *pDevGuid) {
656 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
657 TRACE("(%p): stub\n", This);
658 return DPN_OK;
661 static HRESULT WINAPI IDirectPlay8AddressImpl_SetDevice(IDirectPlay8Address *iface,
662 const GUID *const devGuid)
664 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
665 TRACE("(%p, %s): stub\n", This, debugstr_guid(devGuid));
666 return DPN_OK;
669 static HRESULT WINAPI IDirectPlay8AddressImpl_BuildFromDirectPlay4Address(IDirectPlay8Address *iface,
670 void *pvAddress, DWORD dwDataSize)
672 IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
673 TRACE("(%p): stub\n", This);
674 return DPN_OK;
677 static const IDirectPlay8AddressVtbl DirectPlay8Address_Vtbl =
679 IDirectPlay8AddressImpl_QueryInterface,
680 IDirectPlay8AddressImpl_AddRef,
681 IDirectPlay8AddressImpl_Release,
682 IDirectPlay8AddressImpl_BuildFromURLW,
683 IDirectPlay8AddressImpl_BuildFromURLA,
684 IDirectPlay8AddressImpl_Duplicate,
685 IDirectPlay8AddressImpl_SetEqual,
686 IDirectPlay8AddressImpl_IsEqual,
687 IDirectPlay8AddressImpl_Clear,
688 IDirectPlay8AddressImpl_GetURLW,
689 IDirectPlay8AddressImpl_GetURLA,
690 IDirectPlay8AddressImpl_GetSP,
691 IDirectPlay8AddressImpl_GetUserData,
692 IDirectPlay8AddressImpl_SetSP,
693 IDirectPlay8AddressImpl_SetUserData,
694 IDirectPlay8AddressImpl_GetNumComponents,
695 IDirectPlay8AddressImpl_GetComponentByName,
696 IDirectPlay8AddressImpl_GetComponentByIndex,
697 IDirectPlay8AddressImpl_AddComponent,
698 IDirectPlay8AddressImpl_GetDevice,
699 IDirectPlay8AddressImpl_SetDevice,
700 IDirectPlay8AddressImpl_BuildFromDirectPlay4Address
703 HRESULT DPNET_CreateDirectPlay8Address(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, LPVOID *ppobj)
705 IDirectPlay8AddressImpl* client;
706 HRESULT ret;
708 TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppobj);
710 *ppobj = NULL;
712 client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8AddressImpl));
713 if (!client)
714 return E_OUTOFMEMORY;
716 client->IDirectPlay8Address_iface.lpVtbl = &DirectPlay8Address_Vtbl;
717 client->ref = 1;
718 client->comp_array_size = 4;
719 client->components = heap_alloc( sizeof(*client->components) * client->comp_array_size );
720 if(!client->components)
722 heap_free(client);
723 return E_OUTOFMEMORY;
726 ret = IDirectPlay8AddressImpl_QueryInterface(&client->IDirectPlay8Address_iface, riid, ppobj);
727 IDirectPlay8AddressImpl_Release(&client->IDirectPlay8Address_iface);
729 return ret;