2 * IDxDiagContainer Implementation
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
23 #include "dxdiag_private.h"
24 #include "wine/debug.h"
25 #include "wine/unicode.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(dxdiag
);
29 /* IDxDiagContainer IUnknown parts follow: */
30 HRESULT WINAPI
IDxDiagContainerImpl_QueryInterface(PDXDIAGCONTAINER iface
, REFIID riid
, LPVOID
*ppobj
)
32 ICOM_THIS(IDxDiagContainerImpl
,iface
);
34 if (IsEqualGUID(riid
, &IID_IUnknown
)
35 || IsEqualGUID(riid
, &IID_IDxDiagContainer
)) {
36 IDxDiagContainerImpl_AddRef(iface
);
41 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
45 ULONG WINAPI
IDxDiagContainerImpl_AddRef(PDXDIAGCONTAINER iface
) {
46 ICOM_THIS(IDxDiagContainerImpl
,iface
);
47 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
51 ULONG WINAPI
IDxDiagContainerImpl_Release(PDXDIAGCONTAINER iface
) {
52 ICOM_THIS(IDxDiagContainerImpl
,iface
);
53 ULONG ref
= --This
->ref
;
54 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
56 HeapFree(GetProcessHeap(), 0, This
);
61 /* IDxDiagContainer Interface follow: */
62 HRESULT WINAPI
IDxDiagContainerImpl_GetNumberOfChildContainers(PDXDIAGCONTAINER iface
, DWORD
* pdwCount
) {
63 ICOM_THIS(IDxDiagContainerImpl
,iface
);
64 TRACE("(%p)\n", iface
);
65 if (NULL
== pdwCount
) {
68 *pdwCount
= This
->nSubContainers
;
72 HRESULT WINAPI
IDxDiagContainerImpl_EnumChildContainerNames(PDXDIAGCONTAINER iface
, DWORD dwIndex
, LPWSTR pwszContainer
, DWORD cchContainer
) {
73 IDxDiagContainerImpl_SubContainer
* p
= NULL
;
75 ICOM_THIS(IDxDiagContainerImpl
,iface
);
77 TRACE("(%p, %lu, %s, %lu)\n", iface
, dwIndex
, debugstr_w(pwszContainer
), cchContainer
);
79 if (NULL
== pwszContainer
) {
82 if (256 > cchContainer
) {
83 return DXDIAG_E_INSUFFICIENT_BUFFER
;
86 p
= This
->subContainers
;
89 if (cchContainer
<= strlenW(p
->contName
)) {
90 return DXDIAG_E_INSUFFICIENT_BUFFER
;
92 lstrcpynW(pwszContainer
, p
->contName
, cchContainer
);
101 HRESULT WINAPI
IDxDiagContainerImpl_GetChildContainer(PDXDIAGCONTAINER iface
, LPCWSTR pwszContainer
, IDxDiagContainer
** ppInstance
) {
102 IDxDiagContainerImpl_SubContainer
* p
= NULL
;
103 ICOM_THIS(IDxDiagContainerImpl
,iface
);
105 FIXME("(%p, %s, %p)\n", iface
, debugstr_w(pwszContainer
), ppInstance
);
107 if (NULL
== ppInstance
|| NULL
== pwszContainer
) {
111 p
= This
->subContainers
;
113 if (0 == lstrcmpW(p
->contName
, pwszContainer
)) {
114 IDxDiagContainerImpl_QueryInterface((PDXDIAGCONTAINER
)p
, &IID_IDxDiagContainer
, (void**) ppInstance
);
123 HRESULT WINAPI
IDxDiagContainerImpl_GetNumberOfProps(PDXDIAGCONTAINER iface
, DWORD
* pdwCount
) {
124 /* ICOM_THIS(IDxDiagContainerImpl,iface); */
125 FIXME("(%p, %p): stub\n", iface
, pdwCount
);
129 HRESULT WINAPI
IDxDiagContainerImpl_EnumPropNames(PDXDIAGCONTAINER iface
, DWORD dwIndex
, LPWSTR pwszPropName
, DWORD cchPropName
) {
130 /* ICOM_THIS(IDxDiagContainerImpl,iface); */
131 FIXME("(%p, %lu, %s, %lu): stub\n", iface
, dwIndex
, debugstr_w(pwszPropName
), cchPropName
);
135 HRESULT WINAPI
IDxDiagContainerImpl_GetProp(PDXDIAGCONTAINER iface
, LPCWSTR pwszPropName
, VARIANT
* pvarProp
) {
136 /* ICOM_THIS(IDxDiagContainerImpl,iface); */
137 FIXME("(%p, %s, %p): stub\n", iface
, debugstr_w(pwszPropName
), pvarProp
);
142 ICOM_VTABLE(IDxDiagContainer
) DxDiagContainer_Vtbl
=
144 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
145 IDxDiagContainerImpl_QueryInterface
,
146 IDxDiagContainerImpl_AddRef
,
147 IDxDiagContainerImpl_Release
,
148 IDxDiagContainerImpl_GetNumberOfChildContainers
,
149 IDxDiagContainerImpl_EnumChildContainerNames
,
150 IDxDiagContainerImpl_GetChildContainer
,
151 IDxDiagContainerImpl_GetNumberOfProps
,
152 IDxDiagContainerImpl_EnumPropNames
,
153 IDxDiagContainerImpl_GetProp
157 HRESULT
DXDiag_CreateDXDiagContainer(REFIID riid
, LPVOID
*ppobj
) {
158 IDxDiagContainerImpl
* container
;
160 TRACE("(%p, %p)\n", debugstr_guid(riid
), ppobj
);
162 container
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDxDiagContainerImpl
));
163 if (NULL
== container
) {
165 return E_OUTOFMEMORY
;
167 container
->lpVtbl
= &DxDiagContainer_Vtbl
;
168 container
->ref
= 0; /* will be inited with QueryInterface */
169 return IDxDiagContainerImpl_QueryInterface((PDXDIAGCONTAINER
)container
, riid
, ppobj
);