2 * IDxDiagProvider Implementation
4 * Copyright 2004-2005 Raphael Junqueira
5 * Copyright 2010 Andrew Nguyen
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #define NONAMELESSUNION
27 #define NONAMELESSSTRUCT
28 #include "dxdiag_private.h"
29 #include "wine/unicode.h"
42 #include "wine/debug.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(dxdiag
);
46 static HRESULT
build_information_tree(IDxDiagContainerImpl_Container
**pinfo_root
);
47 static void free_information_tree(IDxDiagContainerImpl_Container
*node
);
49 /* IDxDiagProvider IUnknown parts follow: */
50 static HRESULT WINAPI
IDxDiagProviderImpl_QueryInterface(PDXDIAGPROVIDER iface
, REFIID riid
, LPVOID
*ppobj
)
52 IDxDiagProviderImpl
*This
= (IDxDiagProviderImpl
*)iface
;
54 if (!ppobj
) return E_INVALIDARG
;
56 if (IsEqualGUID(riid
, &IID_IUnknown
)
57 || IsEqualGUID(riid
, &IID_IDxDiagProvider
)) {
58 IUnknown_AddRef(iface
);
63 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
68 static ULONG WINAPI
IDxDiagProviderImpl_AddRef(PDXDIAGPROVIDER iface
) {
69 IDxDiagProviderImpl
*This
= (IDxDiagProviderImpl
*)iface
;
70 ULONG refCount
= InterlockedIncrement(&This
->ref
);
72 TRACE("(%p)->(ref before=%u)\n", This
, refCount
- 1);
79 static ULONG WINAPI
IDxDiagProviderImpl_Release(PDXDIAGPROVIDER iface
) {
80 IDxDiagProviderImpl
*This
= (IDxDiagProviderImpl
*)iface
;
81 ULONG refCount
= InterlockedDecrement(&This
->ref
);
83 TRACE("(%p)->(ref before=%u)\n", This
, refCount
+ 1);
86 free_information_tree(This
->info_root
);
87 HeapFree(GetProcessHeap(), 0, This
);
90 DXDIAGN_UnlockModule();
95 /* IDxDiagProvider Interface follow: */
96 static HRESULT WINAPI
IDxDiagProviderImpl_Initialize(PDXDIAGPROVIDER iface
, DXDIAG_INIT_PARAMS
* pParams
) {
97 IDxDiagProviderImpl
*This
= (IDxDiagProviderImpl
*)iface
;
100 TRACE("(%p,%p)\n", iface
, pParams
);
102 if (NULL
== pParams
) {
105 if (pParams
->dwSize
!= sizeof(DXDIAG_INIT_PARAMS
) ||
106 pParams
->dwDxDiagHeaderVersion
!= DXDIAG_DX9_SDK_VERSION
) {
110 if (!This
->info_root
)
112 hr
= build_information_tree(&This
->info_root
);
118 memcpy(&This
->params
, pParams
, pParams
->dwSize
);
122 static HRESULT WINAPI
IDxDiagProviderImpl_GetRootContainer(PDXDIAGPROVIDER iface
, IDxDiagContainer
** ppInstance
) {
123 IDxDiagProviderImpl
*This
= (IDxDiagProviderImpl
*)iface
;
125 TRACE("(%p,%p)\n", iface
, ppInstance
);
127 if (FALSE
== This
->init
) {
128 return CO_E_NOTINITIALIZED
;
131 return DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer
, This
->info_root
,
132 (IDxDiagProvider
*)This
, (void **)ppInstance
);
135 static const IDxDiagProviderVtbl DxDiagProvider_Vtbl
=
137 IDxDiagProviderImpl_QueryInterface
,
138 IDxDiagProviderImpl_AddRef
,
139 IDxDiagProviderImpl_Release
,
140 IDxDiagProviderImpl_Initialize
,
141 IDxDiagProviderImpl_GetRootContainer
144 HRESULT
DXDiag_CreateDXDiagProvider(LPCLASSFACTORY iface
, LPUNKNOWN punkOuter
, REFIID riid
, LPVOID
*ppobj
) {
145 IDxDiagProviderImpl
* provider
;
147 TRACE("(%p, %s, %p)\n", punkOuter
, debugstr_guid(riid
), ppobj
);
150 if (punkOuter
) return CLASS_E_NOAGGREGATION
;
152 provider
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDxDiagProviderImpl
));
153 if (NULL
== provider
) return E_OUTOFMEMORY
;
154 provider
->lpVtbl
= &DxDiagProvider_Vtbl
;
155 provider
->ref
= 0; /* will be inited with QueryInterface */
156 return IDxDiagProviderImpl_QueryInterface ((PDXDIAGPROVIDER
)provider
, riid
, ppobj
);
159 static void get_display_device_id(WCHAR
*szIdentifierBuffer
)
161 static const WCHAR szNA
[] = {'n','/','a',0};
166 IDirect3D9
*(WINAPI
*pDirect3DCreate9
)(UINT
) = NULL
;
167 IDirect3D9
*pD3d
= NULL
;
168 D3DADAPTER_IDENTIFIER9 adapter_ident
;
170 /* Retrieves the display device identifier from the d3d9 implementation. */
171 d3d9_handle
= LoadLibraryA("d3d9.dll");
173 pDirect3DCreate9
= (void *)GetProcAddress(d3d9_handle
, "Direct3DCreate9");
175 pD3d
= pDirect3DCreate9(D3D_SDK_VERSION
);
177 hr
= IDirect3D9_GetAdapterIdentifier(pD3d
, D3DADAPTER_DEFAULT
, 0, &adapter_ident
);
179 StringFromGUID2(&adapter_ident
.DeviceIdentifier
, szIdentifierBuffer
, 39);
181 memcpy(szIdentifierBuffer
, szNA
, sizeof(szNA
));
185 IDirect3D9_Release(pD3d
);
187 FreeLibrary(d3d9_handle
);
190 static void free_property_information(IDxDiagContainerImpl_Property
*prop
)
192 VariantClear(&prop
->vProp
);
193 HeapFree(GetProcessHeap(), 0, prop
->propName
);
194 HeapFree(GetProcessHeap(), 0, prop
);
197 static void free_information_tree(IDxDiagContainerImpl_Container
*node
)
199 IDxDiagContainerImpl_Container
*ptr
, *cursor2
;
204 HeapFree(GetProcessHeap(), 0, node
->contName
);
206 LIST_FOR_EACH_ENTRY_SAFE(ptr
, cursor2
, &node
->subContainers
, IDxDiagContainerImpl_Container
, entry
)
208 IDxDiagContainerImpl_Property
*prop
, *prop_cursor2
;
210 LIST_FOR_EACH_ENTRY_SAFE(prop
, prop_cursor2
, &ptr
->properties
, IDxDiagContainerImpl_Property
, entry
)
212 list_remove(&prop
->entry
);
213 free_property_information(prop
);
216 list_remove(&ptr
->entry
);
217 free_information_tree(ptr
);
220 HeapFree(GetProcessHeap(), 0, node
);
223 static IDxDiagContainerImpl_Container
*allocate_information_node(const WCHAR
*name
)
225 IDxDiagContainerImpl_Container
*ret
;
227 ret
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*ret
));
233 ret
->contName
= HeapAlloc(GetProcessHeap(), 0, (strlenW(name
) + 1) * sizeof(*name
));
236 HeapFree(GetProcessHeap(), 0, ret
);
239 strcpyW(ret
->contName
, name
);
242 list_init(&ret
->subContainers
);
243 list_init(&ret
->properties
);
248 static IDxDiagContainerImpl_Property
*allocate_property_information(const WCHAR
*name
)
250 IDxDiagContainerImpl_Property
*ret
;
252 ret
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*ret
));
256 ret
->propName
= HeapAlloc(GetProcessHeap(), 0, (strlenW(name
) + 1) * sizeof(*name
));
259 HeapFree(GetProcessHeap(), 0, ret
);
262 strcpyW(ret
->propName
, name
);
267 static inline void add_subcontainer(IDxDiagContainerImpl_Container
*node
, IDxDiagContainerImpl_Container
*subCont
)
269 list_add_tail(&node
->subContainers
, &subCont
->entry
);
270 ++node
->nSubContainers
;
273 static inline HRESULT
add_bstr_property(IDxDiagContainerImpl_Container
*node
, const WCHAR
*propName
, const WCHAR
*str
)
275 IDxDiagContainerImpl_Property
*prop
;
278 prop
= allocate_property_information(propName
);
280 return E_OUTOFMEMORY
;
282 bstr
= SysAllocString(str
);
285 free_property_information(prop
);
286 return E_OUTOFMEMORY
;
289 V_VT(&prop
->vProp
) = VT_BSTR
;
290 V_BSTR(&prop
->vProp
) = bstr
;
292 list_add_tail(&node
->properties
, &prop
->entry
);
298 static inline HRESULT
add_ui4_property(IDxDiagContainerImpl_Container
*node
, const WCHAR
*propName
, DWORD data
)
300 IDxDiagContainerImpl_Property
*prop
;
302 prop
= allocate_property_information(propName
);
304 return E_OUTOFMEMORY
;
306 V_VT(&prop
->vProp
) = VT_UI4
;
307 V_UI4(&prop
->vProp
) = data
;
309 list_add_tail(&node
->properties
, &prop
->entry
);
315 static inline HRESULT
add_bool_property(IDxDiagContainerImpl_Container
*node
, const WCHAR
*propName
, BOOL data
)
317 IDxDiagContainerImpl_Property
*prop
;
319 prop
= allocate_property_information(propName
);
321 return E_OUTOFMEMORY
;
323 V_VT(&prop
->vProp
) = VT_BOOL
;
324 V_BOOL(&prop
->vProp
) = data
;
326 list_add_tail(&node
->properties
, &prop
->entry
);
332 static inline HRESULT
add_ull_as_bstr_property(IDxDiagContainerImpl_Container
*node
, const WCHAR
*propName
, ULONGLONG data
)
334 IDxDiagContainerImpl_Property
*prop
;
336 prop
= allocate_property_information(propName
);
338 return E_OUTOFMEMORY
;
340 V_VT(&prop
->vProp
) = VT_UI8
;
341 V_UI8(&prop
->vProp
) = data
;
343 VariantChangeType(&prop
->vProp
, &prop
->vProp
, 0, VT_BSTR
);
345 list_add_tail(&node
->properties
, &prop
->entry
);
351 /* Copied from programs/taskkill/taskkill.c. */
352 static DWORD
*enumerate_processes(DWORD
*list_count
)
354 DWORD
*pid_list
, alloc_bytes
= 1024 * sizeof(*pid_list
), needed_bytes
;
356 pid_list
= HeapAlloc(GetProcessHeap(), 0, alloc_bytes
);
364 if (!EnumProcesses(pid_list
, alloc_bytes
, &needed_bytes
))
366 HeapFree(GetProcessHeap(), 0, pid_list
);
370 /* EnumProcesses can't signal an insufficient buffer condition, so the
371 * only way to possibly determine whether a larger buffer is required
372 * is to see whether the written number of bytes is the same as the
373 * buffer size. If so, the buffer will be reallocated to twice the
375 if (alloc_bytes
!= needed_bytes
)
379 realloc_list
= HeapReAlloc(GetProcessHeap(), 0, pid_list
, alloc_bytes
);
382 HeapFree(GetProcessHeap(), 0, pid_list
);
385 pid_list
= realloc_list
;
388 *list_count
= needed_bytes
/ sizeof(*pid_list
);
392 /* Copied from programs/taskkill/taskkill.c. */
393 static BOOL
get_process_name_from_pid(DWORD pid
, WCHAR
*buf
, DWORD chars
)
399 process
= OpenProcess(PROCESS_QUERY_INFORMATION
| PROCESS_VM_READ
, FALSE
, pid
);
403 if (!EnumProcessModules(process
, &module
, sizeof(module
), &required_size
))
405 CloseHandle(process
);
409 if (!GetModuleBaseNameW(process
, module
, buf
, chars
))
411 CloseHandle(process
);
415 CloseHandle(process
);
419 /* dxdiagn's detection scheme is simply to look for a process called conf.exe. */
420 static BOOL
is_netmeeting_running(void)
422 static const WCHAR conf_exe
[] = {'c','o','n','f','.','e','x','e',0};
425 DWORD
*pid_list
= enumerate_processes(&list_count
);
430 WCHAR process_name
[MAX_PATH
];
432 for (i
= 0; i
< list_count
; i
++)
434 if (get_process_name_from_pid(pid_list
[i
], process_name
, sizeof(process_name
)/sizeof(WCHAR
)) &&
435 !lstrcmpW(conf_exe
, process_name
))
443 static HRESULT
fill_language_information(IDxDiagContainerImpl_Container
*node
)
445 static const WCHAR regional_setting_engW
[] = {'R','e','g','i','o','n','a','l',' ','S','e','t','t','i','n','g',0};
446 static const WCHAR languages_fmtW
[] = {'%','s',' ','(','%','s',':',' ','%','s',')',0};
447 static const WCHAR szLanguagesLocalized
[] = {'s','z','L','a','n','g','u','a','g','e','s','L','o','c','a','l','i','z','e','d',0};
448 static const WCHAR szLanguagesEnglish
[] = {'s','z','L','a','n','g','u','a','g','e','s','E','n','g','l','i','s','h',0};
450 WCHAR system_lang
[80], regional_setting
[100], user_lang
[80], language_str
[300];
453 /* szLanguagesLocalized */
454 GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT
, LOCALE_SNATIVELANGNAME
, system_lang
, sizeof(system_lang
)/sizeof(WCHAR
));
455 LoadStringW(dxdiagn_instance
, IDS_REGIONAL_SETTING
, regional_setting
, sizeof(regional_setting
)/sizeof(WCHAR
));
456 GetLocaleInfoW(LOCALE_USER_DEFAULT
, LOCALE_SNATIVELANGNAME
, user_lang
, sizeof(user_lang
)/sizeof(WCHAR
));
458 snprintfW(language_str
, sizeof(language_str
)/sizeof(WCHAR
), languages_fmtW
, system_lang
, regional_setting
, user_lang
);
460 hr
= add_bstr_property(node
, szLanguagesLocalized
, language_str
);
464 /* szLanguagesEnglish */
465 GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT
, LOCALE_SENGLANGUAGE
, system_lang
, sizeof(system_lang
)/sizeof(WCHAR
));
466 GetLocaleInfoW(LOCALE_USER_DEFAULT
, LOCALE_SENGLANGUAGE
, user_lang
, sizeof(user_lang
)/sizeof(WCHAR
));
468 snprintfW(language_str
, sizeof(language_str
)/sizeof(WCHAR
), languages_fmtW
, system_lang
, regional_setting_engW
, user_lang
);
470 hr
= add_bstr_property(node
, szLanguagesEnglish
, language_str
);
477 static HRESULT
fill_datetime_information(IDxDiagContainerImpl_Container
*node
)
479 static const WCHAR date_fmtW
[] = {'M','\'','/','\'','d','\'','/','\'','y','y','y','y',0};
480 static const WCHAR time_fmtW
[] = {'H','H','\'',':','\'','m','m','\'',':','\'','s','s',0};
481 static const WCHAR datetime_fmtW
[] = {'%','s',',',' ','%','s',0};
482 static const WCHAR szTimeLocalized
[] = {'s','z','T','i','m','e','L','o','c','a','l','i','z','e','d',0};
483 static const WCHAR szTimeEnglish
[] = {'s','z','T','i','m','e','E','n','g','l','i','s','h',0};
486 WCHAR date_str
[80], time_str
[80], datetime_str
[200];
489 GetLocalTime(&curtime
);
491 GetTimeFormatW(LOCALE_NEUTRAL
, 0, &curtime
, time_fmtW
, time_str
, sizeof(time_str
)/sizeof(WCHAR
));
493 /* szTimeLocalized */
494 GetDateFormatW(LOCALE_USER_DEFAULT
, DATE_LONGDATE
, &curtime
, NULL
, date_str
, sizeof(date_str
)/sizeof(WCHAR
));
496 snprintfW(datetime_str
, sizeof(datetime_str
)/sizeof(WCHAR
), datetime_fmtW
, date_str
, time_str
);
498 hr
= add_bstr_property(node
, szTimeLocalized
, datetime_str
);
503 GetDateFormatW(LOCALE_NEUTRAL
, 0, &curtime
, date_fmtW
, date_str
, sizeof(date_str
)/sizeof(WCHAR
));
505 snprintfW(datetime_str
, sizeof(datetime_str
)/sizeof(WCHAR
), datetime_fmtW
, date_str
, time_str
);
507 hr
= add_bstr_property(node
, szTimeEnglish
, datetime_str
);
514 static HRESULT
build_systeminfo_tree(IDxDiagContainerImpl_Container
*node
)
516 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};
517 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};
518 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};
519 static const WCHAR szDirectXVersionLetter_v
[] = {'c',0};
520 static const WCHAR bDebug
[] = {'b','D','e','b','u','g',0};
521 static const WCHAR bNECPC98
[] = {'b','N','E','C','P','C','9','8',0};
522 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};
523 static const WCHAR szDirectXVersionEnglish_v
[] = {'4','.','0','9','.','0','0','0','0','.','0','9','0','4',0};
524 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};
525 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};
526 static const WCHAR ullPhysicalMemory
[] = {'u','l','l','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
527 static const WCHAR ullUsedPageFile
[] = {'u','l','l','U','s','e','d','P','a','g','e','F','i','l','e',0};
528 static const WCHAR ullAvailPageFile
[] = {'u','l','l','A','v','a','i','l','P','a','g','e','F','i','l','e',0};
529 static const WCHAR bNetMeetingRunning
[] = {'b','N','e','t','M','e','e','t','i','n','g','R','u','n','n','i','n','g',0};
530 static const WCHAR szWindowsDir
[] = {'s','z','W','i','n','d','o','w','s','D','i','r',0};
531 static const WCHAR dwOSMajorVersion
[] = {'d','w','O','S','M','a','j','o','r','V','e','r','s','i','o','n',0};
532 static const WCHAR dwOSMinorVersion
[] = {'d','w','O','S','M','i','n','o','r','V','e','r','s','i','o','n',0};
533 static const WCHAR dwOSBuildNumber
[] = {'d','w','O','S','B','u','i','l','d','N','u','m','b','e','r',0};
534 static const WCHAR dwOSPlatformID
[] = {'d','w','O','S','P','l','a','t','f','o','r','m','I','D',0};
535 static const WCHAR szCSDVersion
[] = {'s','z','C','S','D','V','e','r','s','i','o','n',0};
536 static const WCHAR szPhysicalMemoryEnglish
[] = {'s','z','P','h','y','s','i','c','a','l','M','e','m','o','r','y','E','n','g','l','i','s','h',0};
537 static const WCHAR szPageFileLocalized
[] = {'s','z','P','a','g','e','F','i','l','e','L','o','c','a','l','i','z','e','d',0};
538 static const WCHAR szPageFileEnglish
[] = {'s','z','P','a','g','e','F','i','l','e','E','n','g','l','i','s','h',0};
539 static const WCHAR szMachineNameLocalized
[] = {'s','z','M','a','c','h','i','n','e','N','a','m','e','L','o','c','a','l','i','z','e','d',0};
540 static const WCHAR szMachineNameEnglish
[] = {'s','z','M','a','c','h','i','n','e','N','a','m','e','E','n','g','l','i','s','h',0};
542 static const WCHAR pagefile_fmtW
[] = {'%','u','M','B',' ','u','s','e','d',',',' ','%','u','M','B',' ','a','v','a','i','l','a','b','l','e',0};
543 static const WCHAR physmem_fmtW
[] = {'%','u','M','B',' ','R','A','M',0};
548 DWORD count
, usedpage_mb
, availpage_mb
;
549 WCHAR buffer
[MAX_PATH
], computer_name
[MAX_COMPUTERNAME_LENGTH
+ 1], print_buf
[200], localized_pagefile_fmt
[200];
551 hr
= add_ui4_property(node
, dwDirectXVersionMajor
, 9);
555 hr
= add_ui4_property(node
, dwDirectXVersionMinor
, 0);
559 hr
= add_bstr_property(node
, szDirectXVersionLetter
, szDirectXVersionLetter_v
);
563 hr
= add_bstr_property(node
, szDirectXVersionEnglish
, szDirectXVersionEnglish_v
);
567 hr
= add_bstr_property(node
, szDirectXVersionLongEnglish
, szDirectXVersionLongEnglish_v
);
571 hr
= add_bool_property(node
, bDebug
, FALSE
);
575 hr
= add_bool_property(node
, bNECPC98
, FALSE
);
579 msex
.dwLength
= sizeof(msex
);
580 GlobalMemoryStatusEx(&msex
);
582 hr
= add_ull_as_bstr_property(node
, ullPhysicalMemory
, msex
.ullTotalPhys
);
586 hr
= add_ull_as_bstr_property(node
, ullUsedPageFile
, msex
.ullTotalPageFile
- msex
.ullAvailPageFile
);
590 hr
= add_ull_as_bstr_property(node
, ullAvailPageFile
, msex
.ullAvailPageFile
);
594 hr
= add_bool_property(node
, bNetMeetingRunning
, is_netmeeting_running());
598 info
.dwOSVersionInfoSize
= sizeof(info
);
599 GetVersionExW(&info
);
601 hr
= add_ui4_property(node
, dwOSMajorVersion
, info
.dwMajorVersion
);
605 hr
= add_ui4_property(node
, dwOSMinorVersion
, info
.dwMinorVersion
);
609 hr
= add_ui4_property(node
, dwOSBuildNumber
, info
.dwBuildNumber
);
613 hr
= add_ui4_property(node
, dwOSPlatformID
, info
.dwPlatformId
);
617 hr
= add_bstr_property(node
, szCSDVersion
, info
.szCSDVersion
);
621 /* FIXME: Roundoff should not be done with truncated division. */
622 snprintfW(print_buf
, sizeof(print_buf
)/sizeof(WCHAR
), physmem_fmtW
, (DWORD
)(msex
.ullTotalPhys
/ (1024 * 1024)));
623 hr
= add_bstr_property(node
, szPhysicalMemoryEnglish
, print_buf
);
627 usedpage_mb
= (DWORD
)((msex
.ullTotalPageFile
- msex
.ullAvailPageFile
) / (1024 * 1024));
628 availpage_mb
= (DWORD
)(msex
.ullAvailPageFile
/ (1024 * 1024));
629 LoadStringW(dxdiagn_instance
, IDS_PAGE_FILE_FORMAT
, localized_pagefile_fmt
, sizeof(localized_pagefile_fmt
)/sizeof(WCHAR
));
630 snprintfW(print_buf
, sizeof(print_buf
)/sizeof(WCHAR
), localized_pagefile_fmt
, usedpage_mb
, availpage_mb
);
632 hr
= add_bstr_property(node
, szPageFileLocalized
, print_buf
);
636 snprintfW(print_buf
, sizeof(print_buf
)/sizeof(WCHAR
), pagefile_fmtW
, usedpage_mb
, availpage_mb
);
638 hr
= add_bstr_property(node
, szPageFileEnglish
, print_buf
);
642 GetWindowsDirectoryW(buffer
, MAX_PATH
);
644 hr
= add_bstr_property(node
, szWindowsDir
, buffer
);
648 count
= sizeof(computer_name
)/sizeof(WCHAR
);
649 if (!GetComputerNameW(computer_name
, &count
))
652 hr
= add_bstr_property(node
, szMachineNameLocalized
, computer_name
);
656 hr
= add_bstr_property(node
, szMachineNameEnglish
, computer_name
);
660 hr
= fill_language_information(node
);
664 hr
= fill_datetime_information(node
);
671 static HRESULT
build_displaydevices_tree(IDxDiagContainerImpl_Container
*node
)
673 static const WCHAR szDescription
[] = {'s','z','D','e','s','c','r','i','p','t','i','o','n',0};
674 static const WCHAR szDeviceName
[] = {'s','z','D','e','v','i','c','e','N','a','m','e',0};
675 static const WCHAR szKeyDeviceID
[] = {'s','z','K','e','y','D','e','v','i','c','e','I','D',0};
676 static const WCHAR szKeyDeviceKey
[] = {'s','z','K','e','y','D','e','v','i','c','e','K','e','y',0};
677 static const WCHAR szVendorId
[] = {'s','z','V','e','n','d','o','r','I','d',0};
678 static const WCHAR szDeviceId
[] = {'s','z','D','e','v','i','c','e','I','d',0};
679 static const WCHAR szDeviceIdentifier
[] = {'s','z','D','e','v','i','c','e','I','d','e','n','t','i','f','i','e','r',0};
680 static const WCHAR dwWidth
[] = {'d','w','W','i','d','t','h',0};
681 static const WCHAR dwHeight
[] = {'d','w','H','e','i','g','h','t',0};
682 static const WCHAR dwBpp
[] = {'d','w','B','p','p',0};
683 static const WCHAR szDisplayMemoryLocalized
[] = {'s','z','D','i','s','p','l','a','y','M','e','m','o','r','y','L','o','c','a','l','i','z','e','d',0};
684 static const WCHAR szDisplayMemoryEnglish
[] = {'s','z','D','i','s','p','l','a','y','M','e','m','o','r','y','E','n','g','l','i','s','h',0};
686 static const WCHAR szAdapterID
[] = {'0',0};
687 static const WCHAR szEmpty
[] = {0};
689 IDxDiagContainerImpl_Container
*display_adapter
;
691 IDirectDraw7
*pDirectDraw
;
693 DISPLAY_DEVICEW disp_dev
;
694 DDSURFACEDESC2 surface_descr
;
698 display_adapter
= allocate_information_node(szAdapterID
);
699 if (!display_adapter
)
700 return E_OUTOFMEMORY
;
702 add_subcontainer(node
, display_adapter
);
704 disp_dev
.cb
= sizeof(disp_dev
);
705 if (EnumDisplayDevicesW( NULL
, 0, &disp_dev
, 0 ))
707 hr
= add_bstr_property(display_adapter
, szDeviceName
, disp_dev
.DeviceName
);
711 hr
= add_bstr_property(display_adapter
, szDescription
, disp_dev
.DeviceString
);
716 /* For now, silently ignore a failure from DirectDrawCreateEx. */
717 hr
= DirectDrawCreateEx(NULL
, (LPVOID
*)&pDirectDraw
, &IID_IDirectDraw7
, NULL
);
721 dd_caps
.dwCaps
= DDSCAPS_LOCALVIDMEM
| DDSCAPS_VIDEOMEMORY
;
722 dd_caps
.dwCaps2
= dd_caps
.dwCaps3
= dd_caps
.dwCaps4
= 0;
723 hr
= IDirectDraw7_GetAvailableVidMem(pDirectDraw
, &dd_caps
, &tmp
, NULL
);
726 static const WCHAR mem_fmt
[] = {'%','.','1','f',' ','M','B',0};
728 snprintfW(buffer
, sizeof(buffer
)/sizeof(buffer
[0]), mem_fmt
, ((float)tmp
) / 1000000.0);
730 hr
= add_bstr_property(display_adapter
, szDisplayMemoryLocalized
, buffer
);
734 hr
= add_bstr_property(display_adapter
, szDisplayMemoryEnglish
, buffer
);
739 surface_descr
.dwSize
= sizeof(surface_descr
);
740 hr
= IDirectDraw7_GetDisplayMode(pDirectDraw
, &surface_descr
);
743 if (surface_descr
.dwFlags
& DDSD_WIDTH
)
745 hr
= add_ui4_property(display_adapter
, dwWidth
, surface_descr
.dwWidth
);
750 if (surface_descr
.dwFlags
& DDSD_HEIGHT
)
752 hr
= add_ui4_property(display_adapter
, dwHeight
, surface_descr
.dwHeight
);
757 if (surface_descr
.dwFlags
& DDSD_PIXELFORMAT
)
759 hr
= add_ui4_property(display_adapter
, dwBpp
, surface_descr
.u4
.ddpfPixelFormat
.u1
.dwRGBBitCount
);
765 get_display_device_id(buffer
);
767 hr
= add_bstr_property(display_adapter
, szDeviceIdentifier
, buffer
);
771 hr
= add_bstr_property(display_adapter
, szVendorId
, szEmpty
);
775 hr
= add_bstr_property(display_adapter
, szDeviceId
, szEmpty
);
779 hr
= add_bstr_property(display_adapter
, szKeyDeviceKey
, szEmpty
);
783 hr
= add_bstr_property(display_adapter
, szKeyDeviceID
, szEmpty
);
789 IDirectDraw7_Release(pDirectDraw
);
793 static HRESULT
build_directsound_tree(IDxDiagContainerImpl_Container
*node
)
795 static const WCHAR DxDiag_SoundDevices
[] = {'D','x','D','i','a','g','_','S','o','u','n','d','D','e','v','i','c','e','s',0};
796 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};
798 IDxDiagContainerImpl_Container
*cont
;
800 cont
= allocate_information_node(DxDiag_SoundDevices
);
802 return E_OUTOFMEMORY
;
804 add_subcontainer(node
, cont
);
806 cont
= allocate_information_node(DxDiag_SoundCaptureDevices
);
808 return E_OUTOFMEMORY
;
810 add_subcontainer(node
, cont
);
815 static HRESULT
build_directmusic_tree(IDxDiagContainerImpl_Container
*node
)
820 static HRESULT
build_directinput_tree(IDxDiagContainerImpl_Container
*node
)
825 static HRESULT
build_directplay_tree(IDxDiagContainerImpl_Container
*node
)
830 static HRESULT
build_systemdevices_tree(IDxDiagContainerImpl_Container
*node
)
835 static HRESULT
fill_file_description(IDxDiagContainerImpl_Container
*node
, const WCHAR
*szFilePath
, const WCHAR
*szFileName
)
837 static const WCHAR szSlashSep
[] = {'\\',0};
838 static const WCHAR szPath
[] = {'s','z','P','a','t','h',0};
839 static const WCHAR szName
[] = {'s','z','N','a','m','e',0};
840 static const WCHAR szVersion
[] = {'s','z','V','e','r','s','i','o','n',0};
841 static const WCHAR szAttributes
[] = {'s','z','A','t','t','r','i','b','u','t','e','s',0};
842 static const WCHAR szLanguageEnglish
[] = {'s','z','L','a','n','g','u','a','g','e','E','n','g','l','i','s','h',0};
843 static const WCHAR dwFileTimeHigh
[] = {'d','w','F','i','l','e','T','i','m','e','H','i','g','h',0};
844 static const WCHAR dwFileTimeLow
[] = {'d','w','F','i','l','e','T','i','m','e','L','o','w',0};
845 static const WCHAR bBeta
[] = {'b','B','e','t','a',0};
846 static const WCHAR bDebug
[] = {'b','D','e','b','u','g',0};
847 static const WCHAR bExists
[] = {'b','E','x','i','s','t','s',0};
850 static const WCHAR szFinal_Retail_v
[] = {'F','i','n','a','l',' ','R','e','t','a','i','l',0};
851 static const WCHAR szEnglish_v
[] = {'E','n','g','l','i','s','h',0};
852 static const WCHAR szVersionFormat
[] = {'%','u','.','%','0','2','u','.','%','0','4','u','.','%','0','4','u',0};
856 WCHAR szVersion_v
[1024];
858 void *pVersionInfo
= NULL
;
859 BOOL boolret
= FALSE
;
861 VS_FIXEDFILEINFO
*pFileInfo
;
863 TRACE("Filling container %p for %s in %s\n", node
,
864 debugstr_w(szFileName
), debugstr_w(szFilePath
));
866 szFile
= HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR
) * (lstrlenW(szFilePath
) +
867 lstrlenW(szFileName
) + 2 /* slash + terminator */));
869 return E_OUTOFMEMORY
;
871 lstrcpyW(szFile
, szFilePath
);
872 lstrcatW(szFile
, szSlashSep
);
873 lstrcatW(szFile
, szFileName
);
875 retval
= GetFileVersionInfoSizeW(szFile
, &hdl
);
878 pVersionInfo
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, retval
);
885 if (GetFileVersionInfoW(szFile
, 0, retval
, pVersionInfo
) &&
886 VerQueryValueW(pVersionInfo
, szSlashSep
, (void **)&pFileInfo
, &uiLength
))
890 hr
= add_bstr_property(node
, szPath
, szFile
);
894 hr
= add_bstr_property(node
, szName
, szFileName
);
898 hr
= add_bool_property(node
, bExists
, boolret
);
904 snprintfW(szVersion_v
, sizeof(szVersion_v
)/sizeof(szVersion_v
[0]),
906 HIWORD(pFileInfo
->dwFileVersionMS
),
907 LOWORD(pFileInfo
->dwFileVersionMS
),
908 HIWORD(pFileInfo
->dwFileVersionLS
),
909 LOWORD(pFileInfo
->dwFileVersionLS
));
911 TRACE("Found version as (%s)\n", debugstr_w(szVersion_v
));
913 hr
= add_bstr_property(node
, szVersion
, szVersion_v
);
917 hr
= add_bstr_property(node
, szAttributes
, szFinal_Retail_v
);
921 hr
= add_bstr_property(node
, szLanguageEnglish
, szEnglish_v
);
925 hr
= add_ui4_property(node
, dwFileTimeHigh
, pFileInfo
->dwFileDateMS
);
929 hr
= add_ui4_property(node
, dwFileTimeLow
, pFileInfo
->dwFileDateLS
);
933 hr
= add_bool_property(node
, bBeta
, ((pFileInfo
->dwFileFlags
& pFileInfo
->dwFileFlagsMask
) & VS_FF_PRERELEASE
) != 0);
937 hr
= add_bool_property(node
, bDebug
, ((pFileInfo
->dwFileFlags
& pFileInfo
->dwFileFlagsMask
) & VS_FF_DEBUG
) != 0);
944 HeapFree(GetProcessHeap(), 0, pVersionInfo
);
945 HeapFree(GetProcessHeap(), 0, szFile
);
949 static HRESULT
build_directxfiles_tree(IDxDiagContainerImpl_Container
*node
)
951 static const WCHAR dlls
[][15] =
953 {'d','3','d','8','.','d','l','l',0},
954 {'d','3','d','9','.','d','l','l',0},
955 {'d','d','r','a','w','.','d','l','l',0},
956 {'d','e','v','e','n','u','m','.','d','l','l',0},
957 {'d','i','n','p','u','t','8','.','d','l','l',0},
958 {'d','i','n','p','u','t','.','d','l','l',0},
959 {'d','m','b','a','n','d','.','d','l','l',0},
960 {'d','m','c','o','m','p','o','s','.','d','l','l',0},
961 {'d','m','i','m','e','.','d','l','l',0},
962 {'d','m','l','o','a','d','e','r','.','d','l','l',0},
963 {'d','m','s','c','r','i','p','t','.','d','l','l',0},
964 {'d','m','s','t','y','l','e','.','d','l','l',0},
965 {'d','m','s','y','n','t','h','.','d','l','l',0},
966 {'d','m','u','s','i','c','.','d','l','l',0},
967 {'d','p','l','a','y','x','.','d','l','l',0},
968 {'d','p','n','e','t','.','d','l','l',0},
969 {'d','s','o','u','n','d','.','d','l','l',0},
970 {'d','s','w','a','v','e','.','d','l','l',0},
971 {'d','x','d','i','a','g','n','.','d','l','l',0},
972 {'q','u','a','r','t','z','.','d','l','l',0}
976 WCHAR szFilePath
[MAX_PATH
];
979 GetSystemDirectoryW(szFilePath
, MAX_PATH
);
981 for (i
= 0; i
< sizeof(dlls
) / sizeof(dlls
[0]); i
++)
983 static const WCHAR szFormat
[] = {'%','d',0};
986 IDxDiagContainerImpl_Container
*file_container
;
988 snprintfW(szFileID
, sizeof(szFileID
)/sizeof(szFileID
[0]), szFormat
, i
);
990 file_container
= allocate_information_node(szFileID
);
992 return E_OUTOFMEMORY
;
994 hr
= fill_file_description(file_container
, szFilePath
, dlls
[i
]);
997 free_information_tree(file_container
);
1001 add_subcontainer(node
, file_container
);
1007 static HRESULT
read_property_names(IPropertyBag
*pPropBag
, VARIANT
*friendly_name
, VARIANT
*clsid_name
)
1009 static const WCHAR wszFriendlyName
[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
1010 static const WCHAR wszClsidName
[] = {'C','L','S','I','D',0};
1014 VariantInit(friendly_name
);
1015 VariantInit(clsid_name
);
1017 hr
= IPropertyBag_Read(pPropBag
, wszFriendlyName
, friendly_name
, 0);
1021 hr
= IPropertyBag_Read(pPropBag
, wszClsidName
, clsid_name
, 0);
1024 VariantClear(friendly_name
);
1031 static HRESULT
fill_filter_data_information(IDxDiagContainerImpl_Container
*subcont
, BYTE
*pData
, ULONG cb
)
1033 static const WCHAR szVersionW
[] = {'s','z','V','e','r','s','i','o','n',0};
1034 static const WCHAR dwInputs
[] = {'d','w','I','n','p','u','t','s',0};
1035 static const WCHAR dwOutputs
[] = {'d','w','O','u','t','p','u','t','s',0};
1036 static const WCHAR dwMeritW
[] = {'d','w','M','e','r','i','t',0};
1037 static const WCHAR szVersionFormat
[] = {'v','%','d',0};
1040 IFilterMapper2
*pFileMapper
= NULL
;
1041 IAMFilterData
*pFilterData
= NULL
;
1042 REGFILTER2
*pRF
= NULL
;
1045 DWORD dwNOutputs
= 0;
1046 DWORD dwNInputs
= 0;
1048 hr
= CoCreateInstance(&CLSID_FilterMapper2
, NULL
, CLSCTX_INPROC
, &IID_IFilterMapper2
,
1049 (void **)&pFileMapper
);
1053 hr
= IFilterMapper2_QueryInterface(pFileMapper
, &IID_IAMFilterData
, (void **)&pFilterData
);
1057 hr
= IAMFilterData_ParseFilterData(pFilterData
, pData
, cb
, (BYTE
**)&pRF
);
1061 snprintfW(bufferW
, sizeof(bufferW
)/sizeof(bufferW
[0]), szVersionFormat
, pRF
->dwVersion
);
1062 hr
= add_bstr_property(subcont
, szVersionW
, bufferW
);
1066 if (pRF
->dwVersion
== 1)
1068 for (j
= 0; j
< pRF
->u
.s
.cPins
; j
++)
1069 if (pRF
->u
.s
.rgPins
[j
].bOutput
)
1074 else if (pRF
->dwVersion
== 2)
1076 for (j
= 0; j
< pRF
->u
.s1
.cPins2
; j
++)
1077 if (pRF
->u
.s1
.rgPins2
[j
].dwFlags
& REG_PINFLAG_B_OUTPUT
)
1083 hr
= add_ui4_property(subcont
, dwInputs
, dwNInputs
);
1087 hr
= add_ui4_property(subcont
, dwOutputs
, dwNOutputs
);
1091 hr
= add_ui4_property(subcont
, dwMeritW
, pRF
->dwMerit
);
1098 if (pFilterData
) IAMFilterData_Release(pFilterData
);
1099 if (pFileMapper
) IFilterMapper2_Release(pFileMapper
);
1104 static HRESULT
fill_filter_container(IDxDiagContainerImpl_Container
*subcont
, IMoniker
*pMoniker
)
1106 static const WCHAR szName
[] = {'s','z','N','a','m','e',0};
1107 static const WCHAR ClsidFilterW
[] = {'C','l','s','i','d','F','i','l','t','e','r',0};
1108 static const WCHAR wszFilterDataName
[] = {'F','i','l','t','e','r','D','a','t','a',0};
1111 IPropertyBag
*pPropFilterBag
= NULL
;
1113 VARIANT friendly_name
;
1117 VariantInit(&friendly_name
);
1118 VariantInit(&clsid_name
);
1121 hr
= IMoniker_BindToStorage(pMoniker
, NULL
, NULL
, &IID_IPropertyBag
, (void **)&pPropFilterBag
);
1125 hr
= read_property_names(pPropFilterBag
, &friendly_name
, &clsid_name
);
1129 TRACE("Name = %s\n", debugstr_w(V_BSTR(&friendly_name
)));
1130 TRACE("CLSID = %s\n", debugstr_w(V_BSTR(&clsid_name
)));
1132 hr
= add_bstr_property(subcont
, szName
, V_BSTR(&friendly_name
));
1136 hr
= add_bstr_property(subcont
, ClsidFilterW
, V_BSTR(&clsid_name
));
1140 hr
= IPropertyBag_Read(pPropFilterBag
, wszFilterDataName
, &v
, NULL
);
1144 hr
= SafeArrayAccessData(V_ARRAY(&v
), (void **)&pData
);
1148 hr
= fill_filter_data_information(subcont
, pData
, V_ARRAY(&v
)->rgsabound
->cElements
);
1149 SafeArrayUnaccessData(V_ARRAY(&v
));
1156 VariantClear(&clsid_name
);
1157 VariantClear(&friendly_name
);
1158 if (pPropFilterBag
) IPropertyBag_Release(pPropFilterBag
);
1163 static HRESULT
build_directshowfilters_tree(IDxDiagContainerImpl_Container
*node
)
1165 static const WCHAR szCatName
[] = {'s','z','C','a','t','N','a','m','e',0};
1166 static const WCHAR ClsidCatW
[] = {'C','l','s','i','d','C','a','t',0};
1167 static const WCHAR szIdFormat
[] = {'%','d',0};
1171 ICreateDevEnum
*pCreateDevEnum
;
1172 IEnumMoniker
*pEmCat
= NULL
;
1173 IMoniker
*pMCat
= NULL
;
1174 IEnumMoniker
*pEnum
= NULL
;
1176 hr
= CoCreateInstance(&CLSID_SystemDeviceEnum
, NULL
, CLSCTX_INPROC_SERVER
,
1177 &IID_ICreateDevEnum
, (void **)&pCreateDevEnum
);
1181 hr
= ICreateDevEnum_CreateClassEnumerator(pCreateDevEnum
, &CLSID_ActiveMovieCategories
, &pEmCat
, 0);
1185 while (IEnumMoniker_Next(pEmCat
, 1, &pMCat
, NULL
) == S_OK
)
1189 IPropertyBag
*pPropBag
;
1191 IMoniker
*pMoniker
= NULL
;
1193 hr
= IMoniker_BindToStorage(pMCat
, NULL
, NULL
, &IID_IPropertyBag
, (void **)&pPropBag
);
1196 IMoniker_Release(pMCat
);
1200 hr
= read_property_names(pPropBag
, &vCatName
, &vCatClsid
);
1201 IPropertyBag_Release(pPropBag
);
1204 IMoniker_Release(pMCat
);
1208 hr
= CLSIDFromString(V_BSTR(&vCatClsid
), &clsidCat
);
1211 IMoniker_Release(pMCat
);
1212 VariantClear(&vCatClsid
);
1213 VariantClear(&vCatName
);
1217 hr
= ICreateDevEnum_CreateClassEnumerator(pCreateDevEnum
, &clsidCat
, &pEnum
, 0);
1220 IMoniker_Release(pMCat
);
1221 VariantClear(&vCatClsid
);
1222 VariantClear(&vCatName
);
1226 TRACE("Enumerating class %s\n", debugstr_guid(&clsidCat
));
1228 while (IEnumMoniker_Next(pEnum
, 1, &pMoniker
, NULL
) == S_OK
)
1231 IDxDiagContainerImpl_Container
*subcont
;
1233 snprintfW(bufferW
, sizeof(bufferW
)/sizeof(bufferW
[0]), szIdFormat
, i
);
1234 subcont
= allocate_information_node(bufferW
);
1238 IMoniker_Release(pMoniker
);
1242 hr
= add_bstr_property(subcont
, szCatName
, V_BSTR(&vCatName
));
1245 free_information_tree(subcont
);
1246 IMoniker_Release(pMoniker
);
1250 hr
= add_bstr_property(subcont
, ClsidCatW
, V_BSTR(&vCatClsid
));
1253 free_information_tree(subcont
);
1254 IMoniker_Release(pMoniker
);
1258 hr
= fill_filter_container(subcont
, pMoniker
);
1261 free_information_tree(subcont
);
1262 IMoniker_Release(pMoniker
);
1266 add_subcontainer(node
, subcont
);
1268 IMoniker_Release(pMoniker
);
1271 IEnumMoniker_Release(pEnum
);
1272 IMoniker_Release(pMCat
);
1273 VariantClear(&vCatClsid
);
1274 VariantClear(&vCatName
);
1281 if (pEmCat
) IEnumMoniker_Release(pEmCat
);
1282 ICreateDevEnum_Release(pCreateDevEnum
);
1286 static HRESULT
build_logicaldisks_tree(IDxDiagContainerImpl_Container
*node
)
1291 static HRESULT
build_information_tree(IDxDiagContainerImpl_Container
**pinfo_root
)
1293 static const WCHAR DxDiag_SystemInfo
[] = {'D','x','D','i','a','g','_','S','y','s','t','e','m','I','n','f','o',0};
1294 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};
1295 static const WCHAR DxDiag_DirectSound
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','S','o','u','n','d',0};
1296 static const WCHAR DxDiag_DirectMusic
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','M','u','s','i','c',0};
1297 static const WCHAR DxDiag_DirectInput
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','I','n','p','u','t',0};
1298 static const WCHAR DxDiag_DirectPlay
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','P','l','a','y',0};
1299 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};
1300 static const WCHAR DxDiag_DirectXFiles
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','X','F','i','l','e','s',0};
1301 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};
1302 static const WCHAR DxDiag_LogicalDisks
[] = {'D','x','D','i','a','g','_','L','o','g','i','c','a','l','D','i','s','k','s',0};
1307 HRESULT (*initfunc
)(IDxDiagContainerImpl_Container
*);
1310 {DxDiag_SystemInfo
, build_systeminfo_tree
},
1311 {DxDiag_DisplayDevices
, build_displaydevices_tree
},
1312 {DxDiag_DirectSound
, build_directsound_tree
},
1313 {DxDiag_DirectMusic
, build_directmusic_tree
},
1314 {DxDiag_DirectInput
, build_directinput_tree
},
1315 {DxDiag_DirectPlay
, build_directplay_tree
},
1316 {DxDiag_SystemDevices
, build_systemdevices_tree
},
1317 {DxDiag_DirectXFiles
, build_directxfiles_tree
},
1318 {DxDiag_DirectShowFilters
, build_directshowfilters_tree
},
1319 {DxDiag_LogicalDisks
, build_logicaldisks_tree
},
1322 IDxDiagContainerImpl_Container
*info_root
;
1325 info_root
= allocate_information_node(NULL
);
1327 return E_OUTOFMEMORY
;
1329 for (index
= 0; index
< sizeof(root_children
)/sizeof(root_children
[0]); index
++)
1331 IDxDiagContainerImpl_Container
*node
;
1334 node
= allocate_information_node(root_children
[index
].name
);
1337 free_information_tree(info_root
);
1338 return E_OUTOFMEMORY
;
1341 hr
= root_children
[index
].initfunc(node
);
1344 free_information_tree(node
);
1345 free_information_tree(info_root
);
1349 add_subcontainer(info_root
, node
);
1352 *pinfo_root
= info_root
;