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 BOOL
add_component(IDirectPlay8AddressImpl
*This
, struct component
*item
)
41 if(This
->comp_count
== This
->comp_array_size
)
43 struct component
**temp
;
45 temp
= realloc(This
->components
, sizeof(*temp
) * This
->comp_array_size
* 2);
51 This
->comp_array_size
*= 2;
52 This
->components
= temp
;
55 This
->components
[This
->comp_count
] = item
;
61 static inline IDirectPlay8AddressImpl
*impl_from_IDirectPlay8Address(IDirectPlay8Address
*iface
)
63 return CONTAINING_RECORD(iface
, IDirectPlay8AddressImpl
, IDirectPlay8Address_iface
);
66 /* IDirectPlay8Address IUnknown parts follow: */
67 static HRESULT WINAPI
IDirectPlay8AddressImpl_QueryInterface(IDirectPlay8Address
*iface
,
68 REFIID riid
, void **ppv
)
70 if (IsEqualGUID(riid
, &IID_IUnknown
) || IsEqualGUID(riid
, &IID_IDirectPlay8Address
)) {
71 IUnknown_AddRef(iface
);
76 WARN("(%p)->(%s,%p),not found\n", iface
, debugstr_guid(riid
), ppv
);
80 static ULONG WINAPI
IDirectPlay8AddressImpl_AddRef(IDirectPlay8Address
*iface
)
82 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
83 ULONG ref
= InterlockedIncrement(&This
->ref
);
85 TRACE("(%p) ref=%lu\n", This
, ref
);
90 static ULONG WINAPI
IDirectPlay8AddressImpl_Release(IDirectPlay8Address
*iface
)
92 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
93 ULONG ref
= InterlockedDecrement(&This
->ref
);
95 TRACE("(%p) ref=%lu\n", This
, ref
);
99 struct component
*entry
;
102 for(i
=0; i
< This
->comp_count
; i
++)
104 entry
= This
->components
[i
];
108 case DPNA_DATATYPE_STRING
:
109 free(entry
->data
.string
);
111 case DPNA_DATATYPE_STRING_ANSI
:
112 free(entry
->data
.ansi
);
114 case DPNA_DATATYPE_BINARY
:
115 free(entry
->data
.binary
);
123 free(This
->components
);
129 /* returns name of given GUID */
130 static const char *debugstr_SP(const GUID
*id
) {
131 static const guid_info guids
[] = {
134 GE(CLSID_DP8SP_TCPIP
),
135 GE(CLSID_DP8SP_SERIAL
),
136 GE(CLSID_DP8SP_MODEM
)
140 if (!id
) return "(null)";
142 for (i
= 0; i
< ARRAY_SIZE(guids
); i
++) {
143 if (IsEqualGUID(id
, guids
[i
].guid
))
144 return guids
[i
].name
;
146 /* if we didn't find it, act like standard debugstr_guid */
147 return debugstr_guid(id
);
150 /* IDirectPlay8Address Interface follow: */
152 static HRESULT WINAPI
IDirectPlay8AddressImpl_BuildFromURLW(IDirectPlay8Address
*iface
,
153 WCHAR
*pwszSourceURL
)
155 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
156 TRACE("(%p, %s): stub\n", This
, debugstr_w(pwszSourceURL
));
160 static HRESULT WINAPI
IDirectPlay8AddressImpl_BuildFromURLA(IDirectPlay8Address
*iface
,
163 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
164 TRACE("(%p, %s): stub\n", This
, pszSourceURL
);
168 static HRESULT WINAPI
IDirectPlay8AddressImpl_Duplicate(IDirectPlay8Address
*iface
,
169 IDirectPlay8Address
**ppdpaNewAddress
)
171 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
172 IDirectPlay8Address
*dup
;
175 TRACE("(%p, %p)\n", This
, ppdpaNewAddress
);
180 hr
= DPNET_CreateDirectPlay8Address(NULL
, NULL
, &IID_IDirectPlay8Address
, (LPVOID
*)&dup
);
183 IDirectPlay8AddressImpl
*DupThis
= impl_from_IDirectPlay8Address(dup
);
186 DupThis
->SP_guid
= This
->SP_guid
;
187 DupThis
->init
= This
->init
;
189 for(i
=0; i
< This
->comp_count
; i
++)
191 struct component
*entry
= This
->components
[i
];
195 case DPNA_DATATYPE_DWORD
:
196 hr
= IDirectPlay8Address_AddComponent(dup
, entry
->name
, &entry
->data
.value
, entry
->size
, entry
->type
);
198 case DPNA_DATATYPE_GUID
:
199 hr
= IDirectPlay8Address_AddComponent(dup
, entry
->name
, &entry
->data
.guid
, entry
->size
, entry
->type
);
201 case DPNA_DATATYPE_STRING
:
202 hr
= IDirectPlay8Address_AddComponent(dup
, entry
->name
, entry
->data
.string
, entry
->size
, entry
->type
);
204 case DPNA_DATATYPE_STRING_ANSI
:
205 hr
= IDirectPlay8Address_AddComponent(dup
, entry
->name
, entry
->data
.ansi
, entry
->size
, entry
->type
);
207 case DPNA_DATATYPE_BINARY
:
208 hr
= IDirectPlay8Address_AddComponent(dup
, entry
->name
, entry
->data
.binary
, entry
->size
, entry
->type
);
214 IDirectPlay8Address_Release(dup
);
216 ERR("Failed to copy component: %s - 0x%08lx\n", debugstr_w(entry
->name
), hr
);
221 *ppdpaNewAddress
= dup
;
227 static HRESULT WINAPI
IDirectPlay8AddressImpl_SetEqual(IDirectPlay8Address
*iface
,
228 IDirectPlay8Address
*pdpaAddress
)
230 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
231 TRACE("(%p, %p): stub\n", This
, pdpaAddress
);
235 static HRESULT WINAPI
IDirectPlay8AddressImpl_IsEqual(IDirectPlay8Address
*iface
,
236 IDirectPlay8Address
*pdpaAddress
)
238 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
239 TRACE("(%p, %p): stub\n", This
, pdpaAddress
);
243 static HRESULT WINAPI
IDirectPlay8AddressImpl_Clear(IDirectPlay8Address
*iface
)
245 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
246 TRACE("(%p): stub\n", This
);
250 static HRESULT WINAPI
IDirectPlay8AddressImpl_GetURLW(IDirectPlay8Address
*iface
, WCHAR
*url
, DWORD
*length
)
252 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
253 HRESULT hr
= DPNERR_BUFFERTOOSMALL
;
258 TRACE("(%p, %p, %p)\n", This
, url
, length
);
260 if(!length
|| (!url
&& *length
!= 0))
261 return DPNERR_INVALIDPOINTER
;
263 for(i
=0; i
< This
->comp_count
; i
++)
265 struct component
*entry
= This
->components
[i
];
267 if (position
) buffer
[position
++] = ';';
271 case DPNA_DATATYPE_GUID
:
272 position
+= swprintf( &buffer
[position
], ARRAY_SIZE(buffer
) - position
,
273 L
"%s=%%7B%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X%%7D",
274 entry
->name
, entry
->data
.guid
.Data1
, entry
->data
.guid
.Data2
, entry
->data
.guid
.Data3
,
275 entry
->data
.guid
.Data4
[0], entry
->data
.guid
.Data4
[1], entry
->data
.guid
.Data4
[2],
276 entry
->data
.guid
.Data4
[3], entry
->data
.guid
.Data4
[4], entry
->data
.guid
.Data4
[5],
277 entry
->data
.guid
.Data4
[6], entry
->data
.guid
.Data4
[7] );
280 case DPNA_DATATYPE_STRING
:
281 position
+= swprintf(&buffer
[position
], ARRAY_SIZE(buffer
) - position
, L
"%s=%s", entry
->name
, entry
->data
.string
);
283 case DPNA_DATATYPE_DWORD
:
284 position
+= swprintf(&buffer
[position
], ARRAY_SIZE(buffer
) - position
, L
"%s=%ld", entry
->name
, entry
->data
.value
);
286 case DPNA_DATATYPE_STRING_ANSI
:
287 position
+= swprintf(&buffer
[position
], ARRAY_SIZE(buffer
) - position
, L
"%s=%hs", entry
->name
, entry
->data
.ansi
);
289 case DPNA_DATATYPE_BINARY
:
291 FIXME("Unsupported type %ld\n", entry
->type
);
294 buffer
[position
] = 0;
296 if(url
&& *length
>= lstrlenW(buffer
) + lstrlenW(DPNA_HEADER
) + 1)
298 lstrcpyW(url
, DPNA_HEADER
);
299 lstrcatW(url
, buffer
);
303 *length
= lstrlenW(buffer
) + lstrlenW(DPNA_HEADER
) + 1;
308 static HRESULT WINAPI
IDirectPlay8AddressImpl_GetURLA(IDirectPlay8Address
*iface
, char *url
, DWORD
*length
)
310 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
312 WCHAR
*buffer
= NULL
;
314 TRACE("(%p, %p %p)\n", This
, url
, length
);
316 if(!length
|| (!url
&& *length
!= 0))
317 return DPNERR_INVALIDPOINTER
;
320 buffer
= malloc(*length
* sizeof(WCHAR
));
322 hr
= IDirectPlay8Address_GetURLW(iface
, buffer
, length
);
326 size
= WideCharToMultiByte(CP_ACP
, 0, buffer
, -1, NULL
, 0, NULL
, NULL
);
328 WideCharToMultiByte(CP_ACP
, 0, buffer
, -1, url
, *length
, NULL
, NULL
);
332 hr
= DPNERR_BUFFERTOOSMALL
;
339 static HRESULT WINAPI
IDirectPlay8AddressImpl_GetSP(IDirectPlay8Address
*iface
, GUID
*pguidSP
)
341 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
343 TRACE("(%p, %p)\n", iface
, pguidSP
);
346 return DPNERR_INVALIDPOINTER
;
349 return DPNERR_DOESNOTEXIST
;
351 *pguidSP
= This
->SP_guid
;
355 static HRESULT WINAPI
IDirectPlay8AddressImpl_GetUserData(IDirectPlay8Address
*iface
,
356 void *pvUserData
, DWORD
*pdwBufferSize
)
358 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
359 TRACE("(%p): stub\n", This
);
363 static HRESULT WINAPI
IDirectPlay8AddressImpl_SetSP(IDirectPlay8Address
*iface
,
364 const GUID
*const pguidSP
)
366 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
368 TRACE("(%p, %s)\n", iface
, debugstr_SP(pguidSP
));
371 return DPNERR_INVALIDPOINTER
;
374 This
->SP_guid
= *pguidSP
;
376 IDirectPlay8Address_AddComponent(iface
, DPNA_KEY_PROVIDER
, &This
->SP_guid
, sizeof(GUID
), DPNA_DATATYPE_GUID
);
381 static HRESULT WINAPI
IDirectPlay8AddressImpl_SetUserData(IDirectPlay8Address
*iface
,
382 const void *const pvUserData
, const DWORD dwDataSize
)
384 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
385 TRACE("(%p): stub\n", This
);
389 static HRESULT WINAPI
IDirectPlay8AddressImpl_GetNumComponents(IDirectPlay8Address
*iface
,
390 DWORD
*pdwNumComponents
)
392 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
393 TRACE("(%p): stub\n", This
);
395 if(!pdwNumComponents
)
396 return DPNERR_INVALIDPOINTER
;
398 *pdwNumComponents
= This
->comp_count
;
403 static HRESULT WINAPI
IDirectPlay8AddressImpl_GetComponentByName(IDirectPlay8Address
*iface
,
404 const WCHAR
*const pwszName
, void *pvBuffer
, DWORD
*pdwBufferSize
, DWORD
*pdwDataType
)
406 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
407 struct component
*entry
;
410 TRACE("(%p)->(%s %p %p %p)\n", This
, debugstr_w(pwszName
), pvBuffer
, pdwBufferSize
, pdwDataType
);
412 if(!pwszName
|| !pdwBufferSize
|| !pdwDataType
|| (!pvBuffer
&& *pdwBufferSize
))
415 for(i
=0; i
< This
->comp_count
; i
++)
417 entry
= This
->components
[i
];
419 if (lstrcmpW(pwszName
, entry
->name
) == 0)
421 TRACE("Found %s\n", debugstr_w(pwszName
));
423 if(*pdwBufferSize
< entry
->size
)
425 *pdwBufferSize
= entry
->size
;
426 return DPNERR_BUFFERTOOSMALL
;
429 *pdwBufferSize
= entry
->size
;
430 *pdwDataType
= entry
->type
;
434 case DPNA_DATATYPE_DWORD
:
435 memcpy(pvBuffer
, &entry
->data
.value
, sizeof(DWORD
));
437 case DPNA_DATATYPE_GUID
:
438 memcpy(pvBuffer
, &entry
->data
.guid
, sizeof(GUID
));
440 case DPNA_DATATYPE_STRING
:
441 memcpy(pvBuffer
, entry
->data
.string
, entry
->size
);
443 case DPNA_DATATYPE_STRING_ANSI
:
444 memcpy(pvBuffer
, entry
->data
.ansi
, entry
->size
);
446 case DPNA_DATATYPE_BINARY
:
447 memcpy(pvBuffer
, entry
->data
.binary
, entry
->size
);
455 return DPNERR_DOESNOTEXIST
;
458 static HRESULT WINAPI
IDirectPlay8AddressImpl_GetComponentByIndex(IDirectPlay8Address
*iface
,
459 const DWORD dwComponentID
, WCHAR
*pwszName
, DWORD
*pdwNameLen
, void *pvBuffer
,
460 DWORD
*pdwBufferSize
, DWORD
*pdwDataType
)
462 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
463 struct component
*entry
;
466 TRACE("(%p)->(%lu %p %p %p %p %p)\n", This
, dwComponentID
, pwszName
, pdwNameLen
, pvBuffer
, pdwBufferSize
, pdwDataType
);
468 if(!pdwNameLen
|| !pdwBufferSize
|| !pdwDataType
)
470 WARN("Invalid buffer (%p, %p, %p)\n", pdwNameLen
, pdwBufferSize
, pdwDataType
);
471 return DPNERR_INVALIDPOINTER
;
474 if(dwComponentID
> This
->comp_count
)
476 WARN("dwComponentID out of range\n");
477 return DPNERR_DOESNOTEXIST
;
480 entry
= This
->components
[dwComponentID
];
482 namesize
= lstrlenW(entry
->name
);
483 if(*pdwBufferSize
< entry
->size
|| *pdwNameLen
< namesize
)
485 WARN("Buffer too small\n");
487 *pdwNameLen
= namesize
+ 1;
488 *pdwBufferSize
= entry
->size
;
489 *pdwDataType
= entry
->type
;
490 return DPNERR_BUFFERTOOSMALL
;
493 if(!pwszName
|| !pvBuffer
)
495 WARN("Invalid buffer (%p, %p)\n", pwszName
, pvBuffer
);
496 return DPNERR_INVALIDPOINTER
;
499 lstrcpyW(pwszName
, entry
->name
);
501 *pdwNameLen
= namesize
+ 1;
502 *pdwBufferSize
= entry
->size
;
503 *pdwDataType
= entry
->type
;
507 case DPNA_DATATYPE_DWORD
:
508 *(DWORD
*)pvBuffer
= entry
->data
.value
;
510 case DPNA_DATATYPE_GUID
:
511 *(GUID
*)pvBuffer
= entry
->data
.guid
;
513 case DPNA_DATATYPE_STRING
:
514 memcpy(pvBuffer
, entry
->data
.string
, entry
->size
);
516 case DPNA_DATATYPE_STRING_ANSI
:
517 memcpy(pvBuffer
, entry
->data
.ansi
, entry
->size
);
519 case DPNA_DATATYPE_BINARY
:
520 memcpy(pvBuffer
, entry
->data
.binary
, entry
->size
);
527 static HRESULT WINAPI
IDirectPlay8AddressImpl_AddComponent(IDirectPlay8Address
*iface
,
528 const WCHAR
*const pwszName
, const void* const lpvData
, const DWORD dwDataSize
,
529 const DWORD dwDataType
)
531 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
532 struct component
*entry
;
536 TRACE("(%p, %s, %p, %lu, %lx)\n", This
, debugstr_w(pwszName
), lpvData
, dwDataSize
, dwDataType
);
539 return DPNERR_INVALIDPOINTER
;
543 case DPNA_DATATYPE_DWORD
:
544 if (sizeof(DWORD
) != dwDataSize
)
546 WARN("Invalid DWORD size, returning DPNERR_INVALIDPARAM\n");
547 return DPNERR_INVALIDPARAM
;
550 case DPNA_DATATYPE_GUID
:
551 if (sizeof(GUID
) != dwDataSize
)
553 WARN("Invalid GUID size, returning DPNERR_INVALIDPARAM\n");
554 return DPNERR_INVALIDPARAM
;
557 case DPNA_DATATYPE_STRING
:
558 if (((lstrlenW((WCHAR
*)lpvData
)+1)*sizeof(WCHAR
)) != dwDataSize
)
560 WARN("Invalid STRING size, returning DPNERR_INVALIDPARAM\n");
561 return DPNERR_INVALIDPARAM
;
564 case DPNA_DATATYPE_STRING_ANSI
:
565 if ((strlen((const CHAR
*)lpvData
)+1) != dwDataSize
)
567 WARN("Invalid ANSI size, returning DPNERR_INVALIDPARAM\n");
568 return DPNERR_INVALIDPARAM
;
573 for(i
=0; i
< This
->comp_count
; i
++)
575 entry
= This
->components
[i
];
577 if (lstrcmpW(pwszName
, entry
->name
) == 0)
579 TRACE("Found %s\n", debugstr_w(pwszName
));
582 if(entry
->type
== DPNA_DATATYPE_STRING_ANSI
)
583 free(entry
->data
.ansi
);
584 else if(entry
->type
== DPNA_DATATYPE_STRING
)
585 free(entry
->data
.string
);
586 else if(entry
->type
== DPNA_DATATYPE_BINARY
)
587 free(entry
->data
.binary
);
595 /* Create a new one */
596 entry
= malloc(sizeof(struct component
));
598 return E_OUTOFMEMORY
;
600 entry
->name
= wcsdup(pwszName
);
604 return E_OUTOFMEMORY
;
607 if(!add_component(This
, entry
))
611 return E_OUTOFMEMORY
;
617 case DPNA_DATATYPE_DWORD
:
618 entry
->data
.value
= *(DWORD
*)lpvData
;
619 TRACE("(%p, %lu): DWORD Type -> %lu\n", lpvData
, dwDataSize
, *(const DWORD
*) lpvData
);
621 case DPNA_DATATYPE_GUID
:
622 entry
->data
.guid
= *(GUID
*)lpvData
;
623 TRACE("(%p, %lu): GUID Type -> %s\n", lpvData
, dwDataSize
, debugstr_guid(lpvData
));
625 case DPNA_DATATYPE_STRING
:
626 entry
->data
.string
= wcsdup((WCHAR
*)lpvData
);
627 TRACE("(%p, %lu): STRING Type -> %s\n", lpvData
, dwDataSize
, debugstr_w((WCHAR
*)lpvData
));
629 case DPNA_DATATYPE_STRING_ANSI
:
630 entry
->data
.ansi
= strdup((char*)lpvData
);
631 TRACE("(%p, %lu): ANSI STRING Type -> %s\n", lpvData
, dwDataSize
, (const CHAR
*) lpvData
);
633 case DPNA_DATATYPE_BINARY
:
634 entry
->data
.binary
= malloc(dwDataSize
);
635 memcpy(entry
->data
.binary
, lpvData
, dwDataSize
);
636 TRACE("(%p, %lu): BINARY Type\n", lpvData
, dwDataSize
);
640 entry
->type
= dwDataType
;
641 entry
->size
= dwDataSize
;
646 static HRESULT WINAPI
IDirectPlay8AddressImpl_GetDevice(IDirectPlay8Address
*iface
, GUID
*pDevGuid
) {
647 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
648 TRACE("(%p): stub\n", This
);
652 static HRESULT WINAPI
IDirectPlay8AddressImpl_SetDevice(IDirectPlay8Address
*iface
,
653 const GUID
*const devGuid
)
655 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
656 TRACE("(%p, %s): stub\n", This
, debugstr_guid(devGuid
));
660 static HRESULT WINAPI
IDirectPlay8AddressImpl_BuildFromDirectPlay4Address(IDirectPlay8Address
*iface
,
661 void *pvAddress
, DWORD dwDataSize
)
663 IDirectPlay8AddressImpl
*This
= impl_from_IDirectPlay8Address(iface
);
664 TRACE("(%p): stub\n", This
);
668 static const IDirectPlay8AddressVtbl DirectPlay8Address_Vtbl
=
670 IDirectPlay8AddressImpl_QueryInterface
,
671 IDirectPlay8AddressImpl_AddRef
,
672 IDirectPlay8AddressImpl_Release
,
673 IDirectPlay8AddressImpl_BuildFromURLW
,
674 IDirectPlay8AddressImpl_BuildFromURLA
,
675 IDirectPlay8AddressImpl_Duplicate
,
676 IDirectPlay8AddressImpl_SetEqual
,
677 IDirectPlay8AddressImpl_IsEqual
,
678 IDirectPlay8AddressImpl_Clear
,
679 IDirectPlay8AddressImpl_GetURLW
,
680 IDirectPlay8AddressImpl_GetURLA
,
681 IDirectPlay8AddressImpl_GetSP
,
682 IDirectPlay8AddressImpl_GetUserData
,
683 IDirectPlay8AddressImpl_SetSP
,
684 IDirectPlay8AddressImpl_SetUserData
,
685 IDirectPlay8AddressImpl_GetNumComponents
,
686 IDirectPlay8AddressImpl_GetComponentByName
,
687 IDirectPlay8AddressImpl_GetComponentByIndex
,
688 IDirectPlay8AddressImpl_AddComponent
,
689 IDirectPlay8AddressImpl_GetDevice
,
690 IDirectPlay8AddressImpl_SetDevice
,
691 IDirectPlay8AddressImpl_BuildFromDirectPlay4Address
694 HRESULT
DPNET_CreateDirectPlay8Address(IClassFactory
*iface
, IUnknown
*pUnkOuter
, REFIID riid
, LPVOID
*ppobj
)
696 IDirectPlay8AddressImpl
* client
;
699 TRACE("(%p, %s, %p)\n", pUnkOuter
, debugstr_guid(riid
), ppobj
);
703 client
= calloc(1, sizeof(IDirectPlay8AddressImpl
));
705 return E_OUTOFMEMORY
;
707 client
->IDirectPlay8Address_iface
.lpVtbl
= &DirectPlay8Address_Vtbl
;
709 client
->comp_array_size
= 4;
710 client
->components
= malloc(sizeof(*client
->components
) * client
->comp_array_size
);
711 if(!client
->components
)
714 return E_OUTOFMEMORY
;
717 ret
= IDirectPlay8AddressImpl_QueryInterface(&client
->IDirectPlay8Address_iface
, riid
, ppobj
);
718 IDirectPlay8AddressImpl_Release(&client
->IDirectPlay8Address_iface
);