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
32 #include "wine/debug.h"
34 #include "dpnet_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(dpnet
);
39 static char *heap_strdupA( const char *str
)
43 if (!str
) return NULL
;
44 if ((ret
= HeapAlloc( GetProcessHeap(), 0, strlen(str
) + 1 ))) strcpy( ret
, str
);
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 );
60 This
->comp_array_size
*= 2;
61 This
->components
= temp
;
64 This
->components
[This
->comp_count
] = item
;
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
);
85 WARN("(%p)->(%s,%p),not found\n", iface
, debugstr_guid(riid
), ppv
);
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
);
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
);
108 struct component
*entry
;
111 for(i
=0; i
< This
->comp_count
; i
++)
113 entry
= This
->components
[i
];
117 case DPNA_DATATYPE_STRING
:
118 heap_free(entry
->data
.string
);
120 case DPNA_DATATYPE_STRING_ANSI
:
121 heap_free(entry
->data
.ansi
);
123 case DPNA_DATATYPE_BINARY
:
124 heap_free(entry
->data
.binary
);
128 heap_free(entry
->name
);
132 heap_free(This
->components
);
138 /* returns name of given GUID */
139 static const char *debugstr_SP(const GUID
*id
) {
140 static const guid_info guids
[] = {
143 GE(CLSID_DP8SP_TCPIP
),
144 GE(CLSID_DP8SP_SERIAL
),
145 GE(CLSID_DP8SP_MODEM
)
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
));
169 static HRESULT WINAPI
IDirectPlay8AddressImpl_BuildFromURLA(IDirectPlay8Address
*iface
,
172 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
173 TRACE("(%p, %s): stub\n", This
, pszSourceURL
);
177 static HRESULT WINAPI
IDirectPlay8AddressImpl_Duplicate(IDirectPlay8Address
*iface
,
178 IDirectPlay8Address
**ppdpaNewAddress
)
180 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
181 IDirectPlay8Address
*dup
;
184 TRACE("(%p, %p)\n", This
, ppdpaNewAddress
);
189 hr
= DPNET_CreateDirectPlay8Address(NULL
, NULL
, &IID_IDirectPlay8Address
, (LPVOID
*)&dup
);
192 IDirectPlay8AddressImpl
*DupThis
= impl_from_IDirectPlay8Address(dup
);
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
];
204 case DPNA_DATATYPE_DWORD
:
205 hr
= IDirectPlay8Address_AddComponent(dup
, entry
->name
, &entry
->data
.value
, entry
->size
, entry
->type
);
207 case DPNA_DATATYPE_GUID
:
208 hr
= IDirectPlay8Address_AddComponent(dup
, entry
->name
, &entry
->data
.guid
, entry
->size
, entry
->type
);
210 case DPNA_DATATYPE_STRING
:
211 hr
= IDirectPlay8Address_AddComponent(dup
, entry
->name
, entry
->data
.string
, entry
->size
, entry
->type
);
213 case DPNA_DATATYPE_STRING_ANSI
:
214 hr
= IDirectPlay8Address_AddComponent(dup
, entry
->name
, entry
->data
.ansi
, entry
->size
, entry
->type
);
216 case DPNA_DATATYPE_BINARY
:
217 hr
= IDirectPlay8Address_AddComponent(dup
, entry
->name
, entry
->data
.binary
, entry
->size
, entry
->type
);
223 IDirectPlay8Address_Release(dup
);
225 ERR("Failed to copy component: %s - 0x%08lx\n", debugstr_w(entry
->name
), hr
);
230 *ppdpaNewAddress
= dup
;
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
);
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
);
252 static HRESULT WINAPI
IDirectPlay8AddressImpl_Clear(IDirectPlay8Address
*iface
)
254 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
255 TRACE("(%p): stub\n", This
);
259 static HRESULT WINAPI
IDirectPlay8AddressImpl_GetURLW(IDirectPlay8Address
*iface
, WCHAR
*url
, DWORD
*length
)
261 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
262 HRESULT hr
= DPNERR_BUFFERTOOSMALL
;
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
++] = ';';
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] );
289 case DPNA_DATATYPE_STRING
:
290 position
+= swprintf(&buffer
[position
], ARRAY_SIZE(buffer
) - position
, L
"%s=%s", entry
->name
, entry
->data
.string
);
292 case DPNA_DATATYPE_DWORD
:
293 position
+= swprintf(&buffer
[position
], ARRAY_SIZE(buffer
) - position
, L
"%s=%ld", entry
->name
, entry
->data
.value
);
295 case DPNA_DATATYPE_STRING_ANSI
:
296 position
+= swprintf(&buffer
[position
], ARRAY_SIZE(buffer
) - position
, L
"%s=%hs", entry
->name
, entry
->data
.ansi
);
298 case DPNA_DATATYPE_BINARY
:
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
);
312 *length
= lstrlenW(buffer
) + lstrlenW(DPNA_HEADER
) + 1;
317 static HRESULT WINAPI
IDirectPlay8AddressImpl_GetURLA(IDirectPlay8Address
*iface
, char *url
, DWORD
*length
)
319 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
321 WCHAR
*buffer
= NULL
;
323 TRACE("(%p, %p %p)\n", This
, url
, length
);
325 if(!length
|| (!url
&& *length
!= 0))
326 return DPNERR_INVALIDPOINTER
;
329 buffer
= heap_alloc(*length
* sizeof(WCHAR
));
331 hr
= IDirectPlay8Address_GetURLW(iface
, buffer
, length
);
335 size
= WideCharToMultiByte(CP_ACP
, 0, buffer
, -1, NULL
, 0, NULL
, NULL
);
337 WideCharToMultiByte(CP_ACP
, 0, buffer
, -1, url
, *length
, NULL
, NULL
);
341 hr
= DPNERR_BUFFERTOOSMALL
;
348 static HRESULT WINAPI
IDirectPlay8AddressImpl_GetSP(IDirectPlay8Address
*iface
, GUID
*pguidSP
)
350 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
352 TRACE("(%p, %p)\n", iface
, pguidSP
);
355 return DPNERR_INVALIDPOINTER
;
358 return DPNERR_DOESNOTEXIST
;
360 *pguidSP
= This
->SP_guid
;
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
);
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
));
380 return DPNERR_INVALIDPOINTER
;
383 This
->SP_guid
= *pguidSP
;
385 IDirectPlay8Address_AddComponent(iface
, DPNA_KEY_PROVIDER
, &This
->SP_guid
, sizeof(GUID
), DPNA_DATATYPE_GUID
);
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
);
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
;
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
;
419 TRACE("(%p)->(%s %p %p %p)\n", This
, debugstr_w(pwszName
), pvBuffer
, pdwBufferSize
, pdwDataType
);
421 if(!pwszName
|| !pdwBufferSize
|| !pdwDataType
|| (!pvBuffer
&& *pdwBufferSize
))
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
;
443 case DPNA_DATATYPE_DWORD
:
444 memcpy(pvBuffer
, &entry
->data
.value
, sizeof(DWORD
));
446 case DPNA_DATATYPE_GUID
:
447 memcpy(pvBuffer
, &entry
->data
.guid
, sizeof(GUID
));
449 case DPNA_DATATYPE_STRING
:
450 memcpy(pvBuffer
, entry
->data
.string
, entry
->size
);
452 case DPNA_DATATYPE_STRING_ANSI
:
453 memcpy(pvBuffer
, entry
->data
.ansi
, entry
->size
);
455 case DPNA_DATATYPE_BINARY
:
456 memcpy(pvBuffer
, entry
->data
.binary
, entry
->size
);
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
;
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
;
516 case DPNA_DATATYPE_DWORD
:
517 *(DWORD
*)pvBuffer
= entry
->data
.value
;
519 case DPNA_DATATYPE_GUID
:
520 *(GUID
*)pvBuffer
= entry
->data
.guid
;
522 case DPNA_DATATYPE_STRING
:
523 memcpy(pvBuffer
, entry
->data
.string
, entry
->size
);
525 case DPNA_DATATYPE_STRING_ANSI
:
526 memcpy(pvBuffer
, entry
->data
.ansi
, entry
->size
);
528 case DPNA_DATATYPE_BINARY
:
529 memcpy(pvBuffer
, entry
->data
.binary
, entry
->size
);
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
;
545 TRACE("(%p, %s, %p, %lu, %lx)\n", This
, debugstr_w(pwszName
), lpvData
, dwDataSize
, dwDataType
);
548 return DPNERR_INVALIDPOINTER
;
552 case DPNA_DATATYPE_DWORD
:
553 if (sizeof(DWORD
) != dwDataSize
)
555 WARN("Invalid DWORD size, returning DPNERR_INVALIDPARAM\n");
556 return DPNERR_INVALIDPARAM
;
559 case DPNA_DATATYPE_GUID
:
560 if (sizeof(GUID
) != dwDataSize
)
562 WARN("Invalid GUID size, returning DPNERR_INVALIDPARAM\n");
563 return DPNERR_INVALIDPARAM
;
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
;
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
;
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
));
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
);
604 /* Create a new one */
605 entry
= heap_alloc(sizeof(struct component
));
607 return E_OUTOFMEMORY
;
609 entry
->name
= heap_strdupW(pwszName
);
613 return E_OUTOFMEMORY
;
616 if(!add_component(This
, entry
))
618 heap_free(entry
->name
);
620 return E_OUTOFMEMORY
;
626 case DPNA_DATATYPE_DWORD
:
627 entry
->data
.value
= *(DWORD
*)lpvData
;
628 TRACE("(%p, %lu): DWORD Type -> %lu\n", lpvData
, dwDataSize
, *(const DWORD
*) lpvData
);
630 case DPNA_DATATYPE_GUID
:
631 entry
->data
.guid
= *(GUID
*)lpvData
;
632 TRACE("(%p, %lu): GUID Type -> %s\n", lpvData
, dwDataSize
, debugstr_guid(lpvData
));
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
));
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
);
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
);
649 entry
->type
= dwDataType
;
650 entry
->size
= dwDataSize
;
655 static HRESULT WINAPI
IDirectPlay8AddressImpl_GetDevice(IDirectPlay8Address
*iface
, GUID
*pDevGuid
) {
656 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
657 TRACE("(%p): stub\n", This
);
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
));
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
);
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
;
708 TRACE("(%p, %s, %p)\n", pUnkOuter
, debugstr_guid(riid
), ppobj
);
712 client
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDirectPlay8AddressImpl
));
714 return E_OUTOFMEMORY
;
716 client
->IDirectPlay8Address_iface
.lpVtbl
= &DirectPlay8Address_Vtbl
;
718 client
->comp_array_size
= 4;
719 client
->components
= heap_alloc( sizeof(*client
->components
) * client
->comp_array_size
);
720 if(!client
->components
)
723 return E_OUTOFMEMORY
;
726 ret
= IDirectPlay8AddressImpl_QueryInterface(&client
->IDirectPlay8Address_iface
, riid
, ppobj
);
727 IDirectPlay8AddressImpl_Release(&client
->IDirectPlay8Address_iface
);