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
))
437 HeapFree(GetProcessHeap(), 0, pid_list
);
441 HeapFree(GetProcessHeap(), 0, pid_list
);
447 static HRESULT
fill_language_information(IDxDiagContainerImpl_Container
*node
)
449 static const WCHAR regional_setting_engW
[] = {'R','e','g','i','o','n','a','l',' ','S','e','t','t','i','n','g',0};
450 static const WCHAR languages_fmtW
[] = {'%','s',' ','(','%','s',':',' ','%','s',')',0};
451 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};
452 static const WCHAR szLanguagesEnglish
[] = {'s','z','L','a','n','g','u','a','g','e','s','E','n','g','l','i','s','h',0};
454 WCHAR system_lang
[80], regional_setting
[100], user_lang
[80], language_str
[300];
457 /* szLanguagesLocalized */
458 GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT
, LOCALE_SNATIVELANGNAME
, system_lang
, sizeof(system_lang
)/sizeof(WCHAR
));
459 LoadStringW(dxdiagn_instance
, IDS_REGIONAL_SETTING
, regional_setting
, sizeof(regional_setting
)/sizeof(WCHAR
));
460 GetLocaleInfoW(LOCALE_USER_DEFAULT
, LOCALE_SNATIVELANGNAME
, user_lang
, sizeof(user_lang
)/sizeof(WCHAR
));
462 snprintfW(language_str
, sizeof(language_str
)/sizeof(WCHAR
), languages_fmtW
, system_lang
, regional_setting
, user_lang
);
464 hr
= add_bstr_property(node
, szLanguagesLocalized
, language_str
);
468 /* szLanguagesEnglish */
469 GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT
, LOCALE_SENGLANGUAGE
, system_lang
, sizeof(system_lang
)/sizeof(WCHAR
));
470 GetLocaleInfoW(LOCALE_USER_DEFAULT
, LOCALE_SENGLANGUAGE
, user_lang
, sizeof(user_lang
)/sizeof(WCHAR
));
472 snprintfW(language_str
, sizeof(language_str
)/sizeof(WCHAR
), languages_fmtW
, system_lang
, regional_setting_engW
, user_lang
);
474 hr
= add_bstr_property(node
, szLanguagesEnglish
, language_str
);
481 static HRESULT
fill_datetime_information(IDxDiagContainerImpl_Container
*node
)
483 static const WCHAR date_fmtW
[] = {'M','\'','/','\'','d','\'','/','\'','y','y','y','y',0};
484 static const WCHAR time_fmtW
[] = {'H','H','\'',':','\'','m','m','\'',':','\'','s','s',0};
485 static const WCHAR datetime_fmtW
[] = {'%','s',',',' ','%','s',0};
486 static const WCHAR szTimeLocalized
[] = {'s','z','T','i','m','e','L','o','c','a','l','i','z','e','d',0};
487 static const WCHAR szTimeEnglish
[] = {'s','z','T','i','m','e','E','n','g','l','i','s','h',0};
490 WCHAR date_str
[80], time_str
[80], datetime_str
[200];
493 GetLocalTime(&curtime
);
495 GetTimeFormatW(LOCALE_NEUTRAL
, 0, &curtime
, time_fmtW
, time_str
, sizeof(time_str
)/sizeof(WCHAR
));
497 /* szTimeLocalized */
498 GetDateFormatW(LOCALE_USER_DEFAULT
, DATE_LONGDATE
, &curtime
, NULL
, date_str
, sizeof(date_str
)/sizeof(WCHAR
));
500 snprintfW(datetime_str
, sizeof(datetime_str
)/sizeof(WCHAR
), datetime_fmtW
, date_str
, time_str
);
502 hr
= add_bstr_property(node
, szTimeLocalized
, datetime_str
);
507 GetDateFormatW(LOCALE_NEUTRAL
, 0, &curtime
, date_fmtW
, date_str
, sizeof(date_str
)/sizeof(WCHAR
));
509 snprintfW(datetime_str
, sizeof(datetime_str
)/sizeof(WCHAR
), datetime_fmtW
, date_str
, time_str
);
511 hr
= add_bstr_property(node
, szTimeEnglish
, datetime_str
);
518 static HRESULT
fill_os_string_information(IDxDiagContainerImpl_Container
*node
, OSVERSIONINFOW
*info
)
520 static const WCHAR winxpW
[] = {'W','i','n','d','o','w','s',' ','X','P',' ','P','r','o','f','e','s','s','i','o','n','a','l',0};
521 static const WCHAR szOSLocalized
[] = {'s','z','O','S','L','o','c','a','l','i','z','e','d',0};
522 static const WCHAR szOSExLocalized
[] = {'s','z','O','S','E','x','L','o','c','a','l','i','z','e','d',0};
523 static const WCHAR szOSExLongLocalized
[] = {'s','z','O','S','E','x','L','o','n','g','L','o','c','a','l','i','z','e','d',0};
524 static const WCHAR szOSEnglish
[] = {'s','z','O','S','E','n','g','l','i','s','h',0};
525 static const WCHAR szOSExEnglish
[] = {'s','z','O','S','E','x','E','n','g','l','i','s','h',0};
526 static const WCHAR szOSExLongEnglish
[] = {'s','z','O','S','E','x','L','o','n','g','E','n','g','l','i','s','h',0};
528 static const WCHAR
*prop_list
[] = {szOSLocalized
, szOSExLocalized
, szOSExLongLocalized
,
529 szOSEnglish
, szOSExEnglish
, szOSExLongEnglish
};
534 /* FIXME: OS detection should be performed, and localized OS strings
535 * should contain translated versions of the "build" phrase. */
536 for (i
= 0; i
< sizeof(prop_list
)/sizeof(prop_list
[0]); i
++)
538 hr
= add_bstr_property(node
, prop_list
[i
], winxpW
);
546 static HRESULT
build_systeminfo_tree(IDxDiagContainerImpl_Container
*node
)
548 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};
549 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};
550 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};
551 static const WCHAR szDirectXVersionLetter_v
[] = {'c',0};
552 static const WCHAR bDebug
[] = {'b','D','e','b','u','g',0};
553 static const WCHAR bNECPC98
[] = {'b','N','E','C','P','C','9','8',0};
554 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};
555 static const WCHAR szDirectXVersionEnglish_v
[] = {'4','.','0','9','.','0','0','0','0','.','0','9','0','4',0};
556 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};
557 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};
558 static const WCHAR ullPhysicalMemory
[] = {'u','l','l','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
559 static const WCHAR ullUsedPageFile
[] = {'u','l','l','U','s','e','d','P','a','g','e','F','i','l','e',0};
560 static const WCHAR ullAvailPageFile
[] = {'u','l','l','A','v','a','i','l','P','a','g','e','F','i','l','e',0};
561 static const WCHAR bNetMeetingRunning
[] = {'b','N','e','t','M','e','e','t','i','n','g','R','u','n','n','i','n','g',0};
562 static const WCHAR szWindowsDir
[] = {'s','z','W','i','n','d','o','w','s','D','i','r',0};
563 static const WCHAR dwOSMajorVersion
[] = {'d','w','O','S','M','a','j','o','r','V','e','r','s','i','o','n',0};
564 static const WCHAR dwOSMinorVersion
[] = {'d','w','O','S','M','i','n','o','r','V','e','r','s','i','o','n',0};
565 static const WCHAR dwOSBuildNumber
[] = {'d','w','O','S','B','u','i','l','d','N','u','m','b','e','r',0};
566 static const WCHAR dwOSPlatformID
[] = {'d','w','O','S','P','l','a','t','f','o','r','m','I','D',0};
567 static const WCHAR szCSDVersion
[] = {'s','z','C','S','D','V','e','r','s','i','o','n',0};
568 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};
569 static const WCHAR szPageFileLocalized
[] = {'s','z','P','a','g','e','F','i','l','e','L','o','c','a','l','i','z','e','d',0};
570 static const WCHAR szPageFileEnglish
[] = {'s','z','P','a','g','e','F','i','l','e','E','n','g','l','i','s','h',0};
571 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};
572 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};
574 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};
575 static const WCHAR physmem_fmtW
[] = {'%','u','M','B',' ','R','A','M',0};
580 DWORD count
, usedpage_mb
, availpage_mb
;
581 WCHAR buffer
[MAX_PATH
], computer_name
[MAX_COMPUTERNAME_LENGTH
+ 1], print_buf
[200], localized_pagefile_fmt
[200];
583 hr
= add_ui4_property(node
, dwDirectXVersionMajor
, 9);
587 hr
= add_ui4_property(node
, dwDirectXVersionMinor
, 0);
591 hr
= add_bstr_property(node
, szDirectXVersionLetter
, szDirectXVersionLetter_v
);
595 hr
= add_bstr_property(node
, szDirectXVersionEnglish
, szDirectXVersionEnglish_v
);
599 hr
= add_bstr_property(node
, szDirectXVersionLongEnglish
, szDirectXVersionLongEnglish_v
);
603 hr
= add_bool_property(node
, bDebug
, FALSE
);
607 hr
= add_bool_property(node
, bNECPC98
, FALSE
);
611 msex
.dwLength
= sizeof(msex
);
612 GlobalMemoryStatusEx(&msex
);
614 hr
= add_ull_as_bstr_property(node
, ullPhysicalMemory
, msex
.ullTotalPhys
);
618 hr
= add_ull_as_bstr_property(node
, ullUsedPageFile
, msex
.ullTotalPageFile
- msex
.ullAvailPageFile
);
622 hr
= add_ull_as_bstr_property(node
, ullAvailPageFile
, msex
.ullAvailPageFile
);
626 hr
= add_bool_property(node
, bNetMeetingRunning
, is_netmeeting_running());
630 info
.dwOSVersionInfoSize
= sizeof(info
);
631 GetVersionExW(&info
);
633 hr
= add_ui4_property(node
, dwOSMajorVersion
, info
.dwMajorVersion
);
637 hr
= add_ui4_property(node
, dwOSMinorVersion
, info
.dwMinorVersion
);
641 hr
= add_ui4_property(node
, dwOSBuildNumber
, info
.dwBuildNumber
);
645 hr
= add_ui4_property(node
, dwOSPlatformID
, info
.dwPlatformId
);
649 hr
= add_bstr_property(node
, szCSDVersion
, info
.szCSDVersion
);
653 /* FIXME: Roundoff should not be done with truncated division. */
654 snprintfW(print_buf
, sizeof(print_buf
)/sizeof(WCHAR
), physmem_fmtW
, (DWORD
)(msex
.ullTotalPhys
/ (1024 * 1024)));
655 hr
= add_bstr_property(node
, szPhysicalMemoryEnglish
, print_buf
);
659 usedpage_mb
= (DWORD
)((msex
.ullTotalPageFile
- msex
.ullAvailPageFile
) / (1024 * 1024));
660 availpage_mb
= (DWORD
)(msex
.ullAvailPageFile
/ (1024 * 1024));
661 LoadStringW(dxdiagn_instance
, IDS_PAGE_FILE_FORMAT
, localized_pagefile_fmt
, sizeof(localized_pagefile_fmt
)/sizeof(WCHAR
));
662 snprintfW(print_buf
, sizeof(print_buf
)/sizeof(WCHAR
), localized_pagefile_fmt
, usedpage_mb
, availpage_mb
);
664 hr
= add_bstr_property(node
, szPageFileLocalized
, print_buf
);
668 snprintfW(print_buf
, sizeof(print_buf
)/sizeof(WCHAR
), pagefile_fmtW
, usedpage_mb
, availpage_mb
);
670 hr
= add_bstr_property(node
, szPageFileEnglish
, print_buf
);
674 GetWindowsDirectoryW(buffer
, MAX_PATH
);
676 hr
= add_bstr_property(node
, szWindowsDir
, buffer
);
680 count
= sizeof(computer_name
)/sizeof(WCHAR
);
681 if (!GetComputerNameW(computer_name
, &count
))
684 hr
= add_bstr_property(node
, szMachineNameLocalized
, computer_name
);
688 hr
= add_bstr_property(node
, szMachineNameEnglish
, computer_name
);
692 hr
= fill_language_information(node
);
696 hr
= fill_datetime_information(node
);
700 hr
= fill_os_string_information(node
, &info
);
707 static HRESULT
build_displaydevices_tree(IDxDiagContainerImpl_Container
*node
)
709 static const WCHAR szDescription
[] = {'s','z','D','e','s','c','r','i','p','t','i','o','n',0};
710 static const WCHAR szDeviceName
[] = {'s','z','D','e','v','i','c','e','N','a','m','e',0};
711 static const WCHAR szKeyDeviceID
[] = {'s','z','K','e','y','D','e','v','i','c','e','I','D',0};
712 static const WCHAR szKeyDeviceKey
[] = {'s','z','K','e','y','D','e','v','i','c','e','K','e','y',0};
713 static const WCHAR szVendorId
[] = {'s','z','V','e','n','d','o','r','I','d',0};
714 static const WCHAR szDeviceId
[] = {'s','z','D','e','v','i','c','e','I','d',0};
715 static const WCHAR szDeviceIdentifier
[] = {'s','z','D','e','v','i','c','e','I','d','e','n','t','i','f','i','e','r',0};
716 static const WCHAR dwWidth
[] = {'d','w','W','i','d','t','h',0};
717 static const WCHAR dwHeight
[] = {'d','w','H','e','i','g','h','t',0};
718 static const WCHAR dwBpp
[] = {'d','w','B','p','p',0};
719 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};
720 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};
722 static const WCHAR szAdapterID
[] = {'0',0};
723 static const WCHAR szEmpty
[] = {0};
725 IDxDiagContainerImpl_Container
*display_adapter
;
727 IDirectDraw7
*pDirectDraw
;
729 DISPLAY_DEVICEW disp_dev
;
730 DDSURFACEDESC2 surface_descr
;
734 display_adapter
= allocate_information_node(szAdapterID
);
735 if (!display_adapter
)
736 return E_OUTOFMEMORY
;
738 add_subcontainer(node
, display_adapter
);
740 disp_dev
.cb
= sizeof(disp_dev
);
741 if (EnumDisplayDevicesW( NULL
, 0, &disp_dev
, 0 ))
743 hr
= add_bstr_property(display_adapter
, szDeviceName
, disp_dev
.DeviceName
);
747 hr
= add_bstr_property(display_adapter
, szDescription
, disp_dev
.DeviceString
);
752 /* For now, silently ignore a failure from DirectDrawCreateEx. */
753 hr
= DirectDrawCreateEx(NULL
, (LPVOID
*)&pDirectDraw
, &IID_IDirectDraw7
, NULL
);
757 dd_caps
.dwCaps
= DDSCAPS_LOCALVIDMEM
| DDSCAPS_VIDEOMEMORY
;
758 dd_caps
.dwCaps2
= dd_caps
.dwCaps3
= dd_caps
.dwCaps4
= 0;
759 hr
= IDirectDraw7_GetAvailableVidMem(pDirectDraw
, &dd_caps
, &tmp
, NULL
);
762 static const WCHAR mem_fmt
[] = {'%','.','1','f',' ','M','B',0};
764 snprintfW(buffer
, sizeof(buffer
)/sizeof(buffer
[0]), mem_fmt
, ((float)tmp
) / 1000000.0);
766 hr
= add_bstr_property(display_adapter
, szDisplayMemoryLocalized
, buffer
);
770 hr
= add_bstr_property(display_adapter
, szDisplayMemoryEnglish
, buffer
);
775 surface_descr
.dwSize
= sizeof(surface_descr
);
776 hr
= IDirectDraw7_GetDisplayMode(pDirectDraw
, &surface_descr
);
779 if (surface_descr
.dwFlags
& DDSD_WIDTH
)
781 hr
= add_ui4_property(display_adapter
, dwWidth
, surface_descr
.dwWidth
);
786 if (surface_descr
.dwFlags
& DDSD_HEIGHT
)
788 hr
= add_ui4_property(display_adapter
, dwHeight
, surface_descr
.dwHeight
);
793 if (surface_descr
.dwFlags
& DDSD_PIXELFORMAT
)
795 hr
= add_ui4_property(display_adapter
, dwBpp
, surface_descr
.u4
.ddpfPixelFormat
.u1
.dwRGBBitCount
);
801 get_display_device_id(buffer
);
803 hr
= add_bstr_property(display_adapter
, szDeviceIdentifier
, buffer
);
807 hr
= add_bstr_property(display_adapter
, szVendorId
, szEmpty
);
811 hr
= add_bstr_property(display_adapter
, szDeviceId
, szEmpty
);
815 hr
= add_bstr_property(display_adapter
, szKeyDeviceKey
, szEmpty
);
819 hr
= add_bstr_property(display_adapter
, szKeyDeviceID
, szEmpty
);
825 IDirectDraw7_Release(pDirectDraw
);
829 static HRESULT
build_directsound_tree(IDxDiagContainerImpl_Container
*node
)
831 static const WCHAR DxDiag_SoundDevices
[] = {'D','x','D','i','a','g','_','S','o','u','n','d','D','e','v','i','c','e','s',0};
832 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};
834 IDxDiagContainerImpl_Container
*cont
;
836 cont
= allocate_information_node(DxDiag_SoundDevices
);
838 return E_OUTOFMEMORY
;
840 add_subcontainer(node
, cont
);
842 cont
= allocate_information_node(DxDiag_SoundCaptureDevices
);
844 return E_OUTOFMEMORY
;
846 add_subcontainer(node
, cont
);
851 static HRESULT
build_directmusic_tree(IDxDiagContainerImpl_Container
*node
)
856 static HRESULT
build_directinput_tree(IDxDiagContainerImpl_Container
*node
)
861 static HRESULT
build_directplay_tree(IDxDiagContainerImpl_Container
*node
)
866 static HRESULT
build_systemdevices_tree(IDxDiagContainerImpl_Container
*node
)
871 static HRESULT
fill_file_description(IDxDiagContainerImpl_Container
*node
, const WCHAR
*szFilePath
, const WCHAR
*szFileName
)
873 static const WCHAR szSlashSep
[] = {'\\',0};
874 static const WCHAR szPath
[] = {'s','z','P','a','t','h',0};
875 static const WCHAR szName
[] = {'s','z','N','a','m','e',0};
876 static const WCHAR szVersion
[] = {'s','z','V','e','r','s','i','o','n',0};
877 static const WCHAR szAttributes
[] = {'s','z','A','t','t','r','i','b','u','t','e','s',0};
878 static const WCHAR szLanguageEnglish
[] = {'s','z','L','a','n','g','u','a','g','e','E','n','g','l','i','s','h',0};
879 static const WCHAR dwFileTimeHigh
[] = {'d','w','F','i','l','e','T','i','m','e','H','i','g','h',0};
880 static const WCHAR dwFileTimeLow
[] = {'d','w','F','i','l','e','T','i','m','e','L','o','w',0};
881 static const WCHAR bBeta
[] = {'b','B','e','t','a',0};
882 static const WCHAR bDebug
[] = {'b','D','e','b','u','g',0};
883 static const WCHAR bExists
[] = {'b','E','x','i','s','t','s',0};
886 static const WCHAR szFinal_Retail_v
[] = {'F','i','n','a','l',' ','R','e','t','a','i','l',0};
887 static const WCHAR szEnglish_v
[] = {'E','n','g','l','i','s','h',0};
888 static const WCHAR szVersionFormat
[] = {'%','u','.','%','0','2','u','.','%','0','4','u','.','%','0','4','u',0};
892 WCHAR szVersion_v
[1024];
894 void *pVersionInfo
= NULL
;
895 BOOL boolret
= FALSE
;
897 VS_FIXEDFILEINFO
*pFileInfo
;
899 TRACE("Filling container %p for %s in %s\n", node
,
900 debugstr_w(szFileName
), debugstr_w(szFilePath
));
902 szFile
= HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR
) * (lstrlenW(szFilePath
) +
903 lstrlenW(szFileName
) + 2 /* slash + terminator */));
905 return E_OUTOFMEMORY
;
907 lstrcpyW(szFile
, szFilePath
);
908 lstrcatW(szFile
, szSlashSep
);
909 lstrcatW(szFile
, szFileName
);
911 retval
= GetFileVersionInfoSizeW(szFile
, &hdl
);
914 pVersionInfo
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, retval
);
921 if (GetFileVersionInfoW(szFile
, 0, retval
, pVersionInfo
) &&
922 VerQueryValueW(pVersionInfo
, szSlashSep
, (void **)&pFileInfo
, &uiLength
))
926 hr
= add_bstr_property(node
, szPath
, szFile
);
930 hr
= add_bstr_property(node
, szName
, szFileName
);
934 hr
= add_bool_property(node
, bExists
, boolret
);
940 snprintfW(szVersion_v
, sizeof(szVersion_v
)/sizeof(szVersion_v
[0]),
942 HIWORD(pFileInfo
->dwFileVersionMS
),
943 LOWORD(pFileInfo
->dwFileVersionMS
),
944 HIWORD(pFileInfo
->dwFileVersionLS
),
945 LOWORD(pFileInfo
->dwFileVersionLS
));
947 TRACE("Found version as (%s)\n", debugstr_w(szVersion_v
));
949 hr
= add_bstr_property(node
, szVersion
, szVersion_v
);
953 hr
= add_bstr_property(node
, szAttributes
, szFinal_Retail_v
);
957 hr
= add_bstr_property(node
, szLanguageEnglish
, szEnglish_v
);
961 hr
= add_ui4_property(node
, dwFileTimeHigh
, pFileInfo
->dwFileDateMS
);
965 hr
= add_ui4_property(node
, dwFileTimeLow
, pFileInfo
->dwFileDateLS
);
969 hr
= add_bool_property(node
, bBeta
, ((pFileInfo
->dwFileFlags
& pFileInfo
->dwFileFlagsMask
) & VS_FF_PRERELEASE
) != 0);
973 hr
= add_bool_property(node
, bDebug
, ((pFileInfo
->dwFileFlags
& pFileInfo
->dwFileFlagsMask
) & VS_FF_DEBUG
) != 0);
980 HeapFree(GetProcessHeap(), 0, pVersionInfo
);
981 HeapFree(GetProcessHeap(), 0, szFile
);
985 static HRESULT
build_directxfiles_tree(IDxDiagContainerImpl_Container
*node
)
987 static const WCHAR dlls
[][15] =
989 {'d','3','d','8','.','d','l','l',0},
990 {'d','3','d','9','.','d','l','l',0},
991 {'d','d','r','a','w','.','d','l','l',0},
992 {'d','e','v','e','n','u','m','.','d','l','l',0},
993 {'d','i','n','p','u','t','8','.','d','l','l',0},
994 {'d','i','n','p','u','t','.','d','l','l',0},
995 {'d','m','b','a','n','d','.','d','l','l',0},
996 {'d','m','c','o','m','p','o','s','.','d','l','l',0},
997 {'d','m','i','m','e','.','d','l','l',0},
998 {'d','m','l','o','a','d','e','r','.','d','l','l',0},
999 {'d','m','s','c','r','i','p','t','.','d','l','l',0},
1000 {'d','m','s','t','y','l','e','.','d','l','l',0},
1001 {'d','m','s','y','n','t','h','.','d','l','l',0},
1002 {'d','m','u','s','i','c','.','d','l','l',0},
1003 {'d','p','l','a','y','x','.','d','l','l',0},
1004 {'d','p','n','e','t','.','d','l','l',0},
1005 {'d','s','o','u','n','d','.','d','l','l',0},
1006 {'d','s','w','a','v','e','.','d','l','l',0},
1007 {'d','x','d','i','a','g','n','.','d','l','l',0},
1008 {'q','u','a','r','t','z','.','d','l','l',0}
1012 WCHAR szFilePath
[MAX_PATH
];
1015 GetSystemDirectoryW(szFilePath
, MAX_PATH
);
1017 for (i
= 0; i
< sizeof(dlls
) / sizeof(dlls
[0]); i
++)
1019 static const WCHAR szFormat
[] = {'%','d',0};
1022 IDxDiagContainerImpl_Container
*file_container
;
1024 snprintfW(szFileID
, sizeof(szFileID
)/sizeof(szFileID
[0]), szFormat
, i
);
1026 file_container
= allocate_information_node(szFileID
);
1027 if (!file_container
)
1028 return E_OUTOFMEMORY
;
1030 hr
= fill_file_description(file_container
, szFilePath
, dlls
[i
]);
1033 free_information_tree(file_container
);
1037 add_subcontainer(node
, file_container
);
1043 static HRESULT
read_property_names(IPropertyBag
*pPropBag
, VARIANT
*friendly_name
, VARIANT
*clsid_name
)
1045 static const WCHAR wszFriendlyName
[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
1046 static const WCHAR wszClsidName
[] = {'C','L','S','I','D',0};
1050 VariantInit(friendly_name
);
1051 VariantInit(clsid_name
);
1053 hr
= IPropertyBag_Read(pPropBag
, wszFriendlyName
, friendly_name
, 0);
1057 hr
= IPropertyBag_Read(pPropBag
, wszClsidName
, clsid_name
, 0);
1060 VariantClear(friendly_name
);
1067 static HRESULT
fill_filter_data_information(IDxDiagContainerImpl_Container
*subcont
, BYTE
*pData
, ULONG cb
)
1069 static const WCHAR szVersionW
[] = {'s','z','V','e','r','s','i','o','n',0};
1070 static const WCHAR dwInputs
[] = {'d','w','I','n','p','u','t','s',0};
1071 static const WCHAR dwOutputs
[] = {'d','w','O','u','t','p','u','t','s',0};
1072 static const WCHAR dwMeritW
[] = {'d','w','M','e','r','i','t',0};
1073 static const WCHAR szVersionFormat
[] = {'v','%','d',0};
1076 IFilterMapper2
*pFileMapper
= NULL
;
1077 IAMFilterData
*pFilterData
= NULL
;
1078 REGFILTER2
*pRF
= NULL
;
1081 DWORD dwNOutputs
= 0;
1082 DWORD dwNInputs
= 0;
1084 hr
= CoCreateInstance(&CLSID_FilterMapper2
, NULL
, CLSCTX_INPROC
, &IID_IFilterMapper2
,
1085 (void **)&pFileMapper
);
1089 hr
= IFilterMapper2_QueryInterface(pFileMapper
, &IID_IAMFilterData
, (void **)&pFilterData
);
1093 hr
= IAMFilterData_ParseFilterData(pFilterData
, pData
, cb
, (BYTE
**)&pRF
);
1097 snprintfW(bufferW
, sizeof(bufferW
)/sizeof(bufferW
[0]), szVersionFormat
, pRF
->dwVersion
);
1098 hr
= add_bstr_property(subcont
, szVersionW
, bufferW
);
1102 if (pRF
->dwVersion
== 1)
1104 for (j
= 0; j
< pRF
->u
.s
.cPins
; j
++)
1105 if (pRF
->u
.s
.rgPins
[j
].bOutput
)
1110 else if (pRF
->dwVersion
== 2)
1112 for (j
= 0; j
< pRF
->u
.s1
.cPins2
; j
++)
1113 if (pRF
->u
.s1
.rgPins2
[j
].dwFlags
& REG_PINFLAG_B_OUTPUT
)
1119 hr
= add_ui4_property(subcont
, dwInputs
, dwNInputs
);
1123 hr
= add_ui4_property(subcont
, dwOutputs
, dwNOutputs
);
1127 hr
= add_ui4_property(subcont
, dwMeritW
, pRF
->dwMerit
);
1134 if (pFilterData
) IAMFilterData_Release(pFilterData
);
1135 if (pFileMapper
) IFilterMapper2_Release(pFileMapper
);
1140 static HRESULT
fill_filter_container(IDxDiagContainerImpl_Container
*subcont
, IMoniker
*pMoniker
)
1142 static const WCHAR szName
[] = {'s','z','N','a','m','e',0};
1143 static const WCHAR ClsidFilterW
[] = {'C','l','s','i','d','F','i','l','t','e','r',0};
1144 static const WCHAR wszFilterDataName
[] = {'F','i','l','t','e','r','D','a','t','a',0};
1147 IPropertyBag
*pPropFilterBag
= NULL
;
1149 VARIANT friendly_name
;
1153 VariantInit(&friendly_name
);
1154 VariantInit(&clsid_name
);
1157 hr
= IMoniker_BindToStorage(pMoniker
, NULL
, NULL
, &IID_IPropertyBag
, (void **)&pPropFilterBag
);
1161 hr
= read_property_names(pPropFilterBag
, &friendly_name
, &clsid_name
);
1165 TRACE("Name = %s\n", debugstr_w(V_BSTR(&friendly_name
)));
1166 TRACE("CLSID = %s\n", debugstr_w(V_BSTR(&clsid_name
)));
1168 hr
= add_bstr_property(subcont
, szName
, V_BSTR(&friendly_name
));
1172 hr
= add_bstr_property(subcont
, ClsidFilterW
, V_BSTR(&clsid_name
));
1176 hr
= IPropertyBag_Read(pPropFilterBag
, wszFilterDataName
, &v
, NULL
);
1180 hr
= SafeArrayAccessData(V_ARRAY(&v
), (void **)&pData
);
1184 hr
= fill_filter_data_information(subcont
, pData
, V_ARRAY(&v
)->rgsabound
->cElements
);
1185 SafeArrayUnaccessData(V_ARRAY(&v
));
1192 VariantClear(&clsid_name
);
1193 VariantClear(&friendly_name
);
1194 if (pPropFilterBag
) IPropertyBag_Release(pPropFilterBag
);
1199 static HRESULT
build_directshowfilters_tree(IDxDiagContainerImpl_Container
*node
)
1201 static const WCHAR szCatName
[] = {'s','z','C','a','t','N','a','m','e',0};
1202 static const WCHAR ClsidCatW
[] = {'C','l','s','i','d','C','a','t',0};
1203 static const WCHAR szIdFormat
[] = {'%','d',0};
1207 ICreateDevEnum
*pCreateDevEnum
;
1208 IEnumMoniker
*pEmCat
= NULL
;
1209 IMoniker
*pMCat
= NULL
;
1210 IEnumMoniker
*pEnum
= NULL
;
1212 hr
= CoCreateInstance(&CLSID_SystemDeviceEnum
, NULL
, CLSCTX_INPROC_SERVER
,
1213 &IID_ICreateDevEnum
, (void **)&pCreateDevEnum
);
1217 hr
= ICreateDevEnum_CreateClassEnumerator(pCreateDevEnum
, &CLSID_ActiveMovieCategories
, &pEmCat
, 0);
1221 while (IEnumMoniker_Next(pEmCat
, 1, &pMCat
, NULL
) == S_OK
)
1225 IPropertyBag
*pPropBag
;
1227 IMoniker
*pMoniker
= NULL
;
1229 hr
= IMoniker_BindToStorage(pMCat
, NULL
, NULL
, &IID_IPropertyBag
, (void **)&pPropBag
);
1232 IMoniker_Release(pMCat
);
1236 hr
= read_property_names(pPropBag
, &vCatName
, &vCatClsid
);
1237 IPropertyBag_Release(pPropBag
);
1240 IMoniker_Release(pMCat
);
1244 hr
= CLSIDFromString(V_BSTR(&vCatClsid
), &clsidCat
);
1247 IMoniker_Release(pMCat
);
1248 VariantClear(&vCatClsid
);
1249 VariantClear(&vCatName
);
1253 hr
= ICreateDevEnum_CreateClassEnumerator(pCreateDevEnum
, &clsidCat
, &pEnum
, 0);
1256 IMoniker_Release(pMCat
);
1257 VariantClear(&vCatClsid
);
1258 VariantClear(&vCatName
);
1262 TRACE("Enumerating class %s\n", debugstr_guid(&clsidCat
));
1264 while (IEnumMoniker_Next(pEnum
, 1, &pMoniker
, NULL
) == S_OK
)
1267 IDxDiagContainerImpl_Container
*subcont
;
1269 snprintfW(bufferW
, sizeof(bufferW
)/sizeof(bufferW
[0]), szIdFormat
, i
);
1270 subcont
= allocate_information_node(bufferW
);
1274 IMoniker_Release(pMoniker
);
1278 hr
= add_bstr_property(subcont
, szCatName
, V_BSTR(&vCatName
));
1281 free_information_tree(subcont
);
1282 IMoniker_Release(pMoniker
);
1286 hr
= add_bstr_property(subcont
, ClsidCatW
, V_BSTR(&vCatClsid
));
1289 free_information_tree(subcont
);
1290 IMoniker_Release(pMoniker
);
1294 hr
= fill_filter_container(subcont
, pMoniker
);
1297 free_information_tree(subcont
);
1298 IMoniker_Release(pMoniker
);
1302 add_subcontainer(node
, subcont
);
1304 IMoniker_Release(pMoniker
);
1307 IEnumMoniker_Release(pEnum
);
1308 IMoniker_Release(pMCat
);
1309 VariantClear(&vCatClsid
);
1310 VariantClear(&vCatName
);
1317 if (pEmCat
) IEnumMoniker_Release(pEmCat
);
1318 ICreateDevEnum_Release(pCreateDevEnum
);
1322 static HRESULT
build_logicaldisks_tree(IDxDiagContainerImpl_Container
*node
)
1327 static HRESULT
build_information_tree(IDxDiagContainerImpl_Container
**pinfo_root
)
1329 static const WCHAR DxDiag_SystemInfo
[] = {'D','x','D','i','a','g','_','S','y','s','t','e','m','I','n','f','o',0};
1330 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};
1331 static const WCHAR DxDiag_DirectSound
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','S','o','u','n','d',0};
1332 static const WCHAR DxDiag_DirectMusic
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','M','u','s','i','c',0};
1333 static const WCHAR DxDiag_DirectInput
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','I','n','p','u','t',0};
1334 static const WCHAR DxDiag_DirectPlay
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','P','l','a','y',0};
1335 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};
1336 static const WCHAR DxDiag_DirectXFiles
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','X','F','i','l','e','s',0};
1337 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};
1338 static const WCHAR DxDiag_LogicalDisks
[] = {'D','x','D','i','a','g','_','L','o','g','i','c','a','l','D','i','s','k','s',0};
1343 HRESULT (*initfunc
)(IDxDiagContainerImpl_Container
*);
1346 {DxDiag_SystemInfo
, build_systeminfo_tree
},
1347 {DxDiag_DisplayDevices
, build_displaydevices_tree
},
1348 {DxDiag_DirectSound
, build_directsound_tree
},
1349 {DxDiag_DirectMusic
, build_directmusic_tree
},
1350 {DxDiag_DirectInput
, build_directinput_tree
},
1351 {DxDiag_DirectPlay
, build_directplay_tree
},
1352 {DxDiag_SystemDevices
, build_systemdevices_tree
},
1353 {DxDiag_DirectXFiles
, build_directxfiles_tree
},
1354 {DxDiag_DirectShowFilters
, build_directshowfilters_tree
},
1355 {DxDiag_LogicalDisks
, build_logicaldisks_tree
},
1358 IDxDiagContainerImpl_Container
*info_root
;
1361 info_root
= allocate_information_node(NULL
);
1363 return E_OUTOFMEMORY
;
1365 for (index
= 0; index
< sizeof(root_children
)/sizeof(root_children
[0]); index
++)
1367 IDxDiagContainerImpl_Container
*node
;
1370 node
= allocate_information_node(root_children
[index
].name
);
1373 free_information_tree(info_root
);
1374 return E_OUTOFMEMORY
;
1377 hr
= root_children
[index
].initfunc(node
);
1380 free_information_tree(node
);
1381 free_information_tree(info_root
);
1385 add_subcontainer(info_root
, node
);
1388 *pinfo_root
= info_root
;