2 * IDxDiagProvider Implementation
4 * Copyright 2004-2005 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 "wine/debug.h"
26 #include "dxdiag_private.h"
27 #include "wine/unicode.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(dxdiag
);
37 /* IDxDiagProvider IUnknown parts follow: */
38 static HRESULT WINAPI
IDxDiagProviderImpl_QueryInterface(PDXDIAGPROVIDER iface
, REFIID riid
, LPVOID
*ppobj
)
40 IDxDiagProviderImpl
*This
= (IDxDiagProviderImpl
*)iface
;
42 if (IsEqualGUID(riid
, &IID_IUnknown
)
43 || IsEqualGUID(riid
, &IID_IDxDiagProvider
)) {
44 IUnknown_AddRef(iface
);
49 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
53 static ULONG WINAPI
IDxDiagProviderImpl_AddRef(PDXDIAGPROVIDER iface
) {
54 IDxDiagProviderImpl
*This
= (IDxDiagProviderImpl
*)iface
;
55 ULONG refCount
= InterlockedIncrement(&This
->ref
);
57 TRACE("(%p)->(ref before=%u)\n", This
, refCount
- 1);
64 static ULONG WINAPI
IDxDiagProviderImpl_Release(PDXDIAGPROVIDER iface
) {
65 IDxDiagProviderImpl
*This
= (IDxDiagProviderImpl
*)iface
;
66 ULONG refCount
= InterlockedDecrement(&This
->ref
);
68 TRACE("(%p)->(ref before=%u)\n", This
, refCount
+ 1);
71 HeapFree(GetProcessHeap(), 0, This
);
74 DXDIAGN_UnlockModule();
79 /* IDxDiagProvider Interface follow: */
80 static HRESULT WINAPI
IDxDiagProviderImpl_Initialize(PDXDIAGPROVIDER iface
, DXDIAG_INIT_PARAMS
* pParams
) {
81 IDxDiagProviderImpl
*This
= (IDxDiagProviderImpl
*)iface
;
82 TRACE("(%p,%p)\n", iface
, pParams
);
84 if (NULL
== pParams
) {
87 if (pParams
->dwSize
!= sizeof(DXDIAG_INIT_PARAMS
)) {
92 memcpy(&This
->params
, pParams
, pParams
->dwSize
);
96 static HRESULT WINAPI
IDxDiagProviderImpl_GetRootContainer(PDXDIAGPROVIDER iface
, IDxDiagContainer
** ppInstance
) {
98 IDxDiagProviderImpl
*This
= (IDxDiagProviderImpl
*)iface
;
99 TRACE("(%p,%p)\n", iface
, ppInstance
);
101 if (NULL
== ppInstance
) {
104 if (FALSE
== This
->init
) {
105 return E_INVALIDARG
; /* should be E_CO_UNINITIALIZED */
107 if (NULL
== This
->pRootContainer
) {
108 hr
= DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer
, (void**) &This
->pRootContainer
);
112 hr
= DXDiag_InitRootDXDiagContainer((PDXDIAGCONTAINER
)This
->pRootContainer
);
114 return IDxDiagContainerImpl_QueryInterface((PDXDIAGCONTAINER
)This
->pRootContainer
, &IID_IDxDiagContainer
, (void**) ppInstance
);
117 static const IDxDiagProviderVtbl DxDiagProvider_Vtbl
=
119 IDxDiagProviderImpl_QueryInterface
,
120 IDxDiagProviderImpl_AddRef
,
121 IDxDiagProviderImpl_Release
,
122 IDxDiagProviderImpl_Initialize
,
123 IDxDiagProviderImpl_GetRootContainer
126 HRESULT
DXDiag_CreateDXDiagProvider(LPCLASSFACTORY iface
, LPUNKNOWN punkOuter
, REFIID riid
, LPVOID
*ppobj
) {
127 IDxDiagProviderImpl
* provider
;
129 TRACE("(%p, %s, %p)\n", punkOuter
, debugstr_guid(riid
), ppobj
);
131 provider
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDxDiagProviderImpl
));
132 if (NULL
== provider
) {
134 return E_OUTOFMEMORY
;
136 provider
->lpVtbl
= &DxDiagProvider_Vtbl
;
137 provider
->ref
= 0; /* will be inited with QueryInterface */
138 return IDxDiagProviderImpl_QueryInterface ((PDXDIAGPROVIDER
)provider
, riid
, ppobj
);
142 * @param szFilePath: usually GetSystemDirectoryW
143 * @param szFileName: name of the dll without path
145 static HRESULT
DXDiag_AddFileDescContainer(IDxDiagContainer
* pSubCont
, const WCHAR
* szFilePath
, const WCHAR
* szFileName
) {
148 static WCHAR szSlashSep
[] = {'\\',0};
149 static const WCHAR szPath
[] = {'s','z','P','a','t','h',0};
150 static const WCHAR szName
[] = {'s','z','N','a','m','e',0};
151 static const WCHAR szVersion
[] = {'s','z','V','e','r','s','i','o','n',0};
152 static const WCHAR szAttributes
[] = {'s','z','A','t','t','r','i','b','u','t','e','s',0};
153 static const WCHAR szLanguageEnglish
[] = {'s','z','L','a','n','g','u','a','g','e','E','n','g','l','i','s','h',0};
154 static const WCHAR dwFileTimeHigh
[] = {'d','w','F','i','l','e','T','i','m','e','H','i','g','h',0};
155 static const WCHAR dwFileTimeLow
[] = {'d','w','F','i','l','e','T','i','m','e','L','o','w',0};
156 static const WCHAR bBeta
[] = {'b','B','e','t','a',0};
157 static const WCHAR bDebug
[] = {'b','D','e','b','u','g',0};
158 static const WCHAR bExists
[] = {'b','E','x','i','s','t','s',0};
160 static const WCHAR szFinal_Retail_v
[] = {'F','i','n','a','l',' ','R','e','t','a','i','l',0};
161 static const WCHAR szEnglish_v
[] = {'E','n','g','l','i','s','h',0};
162 static const WCHAR szVersionFormat
[] = {'%','u','.','%','0','2','u','.','%','0','4','u','.','%','0','4','u',0};
166 WCHAR szVersion_v
[1024];
171 VS_FIXEDFILEINFO
* pFileInfo
;
173 FIXME("(%p,%s)\n", pSubCont
, debugstr_w(szFileName
));
175 lstrcpyW(szFile
, szFilePath
);
176 lstrcatW(szFile
, szSlashSep
);
177 lstrcatW(szFile
, szFileName
);
179 retval
= GetFileVersionInfoSizeW(szFile
, &hdl
);
180 pVersionInfo
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, retval
);
181 hr
= GetFileVersionInfoW(szFile
, 0, retval
, pVersionInfo
);
182 boolret
= VerQueryValueW(pVersionInfo
, szSlashSep
, (LPVOID
) &pFileInfo
, &uiLength
);
184 V_VT(&v
) = VT_BSTR
; V_BSTR(&v
) = SysAllocString(szFile
);
185 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, szPath
, &v
);
187 V_VT(&v
) = VT_BSTR
; V_BSTR(&v
) = SysAllocString(szFileName
);
188 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, szName
, &v
);
190 V_VT(&v
) = VT_BOOL
; V_BOOL(&v
) = boolret
;
191 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, bExists
, &v
);
195 snprintfW(szVersion_v
, sizeof(szVersion_v
),
197 HIWORD(pFileInfo
->dwFileVersionMS
),
198 LOWORD(pFileInfo
->dwFileVersionMS
),
199 HIWORD(pFileInfo
->dwFileVersionLS
),
200 LOWORD(pFileInfo
->dwFileVersionLS
));
202 TRACE("Found version as (%s)\n", debugstr_w(szVersion_v
));
204 V_VT(&v
) = VT_BSTR
; V_BSTR(&v
) = SysAllocString(szVersion_v
);
205 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, szVersion
, &v
);
207 V_VT(&v
) = VT_BSTR
; V_BSTR(&v
) = SysAllocString(szFinal_Retail_v
);
208 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, szAttributes
, &v
);
210 V_VT(&v
) = VT_BSTR
; V_BSTR(&v
) = SysAllocString(szEnglish_v
);
211 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, szLanguageEnglish
, &v
);
213 V_VT(&v
) = VT_UI4
; V_UI4(&v
) = pFileInfo
->dwFileDateMS
;
214 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, dwFileTimeHigh
, &v
);
216 V_VT(&v
) = VT_UI4
; V_UI4(&v
) = pFileInfo
->dwFileDateLS
;
217 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, dwFileTimeLow
, &v
);
219 V_VT(&v
) = VT_BOOL
; V_BOOL(&v
) = (0 != ((pFileInfo
->dwFileFlags
& pFileInfo
->dwFileFlagsMask
) & VS_FF_PRERELEASE
));
220 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, bBeta
, &v
);
222 V_VT(&v
) = VT_BOOL
; V_BOOL(&v
) = (0 != ((pFileInfo
->dwFileFlags
& pFileInfo
->dwFileFlagsMask
) & VS_FF_DEBUG
));
223 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, bDebug
, &v
);
227 HeapFree(GetProcessHeap(), 0, pVersionInfo
);
232 static HRESULT
DXDiag_InitDXDiagSystemInfoContainer(IDxDiagContainer
* pSubCont
) {
234 static const WCHAR dwDirectXVersionMajor
[] = {'d','w','D','i','r','e','c','t','X','V','e','r','s','i','o','n','M','a','j','o','r',0};
235 static const WCHAR dwDirectXVersionMinor
[] = {'d','w','D','i','r','e','c','t','X','V','e','r','s','i','o','n','M','i','n','o','r',0};
236 static const WCHAR szDirectXVersionLetter
[] = {'s','z','D','i','r','e','c','t','X','V','e','r','s','i','o','n','L','e','t','t','e','r',0};
237 static const WCHAR szDirectXVersionLetter_v
[] = {'c',0};
238 static const WCHAR bDebug
[] = {'b','D','e','b','u','g',0};
239 static const WCHAR szDirectXVersionEnglish
[] = {'s','z','D','i','r','e','c','t','X','V','e','r','s','i','o','n','E','n','g','l','i','s','h',0};
240 static const WCHAR szDirectXVersionEnglish_v
[] = {'4','.','0','9','.','0','0','0','0','.','0','9','0','4',0};
241 static const WCHAR szDirectXVersionLongEnglish
[] = {'s','z','D','i','r','e','c','t','X','V','e','r','s','i','o','n','L','o','n','g','E','n','g','l','i','s','h',0};
242 static const WCHAR szDirectXVersionLongEnglish_v
[] = {'=',' ','"','D','i','r','e','c','t','X',' ','9','.','0','c',' ','(','4','.','0','9','.','0','0','0','0','.','0','9','0','4',')',0};
243 /*static const WCHAR szDxDiagVersion[] = {'s','z','D','x','D','i','a','g','V','e','r','s','i','o','n',0};*/
246 /*"dwOSMajorVersion"*/
247 /*"dwOSMinorVersion"*/
248 /*"dwOSBuildNumber"*/
252 V_VT(&v
) = VT_UI4
; V_UI4(&v
) = 9;
253 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, dwDirectXVersionMajor
, &v
);
255 V_VT(&v
) = VT_UI4
; V_UI4(&v
) = 0;
256 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, dwDirectXVersionMinor
, &v
);
258 V_VT(&v
) = VT_BSTR
; V_BSTR(&v
) = SysAllocString(szDirectXVersionLetter_v
);
259 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, szDirectXVersionLetter
, &v
);
261 V_VT(&v
) = VT_BSTR
; V_BSTR(&v
) = SysAllocString(szDirectXVersionEnglish_v
);
262 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, szDirectXVersionEnglish
, &v
);
264 V_VT(&v
) = VT_BSTR
; V_BSTR(&v
) = SysAllocString(szDirectXVersionLongEnglish_v
);
265 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, szDirectXVersionLongEnglish
, &v
);
267 V_VT(&v
) = VT_BOOL
; V_BOOL(&v
) = FALSE
;
268 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, bDebug
, &v
);
274 static HRESULT
DXDiag_InitDXDiagSystemDevicesContainer(IDxDiagContainer
* pSubCont
) {
277 static const WCHAR szDescription[] = {'s','z','D','e','s','c','r','i','p','t','i','o','n',0};
278 static const WCHAR szDeviceID[] = {'s','z','D','e','v','i','c','e','I','D',0};
280 static const WCHAR szDrivers[] = {'s','z','D','r','i','v','e','r','s',0};
283 IDxDiagContainer* pDeviceSubCont = NULL;
284 IDxDiagContainer* pDriversCont = NULL;
286 hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pDeviceSubCont);
287 if (FAILED(hr)) { return hr; }
288 V_VT(pvarProp) = VT_BSTR; V_BSTR(pvarProp) = SysAllocString(property->psz);
289 hr = IDxDiagContainerImpl_AddProp(pDeviceSubCont, szDescription, &v);
291 V_VT(pvarProp) = VT_BSTR; V_BSTR(pvarProp) = SysAllocString(property->psz);
292 hr = IDxDiagContainerImpl_AddProp(pDeviceSubCont, szDeviceID, &v);
295 hr = IDxDiagContainerImpl_AddChildContainer(pSubCont, "", pDeviceSubCont);
299 * Drivers Cont contains Files Desc Containers
302 hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pDriversCont);
303 if (FAILED(hr)) { return hr; }
304 hr = IDxDiagContainerImpl_AddChildContainer(pDeviceSubCont, szDrivers, pDriversCont);
310 static HRESULT
DXDiag_InitDXDiagLogicalDisksContainer(IDxDiagContainer
* pSubCont
) {
313 static const WCHAR szDriveLetter[] = {'s','z','D','r','i','v','e','L','e','t','t','e','r',0};
314 static const WCHAR szFreeSpace[] = {'s','z','F','r','e','e','S','p','a','c','e',0};
315 static const WCHAR szMaxSpace[] = {'s','z','M','a','x','S','p','a','c','e',0};
316 static const WCHAR szFileSystem[] = {'s','z','F','i','l','e','S','y','s','t','e','m',0};
317 static const WCHAR szModel[] = {'s','z','M','o','d','e','l',0};
318 static const WCHAR szPNPDeviceID[] = {'s','z','P','N','P','D','e','v','i','c','e','I','D',0};
319 static const WCHAR dwHardDriveIndex[] = {'d','w','H','a','r','d','D','r','i','v','e','I','n','d','e','x',0};
321 static const WCHAR szDrivers[] = {'s','z','D','r','i','v','e','r','s',0};
324 IDxDiagContainer* pDiskSubCont = NULL;
325 IDxDiagContainer* pDriversCont = NULL;
327 hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pDiskSubCont);
328 if (FAILED(hr)) { return hr; }
329 hr = IDxDiagContainerImpl_AddChildContainer(pSubCont, "" , pDiskSubCont);
333 * Drivers Cont contains Files Desc Containers
336 hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pDriversCont);
337 if (FAILED(hr)) { return hr; }
338 hr = IDxDiagContainerImpl_AddChildContainer(pDeviceSubCont, szDrivers, pDriversCont);
342 static HRESULT
DXDiag_InitDXDiagDirectXFilesContainer(IDxDiagContainer
* pSubCont
) {
345 static const WCHAR ddraw_dll
[] = {'d','d','r','a','w','.','d','l','l',0};
346 static const WCHAR dplayx_dll
[] = {'d','p','l','a','y','x','.','d','l','l',0};
347 static const WCHAR dpnet_dll
[] = {'d','p','n','e','t','.','d','l','l',0};
348 static const WCHAR dinput_dll
[] = {'d','i','n','p','u','t','.','d','l','l',0};
349 static const WCHAR dinput8_dll
[] = {'d','i','n','p','u','t','8','.','d','l','l',0};
350 static const WCHAR dsound_dll
[] = {'d','s','o','u','n','d','.','d','l','l',0};
351 static const WCHAR dswave_dll
[] = {'d','s','w','a','v','e','.','d','l','l',0};
352 static const WCHAR d3d8_dll
[] = {'d','3','d','8','.','d','l','l',0};
353 static const WCHAR d3d9_dll
[] = {'d','3','d','9','.','d','l','l',0};
354 static const WCHAR dmband_dll
[] = {'d','m','b','a','n','d','.','d','l','l',0};
355 static const WCHAR dmcompos_dll
[] = {'d','m','c','o','m','p','o','s','.','d','l','l',0};
356 static const WCHAR dmime_dll
[] = {'d','m','i','m','e','.','d','l','l',0};
357 static const WCHAR dmloader_dll
[] = {'d','m','l','o','a','d','e','r','.','d','l','l',0};
358 static const WCHAR dmscript_dll
[] = {'d','m','s','c','r','i','p','t','.','d','l','l',0};
359 static const WCHAR dmstyle_dll
[] = {'d','m','s','t','y','l','e','.','d','l','l',0};
360 static const WCHAR dmsynth_dll
[] = {'d','m','s','y','n','t','h','.','d','l','l',0};
361 static const WCHAR dmusic_dll
[] = {'d','m','u','s','i','c','.','d','l','l',0};
362 static const WCHAR devenum_dll
[] = {'d','e','v','e','n','u','m','.','d','l','l',0};
363 static const WCHAR quartz_dll
[] = {'q','u','a','r','t','z','.','d','l','l',0};
364 WCHAR szFilePath
[512];
366 hr
= GetSystemDirectoryW(szFilePath
, MAX_PATH
);
367 if (FAILED(hr
)) { return hr
; }
368 szFilePath
[MAX_PATH
-1]=0;
370 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, ddraw_dll
);
371 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, dplayx_dll
);
372 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, dpnet_dll
);
373 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, dinput_dll
);
374 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, dinput8_dll
);
375 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, dsound_dll
);
376 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, dswave_dll
);
377 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, d3d8_dll
);
378 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, d3d9_dll
);
379 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, dmband_dll
);
380 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, dmcompos_dll
);
381 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, dmime_dll
);
382 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, dmloader_dll
);
383 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, dmscript_dll
);
384 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, dmstyle_dll
);
385 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, dmsynth_dll
);
386 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, dmusic_dll
);
387 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, devenum_dll
);
388 hr
= DXDiag_AddFileDescContainer(pSubCont
, szFilePath
, quartz_dll
);
392 static HRESULT
DXDiag_InitDXDiagDisplayContainer(IDxDiagContainer
* pSubCont
) {
395 static const WCHAR szDescription[] = {'s','z','D','e','s','c','r','i','p','t','i','o','n',0};
396 static const WCHAR szDeviceName[] = {'s','z','D','e','v','i','c','e','N','a','m','e',0};
397 static const WCHAR szKeyDeviceID[] = {'s','z','K','e','y','D','e','v','i','c','e','I','D',0};
398 static const WCHAR szKeyDeviceKey[] = {'s','z','K','e','y','D','e','v','i','c','e','K','e','y',0};
399 WCHAR szAdapterName[512];
401 IDxDiagContainer* pDisplayAdapterSubCont = NULL;
402 hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pDisplayAdapterSubCont);
403 if (FAILED(hr)) { return hr; }
404 hr = IDxDiagContainerImpl_AddChildContainer(pSubCont, szAdapterName, pDisplayAdapterSubCont);
409 static HRESULT
DXDiag_InitDXDiagDirectSoundContainer(IDxDiagContainer
* pSubCont
) {
411 static const WCHAR DxDiag_SoundDevices
[] = {'D','x','D','i','a','g','_','S','o','u','n','d','D','e','v','i','c','e','s',0};
412 static const WCHAR DxDiag_SoundCaptureDevices
[] = {'D','x','D','i','a','g','_','S','o','u','n','d','C','a','p','t','u','r','e','D','e','v','i','c','e','s',0};
413 IDxDiagContainer
* pSubSubCont
= NULL
;
415 hr
= DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer
, (void**) &pSubSubCont
);
416 if (FAILED(hr
)) { return hr
; }
417 hr
= IDxDiagContainerImpl_AddChildContainer(pSubCont
, DxDiag_SoundDevices
, pSubSubCont
);
419 hr
= DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer
, (void**) &pSubSubCont
);
420 if (FAILED(hr
)) { return hr
; }
421 hr
= IDxDiagContainerImpl_AddChildContainer(pSubCont
, DxDiag_SoundCaptureDevices
, pSubSubCont
);
426 static HRESULT
DXDiag_InitDXDiagDirectMusicContainer(IDxDiagContainer
* pSubCont
) {
431 static HRESULT
DXDiag_InitDXDiagDirectInputContainer(IDxDiagContainer
* pSubCont
) {
436 static HRESULT
DXDiag_InitDXDiagDirectPlayContainer(IDxDiagContainer
* pSubCont
) {
448 BYTE signature
[4]; /* e.g. "0pi3" */
453 DWORD bCategory
; /* is there a category clsid? */
454 /* optional: dwOffsetCategoryClsid */
457 BYTE signature
[4]; /* e.g. "0ty3" */
463 static HRESULT
DXDiag_InitDXDiagDirectShowFiltersContainer(IDxDiagContainer
* pSubCont
) {
465 static const WCHAR szName
[] = {'s','z','N','a','m','e',0};
466 static const WCHAR szCatName
[] = {'s','z','C','a','t','N','a','m','e',0};
467 static const WCHAR szClsidCat
[] = {'s','z','C','l','s','i','d','C','a','t',0};
468 static const WCHAR szClsidFilter
[] = {'s','z','C','l','s','i','d','F','i','l','t','e','r',0};
469 static const WCHAR dwInputs
[] = {'d','w','I','n','p','u','t','s',0};
470 static const WCHAR dwOutputs
[] = {'d','w','O','u','t','p','u','t','s',0};
471 static const WCHAR dwMerit
[] = {'d','w','M','e','r','i','t',0};
473 static const WCHAR szFileName[] = {'s','z','F','i','l','e','N','a','m','e',0};
474 static const WCHAR szFileVersion[] = {'s','z','F','i','l','e','V','e','r','s','i','o','n',0};
478 static const WCHAR wszClsidName
[] = {'C','L','S','I','D',0};
479 static const WCHAR wszFriendlyName
[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
480 static const WCHAR wszFilterDataName
[] = {'F','i','l','t','e','r','D','a','t','a',0};
481 /*static const WCHAR wszMeritName[] = {'M','e','r','i','t',0};*/
483 ICreateDevEnum
* pCreateDevEnum
= NULL
;
484 IEnumMoniker
* pEmCat
= NULL
;
485 IMoniker
* pMCat
= NULL
;
487 hr
= CoCreateInstance(&CLSID_SystemDeviceEnum
,
489 CLSCTX_INPROC_SERVER
,
491 (void**) &pCreateDevEnum
);
492 if (FAILED(hr
)) return hr
;
494 hr
= ICreateDevEnum_CreateClassEnumerator(pCreateDevEnum
, &CLSID_ActiveMovieCategories
, &pEmCat
, 0);
495 if (FAILED(hr
)) goto out_show_filters
;
499 while (S_OK
== IEnumMoniker_Next(pEmCat
, 1, &pMCat
, NULL
)) {
500 IPropertyBag
* pPropBag
= NULL
;
502 hr
= IMoniker_BindToStorage(pMCat
, NULL
, NULL
, &IID_IPropertyBag
, (void**) &pPropBag
);
504 WCHAR
* wszCatName
= NULL
;
505 WCHAR
* wszCatClsid
= NULL
;
507 hr
= IPropertyBag_Read(pPropBag
, wszFriendlyName
, &v
, 0);
508 wszCatName
= SysAllocString(V_BSTR(&v
));
511 hr
= IPropertyBag_Read(pPropBag
, wszClsidName
, &v
, 0);
512 wszCatClsid
= SysAllocString(V_BSTR(&v
));
513 hr
= CLSIDFromString(V_UNION(&v
, bstrVal
), &clsidCat
);
517 hr = IPropertyBag_Read(pPropBag, wszMeritName, &v, 0);
518 hr = IDxDiagContainerImpl_AddProp(pSubCont, dwMerit, &v);
523 IEnumMoniker
* pEnum
= NULL
;
524 IMoniker
* pMoniker
= NULL
;
525 hr
= ICreateDevEnum_CreateClassEnumerator(pCreateDevEnum
, &clsidCat
, &pEnum
, 0);
526 FIXME("\tClassEnumerator for clsid(%s) pEnum(%p)\n", debugstr_guid(&clsidCat
), pEnum
);
527 if (FAILED(hr
) || pEnum
== NULL
) {
528 goto class_enum_failed
;
530 while (NULL
!= pEnum
&& S_OK
== IEnumMoniker_Next(pEnum
, 1, &pMoniker
, NULL
)) {
531 IPropertyBag
* pPropFilterBag
= NULL
;
532 FIXME("\tIEnumMoniker_Next(%p, 1, %p)\n", pEnum
, pMoniker
);
533 hr
= IMoniker_BindToStorage(pMoniker
, NULL
, NULL
, &IID_IPropertyBag
, (void**) &pPropFilterBag
);
536 LPBYTE pCurrent
= NULL
;
537 struct REG_RF
* prrf
= NULL
;
540 DWORD dwNOutputs
= 0;
543 V_VT(&v
) = VT_BSTR
; V_BSTR(&v
) = SysAllocString(wszCatName
);
544 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, szCatName
, &v
);
547 V_VT(&v
) = VT_BSTR
; V_BSTR(&v
) = SysAllocString(wszCatClsid
);
548 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, szClsidCat
, &v
);
551 hr
= IPropertyBag_Read(pPropFilterBag
, wszFriendlyName
, &v
, 0);
552 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, szName
, &v
);
553 FIXME("\tName:%s\n", debugstr_w(V_BSTR(&v
)));
556 hr
= IPropertyBag_Read(pPropFilterBag
, wszClsidName
, &v
, 0);
557 FIXME("\tClsid:%s\n", debugstr_w(V_BSTR(&v
)));
558 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, szClsidFilter
, &v
);
561 hr
= IPropertyBag_Read(pPropFilterBag
, wszFilterDataName
, &v
, NULL
);
562 hr
= SafeArrayAccessData(V_UNION(&v
, parray
), (LPVOID
*) &pData
);
563 prrf
= (struct REG_RF
*) pData
;
566 VariantInit(&v_data
);
567 V_VT(&v_data
) = VT_UI4
; V_UI4(&v_data
) = prrf
->dwVersion
;
568 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, szName
, &v_data
);
569 VariantClear(&v_data
);
570 V_VT(&v_data
) = VT_UI4
; V_UI4(&v_data
) = prrf
->dwMerit
;
571 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, dwMerit
, &v_data
);
572 VariantClear(&v_data
);
574 pCurrent
+= sizeof(struct REG_RF
);
575 for (it
= 0; it
< prrf
->dwPins
; ++it
) {
576 struct REG_RFP
* prrfp
= (struct REG_RFP
*) pCurrent
;
579 if (prrfp
->dwFlags
& REG_PINFLAG_B_OUTPUT
) ++dwNOutputs
;
582 pCurrent
+= sizeof(struct REG_RFP
);
583 if (prrfp
->bCategory
) {
584 pCurrent
+= sizeof(DWORD
);
586 for (j
= 0; j
< prrfp
->dwMediaTypes
; ++j
) {
587 struct REG_TYPE
* prt
= (struct REG_TYPE
*)pCurrent
;
588 pCurrent
+= sizeof(*prt
);
590 for (j
= 0; j
< prrfp
->dwMediums
; ++j
) {
591 DWORD dwOffset
= *(DWORD
*) pCurrent
;
592 pCurrent
+= sizeof(dwOffset
);
596 V_VT(&v_data
) = VT_UI4
; V_UI4(&v_data
) = dwNInputs
;
597 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, dwInputs
, &v_data
);
598 VariantClear(&v_data
);
599 V_VT(&v_data
) = VT_UI4
; V_UI4(&v_data
) = dwNOutputs
;
600 hr
= IDxDiagContainerImpl_AddProp(pSubCont
, dwOutputs
, &v_data
);
601 VariantClear(&v_data
);
603 SafeArrayUnaccessData(V_UNION(&v
, parray
));
606 IPropertyBag_Release(pPropFilterBag
); pPropFilterBag
= NULL
;
608 IEnumMoniker_Release(pEnum
); pEnum
= NULL
;
611 SysFreeString(wszCatName
);
612 SysFreeString(wszCatClsid
);
613 IPropertyBag_Release(pPropBag
); pPropBag
= NULL
;
615 IEnumMoniker_Release(pMCat
); pMCat
= NULL
;
619 if (NULL
!= pEmCat
) { IEnumMoniker_Release(pEmCat
); pEmCat
= NULL
; }
620 if (NULL
!= pCreateDevEnum
) { ICreateDevEnum_Release(pCreateDevEnum
); pCreateDevEnum
= NULL
; }
624 HRESULT
DXDiag_InitRootDXDiagContainer(IDxDiagContainer
* pRootCont
) {
626 static const WCHAR DxDiag_SystemInfo
[] = {'D','x','D','i','a','g','_','S','y','s','t','e','m','I','n','f','o',0};
627 static const WCHAR DxDiag_SystemDevices
[] = {'D','x','D','i','a','g','_','S','y','s','t','e','m','D','e','v','i','c','e','s',0};
628 static const WCHAR DxDiag_LogicalDisks
[] = {'D','x','D','i','a','g','_','L','o','g','i','c','a','l','D','i','s','k','s',0};
629 static const WCHAR DxDiag_DirectXFiles
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','X','F','i','l','e','s',0};
630 static const WCHAR DxDiag_DisplayDevices
[] = {'D','x','D','i','a','g','_','D','i','s','p','l','a','y','D','e','v','i','c','e','s',0};
631 static const WCHAR DxDiag_DirectSound
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','S','o','u','n','d',0};
632 static const WCHAR DxDiag_DirectMusic
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','M','u','s','i','c',0};
633 static const WCHAR DxDiag_DirectInput
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','I','n','p','u','t',0};
634 static const WCHAR DxDiag_DirectPlay
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','P','l','a','y',0};
635 static const WCHAR DxDiag_DirectShowFilters
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','S','h','o','w','F','i','l','t','e','r','s',0};
636 IDxDiagContainer
* pSubCont
= NULL
;
638 TRACE("(%p)\n", pRootCont
);
640 hr
= DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer
, (void**) &pSubCont
);
641 if (FAILED(hr
)) { return hr
; }
642 hr
= DXDiag_InitDXDiagSystemInfoContainer(pSubCont
);
643 hr
= IDxDiagContainerImpl_AddChildContainer(pRootCont
, DxDiag_SystemInfo
, pSubCont
);
645 hr
= DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer
, (void**) &pSubCont
);
646 if (FAILED(hr
)) { return hr
; }
647 hr
= DXDiag_InitDXDiagSystemDevicesContainer(pSubCont
);
648 hr
= IDxDiagContainerImpl_AddChildContainer(pRootCont
, DxDiag_SystemDevices
, pSubCont
);
650 hr
= DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer
, (void**) &pSubCont
);
651 if (FAILED(hr
)) { return hr
; }
652 hr
= DXDiag_InitDXDiagLogicalDisksContainer(pSubCont
);
653 hr
= IDxDiagContainerImpl_AddChildContainer(pRootCont
, DxDiag_LogicalDisks
, pSubCont
);
655 hr
= DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer
, (void**) &pSubCont
);
656 if (FAILED(hr
)) { return hr
; }
657 hr
= DXDiag_InitDXDiagDirectXFilesContainer(pSubCont
);
658 hr
= IDxDiagContainerImpl_AddChildContainer(pRootCont
, DxDiag_DirectXFiles
, pSubCont
);
660 hr
= DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer
, (void**) &pSubCont
);
661 if (FAILED(hr
)) { return hr
; }
662 hr
= DXDiag_InitDXDiagDisplayContainer(pSubCont
);
663 hr
= IDxDiagContainerImpl_AddChildContainer(pRootCont
, DxDiag_DisplayDevices
, pSubCont
);
665 hr
= DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer
, (void**) &pSubCont
);
666 if (FAILED(hr
)) { return hr
; }
667 hr
= DXDiag_InitDXDiagDirectSoundContainer(pSubCont
);
668 hr
= IDxDiagContainerImpl_AddChildContainer(pRootCont
, DxDiag_DirectSound
, pSubCont
);
670 hr
= DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer
, (void**) &pSubCont
);
671 if (FAILED(hr
)) { return hr
; }
672 hr
= DXDiag_InitDXDiagDirectMusicContainer(pSubCont
);
673 hr
= IDxDiagContainerImpl_AddChildContainer(pRootCont
, DxDiag_DirectMusic
, pSubCont
);
675 hr
= DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer
, (void**) &pSubCont
);
676 if (FAILED(hr
)) { return hr
; }
677 hr
= DXDiag_InitDXDiagDirectInputContainer(pSubCont
);
678 hr
= IDxDiagContainerImpl_AddChildContainer(pRootCont
, DxDiag_DirectInput
, pSubCont
);
680 hr
= DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer
, (void**) &pSubCont
);
681 if (FAILED(hr
)) { return hr
; }
682 hr
= DXDiag_InitDXDiagDirectPlayContainer(pSubCont
);
683 hr
= IDxDiagContainerImpl_AddChildContainer(pRootCont
, DxDiag_DirectPlay
, pSubCont
);
685 hr
= DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer
, (void**) &pSubCont
);
686 if (FAILED(hr
)) { return hr
; }
687 hr
= DXDiag_InitDXDiagDirectShowFiltersContainer(pSubCont
);
688 hr
= IDxDiagContainerImpl_AddChildContainer(pRootCont
, DxDiag_DirectShowFilters
, pSubCont
);