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
25 #define NONAMELESSUNION
26 #define NONAMELESSSTRUCT
27 #include "dxdiag_private.h"
36 #include "wine/fil_data.h"
40 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(dxdiag
);
44 static const WCHAR szEmpty
[] = {0};
46 static HRESULT
build_information_tree(IDxDiagContainerImpl_Container
**pinfo_root
);
47 static void free_information_tree(IDxDiagContainerImpl_Container
*node
);
49 static const WCHAR szDescription
[] = {'s','z','D','e','s','c','r','i','p','t','i','o','n',0};
50 static const WCHAR szDeviceName
[] = {'s','z','D','e','v','i','c','e','N','a','m','e',0};
51 static const WCHAR szKeyDeviceID
[] = {'s','z','K','e','y','D','e','v','i','c','e','I','D',0};
52 static const WCHAR szKeyDeviceKey
[] = {'s','z','K','e','y','D','e','v','i','c','e','K','e','y',0};
53 static const WCHAR szVendorId
[] = {'s','z','V','e','n','d','o','r','I','d',0};
54 static const WCHAR szDeviceId
[] = {'s','z','D','e','v','i','c','e','I','d',0};
55 static const WCHAR szDeviceIdentifier
[] = {'s','z','D','e','v','i','c','e','I','d','e','n','t','i','f','i','e','r',0};
56 static const WCHAR dwWidth
[] = {'d','w','W','i','d','t','h',0};
57 static const WCHAR dwHeight
[] = {'d','w','H','e','i','g','h','t',0};
58 static const WCHAR dwBpp
[] = {'d','w','B','p','p',0};
59 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};
60 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};
61 static const WCHAR szDisplayModeLocalized
[] = {'s','z','D','i','s','p','l','a','y','M','o','d','e','L','o','c','a','l','i','z','e','d',0};
62 static const WCHAR szDisplayModeEnglish
[] = {'s','z','D','i','s','p','l','a','y','M','o','d','e','E','n','g','l','i','s','h',0};
63 static const WCHAR szDriverName
[] = {'s','z','D','r','i','v','e','r','N','a','m','e',0};
64 static const WCHAR szDriverVersion
[] = {'s','z','D','r','i','v','e','r','V','e','r','s','i','o','n',0};
65 static const WCHAR szSubSysId
[] = {'s','z','S','u','b','S','y','s','I','d',0};
66 static const WCHAR szRevisionId
[] = {'s','z','R','e','v','i','s','i','o','n','I','d',0};
67 static const WCHAR dwRefreshRate
[] = {'d','w','R','e','f','r','e','s','h','R','a','t','e',0};
68 static const WCHAR szManufacturer
[] = {'s','z','M','a','n','u','f','a','c','t','u','r','e','r',0};
69 static const WCHAR szChipType
[] = {'s','z','C','h','i','p','T','y','p','e',0};
70 static const WCHAR szDACType
[] = {'s','z','D','A','C','T','y','p','e',0};
71 static const WCHAR szRevision
[] = {'s','z','R','e','v','i','s','i','o','n',0};
72 static const WCHAR szMonitorName
[] = {'s','z','M','o','n','i','t','o','r','N','a','m','e',0};
73 static const WCHAR szMonitorMaxRes
[] = {'s','z','M','o','n','i','t','o','r','M','a','x','R','e','s',0};
74 static const WCHAR szDriverAttributes
[] = {'s','z','D','r','i','v','e','r','A','t','t','r','i','b','u','t','e','s',0};
75 static const WCHAR szDriverLanguageEnglish
[] = {'s','z','D','r','i','v','e','r','L','a','n','g','u','a','g','e','E','n','g','l','i','s','h',0};
76 static const WCHAR szDriverLanguageLocalized
[] = {'s','z','D','r','i','v','e','r','L','a','n','g','u','a','g','e','L','o','c','a','l','i','z','e','d',0};
77 static const WCHAR szDriverDateEnglish
[] = {'s','z','D','r','i','v','e','r','D','a','t','e','E','n','g','l','i','s','h',0};
78 static const WCHAR szDriverDateLocalized
[] = {'s','z','D','r','i','v','e','r','D','a','t','e','L','o','c','a','l','i','z','e','d',0};
79 static const WCHAR lDriverSize
[] = {'l','D','r','i','v','e','r','S','i','z','e',0};
80 static const WCHAR szMiniVdd
[] = {'s','z','M','i','n','i','V','d','d',0};
81 static const WCHAR szMiniVddDateLocalized
[] = {'s','z','M','i','n','i','V','d','d','D','a','t','e','L','o','c','a','l','i','z','e','d',0};
82 static const WCHAR szMiniVddDateEnglish
[] = {'s','z','M','i','n','i','V','d','d','D','a','t','e','E','n','g','l','i','s','h',0};
83 static const WCHAR lMiniVddSize
[] = {'l','M','i','n','i','V','d','d','S','i','z','e',0};
84 static const WCHAR szVdd
[] = {'s','z','V','d','d',0};
85 static const WCHAR bCanRenderWindow
[] = {'b','C','a','n','R','e','n','d','e','r','W','i','n','d','o','w',0};
86 static const WCHAR bDriverBeta
[] = {'b','D','r','i','v','e','r','B','e','t','a',0};
87 static const WCHAR bDriverDebug
[] = {'b','D','r','i','v','e','r','D','e','b','u','g',0};
88 static const WCHAR bDriverSigned
[] = {'b','D','r','i','v','e','r','S','i','g','n','e','d',0};
89 static const WCHAR bDriverSignedValid
[] = {'b','D','r','i','v','e','r','S','i','g','n','e','d','V','a','l','i','d',0};
90 static const WCHAR szDriverSignDate
[] = {'s','z','D','r','i','v','e','r','S','i','g','n','D','a','t','e',0};
91 static const WCHAR dwDDIVersion
[] = {'d','w','D','D','I','V','e','r','s','i','o','n',0};
92 static const WCHAR szDDIVersionEnglish
[] = {'s','z','D','D','I','V','e','r','s','i','o','n','E','n','g','l','i','s','h',0};
93 static const WCHAR szDDIVersionLocalized
[] = {'s','z','D','D','I','V','e','r','s','i','o','n','L','o','c','a','l','i','z','e','d',0};
94 static const WCHAR iAdapter
[] = {'i','A','d','a','p','t','e','r',0};
95 static const WCHAR dwWHQLLevel
[] = {'d','w','W','H','Q','L','L','e','v','e','l',0};
97 struct IDxDiagProviderImpl
99 IDxDiagProvider IDxDiagProvider_iface
;
102 DXDIAG_INIT_PARAMS params
;
103 IDxDiagContainerImpl_Container
*info_root
;
106 static inline IDxDiagProviderImpl
*impl_from_IDxDiagProvider(IDxDiagProvider
*iface
)
108 return CONTAINING_RECORD(iface
, IDxDiagProviderImpl
, IDxDiagProvider_iface
);
111 /* IDxDiagProvider IUnknown parts follow: */
112 static HRESULT WINAPI
IDxDiagProviderImpl_QueryInterface(IDxDiagProvider
*iface
, REFIID riid
,
115 IDxDiagProviderImpl
*This
= impl_from_IDxDiagProvider(iface
);
117 if (!ppobj
) return E_INVALIDARG
;
119 if (IsEqualGUID(riid
, &IID_IUnknown
)
120 || IsEqualGUID(riid
, &IID_IDxDiagProvider
)) {
121 IUnknown_AddRef(iface
);
126 WARN("(%p)->(%s,%p),not found\n",This
,debugstr_guid(riid
),ppobj
);
128 return E_NOINTERFACE
;
131 static ULONG WINAPI
IDxDiagProviderImpl_AddRef(IDxDiagProvider
*iface
)
133 IDxDiagProviderImpl
*This
= impl_from_IDxDiagProvider(iface
);
134 ULONG refCount
= InterlockedIncrement(&This
->ref
);
136 TRACE("(%p)->(ref before=%u)\n", This
, refCount
- 1);
138 DXDIAGN_LockModule();
143 static ULONG WINAPI
IDxDiagProviderImpl_Release(IDxDiagProvider
*iface
)
145 IDxDiagProviderImpl
*This
= impl_from_IDxDiagProvider(iface
);
146 ULONG refCount
= InterlockedDecrement(&This
->ref
);
148 TRACE("(%p)->(ref before=%u)\n", This
, refCount
+ 1);
151 free_information_tree(This
->info_root
);
152 HeapFree(GetProcessHeap(), 0, This
);
155 DXDIAGN_UnlockModule();
160 /* IDxDiagProvider Interface follow: */
161 static HRESULT WINAPI
IDxDiagProviderImpl_Initialize(IDxDiagProvider
*iface
,
162 DXDIAG_INIT_PARAMS
*pParams
)
164 IDxDiagProviderImpl
*This
= impl_from_IDxDiagProvider(iface
);
167 TRACE("(%p,%p)\n", iface
, pParams
);
169 if (NULL
== pParams
) {
172 if (pParams
->dwSize
!= sizeof(DXDIAG_INIT_PARAMS
) ||
173 pParams
->dwDxDiagHeaderVersion
!= DXDIAG_DX9_SDK_VERSION
) {
177 if (!This
->info_root
)
179 hr
= build_information_tree(&This
->info_root
);
185 memcpy(&This
->params
, pParams
, pParams
->dwSize
);
189 static HRESULT WINAPI
IDxDiagProviderImpl_GetRootContainer(IDxDiagProvider
*iface
,
190 IDxDiagContainer
**ppInstance
)
192 IDxDiagProviderImpl
*This
= impl_from_IDxDiagProvider(iface
);
194 TRACE("(%p,%p)\n", iface
, ppInstance
);
196 if (FALSE
== This
->init
) {
197 return CO_E_NOTINITIALIZED
;
200 return DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer
, This
->info_root
,
201 &This
->IDxDiagProvider_iface
, (void **)ppInstance
);
204 static const IDxDiagProviderVtbl DxDiagProvider_Vtbl
=
206 IDxDiagProviderImpl_QueryInterface
,
207 IDxDiagProviderImpl_AddRef
,
208 IDxDiagProviderImpl_Release
,
209 IDxDiagProviderImpl_Initialize
,
210 IDxDiagProviderImpl_GetRootContainer
213 HRESULT
DXDiag_CreateDXDiagProvider(LPCLASSFACTORY iface
, LPUNKNOWN punkOuter
, REFIID riid
, LPVOID
*ppobj
) {
214 IDxDiagProviderImpl
* provider
;
216 TRACE("(%p, %s, %p)\n", punkOuter
, debugstr_guid(riid
), ppobj
);
219 if (punkOuter
) return CLASS_E_NOAGGREGATION
;
221 provider
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IDxDiagProviderImpl
));
222 if (NULL
== provider
) return E_OUTOFMEMORY
;
223 provider
->IDxDiagProvider_iface
.lpVtbl
= &DxDiagProvider_Vtbl
;
224 provider
->ref
= 0; /* will be inited with QueryInterface */
225 return IDxDiagProviderImpl_QueryInterface(&provider
->IDxDiagProvider_iface
, riid
, ppobj
);
228 static void free_property_information(IDxDiagContainerImpl_Property
*prop
)
230 VariantClear(&prop
->vProp
);
231 HeapFree(GetProcessHeap(), 0, prop
->propName
);
232 HeapFree(GetProcessHeap(), 0, prop
);
235 static void free_information_tree(IDxDiagContainerImpl_Container
*node
)
237 IDxDiagContainerImpl_Container
*ptr
, *cursor2
;
242 HeapFree(GetProcessHeap(), 0, node
->contName
);
244 LIST_FOR_EACH_ENTRY_SAFE(ptr
, cursor2
, &node
->subContainers
, IDxDiagContainerImpl_Container
, entry
)
246 IDxDiagContainerImpl_Property
*prop
, *prop_cursor2
;
248 LIST_FOR_EACH_ENTRY_SAFE(prop
, prop_cursor2
, &ptr
->properties
, IDxDiagContainerImpl_Property
, entry
)
250 list_remove(&prop
->entry
);
251 free_property_information(prop
);
254 list_remove(&ptr
->entry
);
255 free_information_tree(ptr
);
258 HeapFree(GetProcessHeap(), 0, node
);
261 static IDxDiagContainerImpl_Container
*allocate_information_node(const WCHAR
*name
)
263 IDxDiagContainerImpl_Container
*ret
;
265 ret
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*ret
));
271 ret
->contName
= HeapAlloc(GetProcessHeap(), 0, (lstrlenW(name
) + 1) * sizeof(*name
));
274 HeapFree(GetProcessHeap(), 0, ret
);
277 lstrcpyW(ret
->contName
, name
);
280 list_init(&ret
->subContainers
);
281 list_init(&ret
->properties
);
286 static IDxDiagContainerImpl_Property
*allocate_property_information(const WCHAR
*name
)
288 IDxDiagContainerImpl_Property
*ret
;
290 ret
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*ret
));
294 ret
->propName
= HeapAlloc(GetProcessHeap(), 0, (lstrlenW(name
) + 1) * sizeof(*name
));
297 HeapFree(GetProcessHeap(), 0, ret
);
300 lstrcpyW(ret
->propName
, name
);
305 static inline void add_subcontainer(IDxDiagContainerImpl_Container
*node
, IDxDiagContainerImpl_Container
*subCont
)
307 list_add_tail(&node
->subContainers
, &subCont
->entry
);
308 ++node
->nSubContainers
;
311 static inline HRESULT
add_bstr_property(IDxDiagContainerImpl_Container
*node
, const WCHAR
*propName
, const WCHAR
*str
)
313 IDxDiagContainerImpl_Property
*prop
;
316 prop
= allocate_property_information(propName
);
318 return E_OUTOFMEMORY
;
320 bstr
= SysAllocString(str
);
323 free_property_information(prop
);
324 return E_OUTOFMEMORY
;
327 V_VT(&prop
->vProp
) = VT_BSTR
;
328 V_BSTR(&prop
->vProp
) = bstr
;
330 list_add_tail(&node
->properties
, &prop
->entry
);
336 static inline HRESULT
add_ui4_property(IDxDiagContainerImpl_Container
*node
, const WCHAR
*propName
, DWORD data
)
338 IDxDiagContainerImpl_Property
*prop
;
340 prop
= allocate_property_information(propName
);
342 return E_OUTOFMEMORY
;
344 V_VT(&prop
->vProp
) = VT_UI4
;
345 V_UI4(&prop
->vProp
) = data
;
347 list_add_tail(&node
->properties
, &prop
->entry
);
353 static inline HRESULT
add_i4_property(IDxDiagContainerImpl_Container
*node
, const WCHAR
*propName
, LONG data
)
355 IDxDiagContainerImpl_Property
*prop
;
357 prop
= allocate_property_information(propName
);
359 return E_OUTOFMEMORY
;
361 V_VT(&prop
->vProp
) = VT_I4
;
362 V_I4(&prop
->vProp
) = data
;
364 list_add_tail(&node
->properties
, &prop
->entry
);
370 static inline HRESULT
add_bool_property(IDxDiagContainerImpl_Container
*node
, const WCHAR
*propName
, BOOL data
)
372 IDxDiagContainerImpl_Property
*prop
;
374 prop
= allocate_property_information(propName
);
376 return E_OUTOFMEMORY
;
378 V_VT(&prop
->vProp
) = VT_BOOL
;
379 V_BOOL(&prop
->vProp
) = data
? VARIANT_TRUE
: VARIANT_FALSE
;
381 list_add_tail(&node
->properties
, &prop
->entry
);
387 static inline HRESULT
add_ull_as_bstr_property(IDxDiagContainerImpl_Container
*node
, const WCHAR
*propName
, ULONGLONG data
)
389 IDxDiagContainerImpl_Property
*prop
;
392 prop
= allocate_property_information(propName
);
394 return E_OUTOFMEMORY
;
396 V_VT(&prop
->vProp
) = VT_UI8
;
397 V_UI8(&prop
->vProp
) = data
;
399 hr
= VariantChangeType(&prop
->vProp
, &prop
->vProp
, 0, VT_BSTR
);
402 free_property_information(prop
);
406 list_add_tail(&node
->properties
, &prop
->entry
);
412 /* Copied from programs/taskkill/taskkill.c. */
413 static DWORD
*enumerate_processes(DWORD
*list_count
)
415 DWORD
*pid_list
, alloc_bytes
= 1024 * sizeof(*pid_list
), needed_bytes
;
417 pid_list
= HeapAlloc(GetProcessHeap(), 0, alloc_bytes
);
425 if (!EnumProcesses(pid_list
, alloc_bytes
, &needed_bytes
))
427 HeapFree(GetProcessHeap(), 0, pid_list
);
431 /* EnumProcesses can't signal an insufficient buffer condition, so the
432 * only way to possibly determine whether a larger buffer is required
433 * is to see whether the written number of bytes is the same as the
434 * buffer size. If so, the buffer will be reallocated to twice the
436 if (alloc_bytes
!= needed_bytes
)
440 realloc_list
= HeapReAlloc(GetProcessHeap(), 0, pid_list
, alloc_bytes
);
443 HeapFree(GetProcessHeap(), 0, pid_list
);
446 pid_list
= realloc_list
;
449 *list_count
= needed_bytes
/ sizeof(*pid_list
);
453 /* Copied from programs/taskkill/taskkill.c. */
454 static BOOL
get_process_name_from_pid(DWORD pid
, WCHAR
*buf
, DWORD chars
)
460 process
= OpenProcess(PROCESS_QUERY_INFORMATION
| PROCESS_VM_READ
, FALSE
, pid
);
464 if (!EnumProcessModules(process
, &module
, sizeof(module
), &required_size
))
466 CloseHandle(process
);
470 if (!GetModuleBaseNameW(process
, module
, buf
, chars
))
472 CloseHandle(process
);
476 CloseHandle(process
);
480 /* dxdiagn's detection scheme is simply to look for a process called conf.exe. */
481 static BOOL
is_netmeeting_running(void)
483 static const WCHAR conf_exe
[] = {'c','o','n','f','.','e','x','e',0};
486 DWORD
*pid_list
= enumerate_processes(&list_count
);
491 WCHAR process_name
[MAX_PATH
];
493 for (i
= 0; i
< list_count
; i
++)
495 if (get_process_name_from_pid(pid_list
[i
], process_name
, ARRAY_SIZE(process_name
)) &&
496 !lstrcmpW(conf_exe
, process_name
))
498 HeapFree(GetProcessHeap(), 0, pid_list
);
502 HeapFree(GetProcessHeap(), 0, pid_list
);
508 static HRESULT
fill_language_information(IDxDiagContainerImpl_Container
*node
)
510 static const WCHAR regional_setting_engW
[] = {'R','e','g','i','o','n','a','l',' ','S','e','t','t','i','n','g',0};
511 static const WCHAR languages_fmtW
[] = {'%','s',' ','(','%','s',':',' ','%','s',')',0};
512 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};
513 static const WCHAR szLanguagesEnglish
[] = {'s','z','L','a','n','g','u','a','g','e','s','E','n','g','l','i','s','h',0};
515 WCHAR system_lang
[80], regional_setting
[100], user_lang
[80], language_str
[300];
518 /* szLanguagesLocalized */
519 GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT
, LOCALE_SNATIVELANGNAME
, system_lang
, ARRAY_SIZE(system_lang
));
520 LoadStringW(dxdiagn_instance
, IDS_REGIONAL_SETTING
, regional_setting
, ARRAY_SIZE(regional_setting
));
521 GetLocaleInfoW(LOCALE_USER_DEFAULT
, LOCALE_SNATIVELANGNAME
, user_lang
, ARRAY_SIZE(user_lang
));
523 swprintf(language_str
, ARRAY_SIZE(language_str
), languages_fmtW
, system_lang
, regional_setting
,
526 hr
= add_bstr_property(node
, szLanguagesLocalized
, language_str
);
530 /* szLanguagesEnglish */
531 GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT
, LOCALE_SENGLANGUAGE
, system_lang
, ARRAY_SIZE(system_lang
));
532 GetLocaleInfoW(LOCALE_USER_DEFAULT
, LOCALE_SENGLANGUAGE
, user_lang
, ARRAY_SIZE(user_lang
));
534 swprintf(language_str
, ARRAY_SIZE(language_str
), languages_fmtW
, system_lang
,
535 regional_setting_engW
, user_lang
);
537 hr
= add_bstr_property(node
, szLanguagesEnglish
, language_str
);
544 static HRESULT
fill_datetime_information(IDxDiagContainerImpl_Container
*node
)
546 static const WCHAR date_fmtW
[] = {'M','\'','/','\'','d','\'','/','\'','y','y','y','y',0};
547 static const WCHAR time_fmtW
[] = {'H','H','\'',':','\'','m','m','\'',':','\'','s','s',0};
548 static const WCHAR datetime_fmtW
[] = {'%','s',',',' ','%','s',0};
549 static const WCHAR szTimeLocalized
[] = {'s','z','T','i','m','e','L','o','c','a','l','i','z','e','d',0};
550 static const WCHAR szTimeEnglish
[] = {'s','z','T','i','m','e','E','n','g','l','i','s','h',0};
553 WCHAR date_str
[80], time_str
[80], datetime_str
[200];
556 GetLocalTime(&curtime
);
558 GetTimeFormatW(LOCALE_NEUTRAL
, 0, &curtime
, time_fmtW
, time_str
, ARRAY_SIZE(time_str
));
560 /* szTimeLocalized */
561 GetDateFormatW(LOCALE_USER_DEFAULT
, DATE_LONGDATE
, &curtime
, NULL
, date_str
, ARRAY_SIZE(date_str
));
563 swprintf(datetime_str
, ARRAY_SIZE(datetime_str
), datetime_fmtW
, date_str
, time_str
);
565 hr
= add_bstr_property(node
, szTimeLocalized
, datetime_str
);
570 GetDateFormatW(LOCALE_NEUTRAL
, 0, &curtime
, date_fmtW
, date_str
, ARRAY_SIZE(date_str
));
572 swprintf(datetime_str
, ARRAY_SIZE(datetime_str
), datetime_fmtW
, date_str
, time_str
);
574 hr
= add_bstr_property(node
, szTimeEnglish
, datetime_str
);
581 static HRESULT
fill_os_string_information(IDxDiagContainerImpl_Container
*node
, OSVERSIONINFOW
*info
)
583 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};
584 static const WCHAR szOSLocalized
[] = {'s','z','O','S','L','o','c','a','l','i','z','e','d',0};
585 static const WCHAR szOSExLocalized
[] = {'s','z','O','S','E','x','L','o','c','a','l','i','z','e','d',0};
586 static const WCHAR szOSExLongLocalized
[] = {'s','z','O','S','E','x','L','o','n','g','L','o','c','a','l','i','z','e','d',0};
587 static const WCHAR szOSEnglish
[] = {'s','z','O','S','E','n','g','l','i','s','h',0};
588 static const WCHAR szOSExEnglish
[] = {'s','z','O','S','E','x','E','n','g','l','i','s','h',0};
589 static const WCHAR szOSExLongEnglish
[] = {'s','z','O','S','E','x','L','o','n','g','E','n','g','l','i','s','h',0};
591 static const WCHAR
*prop_list
[] = {szOSLocalized
, szOSExLocalized
, szOSExLongLocalized
,
592 szOSEnglish
, szOSExEnglish
, szOSExLongEnglish
};
597 /* FIXME: OS detection should be performed, and localized OS strings
598 * should contain translated versions of the "build" phrase. */
599 for (i
= 0; i
< ARRAY_SIZE(prop_list
); i
++)
601 hr
= add_bstr_property(node
, prop_list
[i
], winxpW
);
609 static HRESULT
fill_processor_information(IDxDiagContainerImpl_Container
*node
)
611 static const WCHAR szProcessorEnglish
[] = {'s','z','P','r','o','c','e','s','s','o','r','E','n','g','l','i','s','h',0};
613 static const WCHAR cimv2W
[] = {'\\','\\','.','\\','r','o','o','t','\\','c','i','m','v','2',0};
614 static const WCHAR proc_classW
[] = {'W','i','n','3','2','_','P','r','o','c','e','s','s','o','r',0};
615 static const WCHAR nameW
[] = {'N','a','m','e',0};
616 static const WCHAR max_clock_speedW
[] = {'M','a','x','C','l','o','c','k','S','p','e','e','d',0};
617 static const WCHAR cpu_noW
[] = {'N','u','m','b','e','r','O','f','L','o','g','i','c','a','l','P','r','o','c','e','s','s','o','r','s',0};
619 static const WCHAR processor_fmtW
[] = {'%','s','(','%','d',' ','C','P','U','s',')',',',' ','~','%','d','M','H','z',0};
621 IWbemLocator
*wbem_locator
;
622 IWbemServices
*wbem_service
;
623 IWbemClassObject
*wbem_class
;
624 IEnumWbemClassObject
*wbem_enum
;
625 VARIANT cpu_name
, cpu_no
, clock_speed
;
626 WCHAR print_buf
[200];
631 hr
= CoCreateInstance(&CLSID_WbemLocator
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IWbemLocator
, (void**)&wbem_locator
);
635 bstr
= SysAllocString(cimv2W
);
637 IWbemLocator_Release(wbem_locator
);
638 return E_OUTOFMEMORY
;
640 hr
= IWbemLocator_ConnectServer(wbem_locator
, bstr
, NULL
, NULL
, NULL
, 0, NULL
, NULL
, &wbem_service
);
641 IWbemLocator_Release(wbem_locator
);
646 bstr
= SysAllocString(proc_classW
);
648 IWbemServices_Release(wbem_service
);
649 return E_OUTOFMEMORY
;
651 hr
= IWbemServices_CreateInstanceEnum(wbem_service
, bstr
, WBEM_FLAG_SYSTEM_ONLY
, NULL
, &wbem_enum
);
652 IWbemServices_Release(wbem_service
);
657 hr
= IEnumWbemClassObject_Next(wbem_enum
, 1000, 1, &wbem_class
, &no
);
658 IEnumWbemClassObject_Release(wbem_enum
);
662 hr
= IWbemClassObject_Get(wbem_class
, cpu_noW
, 0, &cpu_no
, NULL
, NULL
);
664 IWbemClassObject_Release(wbem_class
);
667 hr
= IWbemClassObject_Get(wbem_class
, max_clock_speedW
, 0, &clock_speed
, NULL
, NULL
);
669 IWbemClassObject_Release(wbem_class
);
672 hr
= IWbemClassObject_Get(wbem_class
, nameW
, 0, &cpu_name
, NULL
, NULL
);
673 IWbemClassObject_Release(wbem_class
);
677 swprintf(print_buf
, ARRAY_SIZE(print_buf
), processor_fmtW
,
678 V_BSTR(&cpu_name
), V_I4(&cpu_no
), V_I4(&clock_speed
));
679 VariantClear(&cpu_name
);
680 VariantClear(&cpu_no
);
681 VariantClear(&clock_speed
);
683 return add_bstr_property(node
, szProcessorEnglish
, print_buf
);
686 static HRESULT
build_systeminfo_tree(IDxDiagContainerImpl_Container
*node
)
688 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};
689 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};
690 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};
691 static const WCHAR szDirectXVersionLetter_v
[] = {'c',0};
692 static const WCHAR bDebug
[] = {'b','D','e','b','u','g',0};
693 static const WCHAR bNECPC98
[] = {'b','N','E','C','P','C','9','8',0};
694 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};
695 static const WCHAR szDirectXVersionEnglish_v
[] = {'4','.','0','9','.','0','0','0','0','.','0','9','0','4',0};
696 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};
697 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};
698 static const WCHAR ullPhysicalMemory
[] = {'u','l','l','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
699 static const WCHAR ullUsedPageFile
[] = {'u','l','l','U','s','e','d','P','a','g','e','F','i','l','e',0};
700 static const WCHAR ullAvailPageFile
[] = {'u','l','l','A','v','a','i','l','P','a','g','e','F','i','l','e',0};
701 static const WCHAR bNetMeetingRunning
[] = {'b','N','e','t','M','e','e','t','i','n','g','R','u','n','n','i','n','g',0};
702 static const WCHAR szWindowsDir
[] = {'s','z','W','i','n','d','o','w','s','D','i','r',0};
703 static const WCHAR dwOSMajorVersion
[] = {'d','w','O','S','M','a','j','o','r','V','e','r','s','i','o','n',0};
704 static const WCHAR dwOSMinorVersion
[] = {'d','w','O','S','M','i','n','o','r','V','e','r','s','i','o','n',0};
705 static const WCHAR dwOSBuildNumber
[] = {'d','w','O','S','B','u','i','l','d','N','u','m','b','e','r',0};
706 static const WCHAR dwOSPlatformID
[] = {'d','w','O','S','P','l','a','t','f','o','r','m','I','D',0};
707 static const WCHAR szCSDVersion
[] = {'s','z','C','S','D','V','e','r','s','i','o','n',0};
708 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};
709 static const WCHAR szPageFileLocalized
[] = {'s','z','P','a','g','e','F','i','l','e','L','o','c','a','l','i','z','e','d',0};
710 static const WCHAR szPageFileEnglish
[] = {'s','z','P','a','g','e','F','i','l','e','E','n','g','l','i','s','h',0};
711 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};
712 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};
713 static const WCHAR szSystemManufacturerEnglish
[] = {'s','z','S','y','s','t','e','m','M','a','n','u','f','a','c','t','u','r','e','r','E','n','g','l','i','s','h',0};
714 static const WCHAR szSystemModelEnglish
[] = {'s','z','S','y','s','t','e','m','M','o','d','e','l','E','n','g','l','i','s','h',0};
715 static const WCHAR szBIOSEnglish
[] = {'s','z','B','I','O','S','E','n','g','l','i','s','h',0};
716 static const WCHAR szSetupParamEnglish
[] = {'s','z','S','e','t','u','p','P','a','r','a','m','E','n','g','l','i','s','h',0};
717 static const WCHAR szDxDiagVersion
[] = {'s','z','D','x','D','i','a','g','V','e','r','s','i','o','n',0};
719 static const WCHAR notpresentW
[] = {'N','o','t',' ','p','r','e','s','e','n','t',0};
721 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};
722 static const WCHAR physmem_fmtW
[] = {'%','u','M','B',' ','R','A','M',0};
727 DWORD count
, usedpage_mb
, availpage_mb
;
728 WCHAR buffer
[MAX_PATH
], computer_name
[MAX_COMPUTERNAME_LENGTH
+ 1], print_buf
[200], localized_pagefile_fmt
[200];
731 hr
= add_ui4_property(node
, dwDirectXVersionMajor
, 9);
735 hr
= add_ui4_property(node
, dwDirectXVersionMinor
, 0);
739 hr
= add_bstr_property(node
, szDirectXVersionLetter
, szDirectXVersionLetter_v
);
743 hr
= add_bstr_property(node
, szDirectXVersionEnglish
, szDirectXVersionEnglish_v
);
747 hr
= add_bstr_property(node
, szDirectXVersionLongEnglish
, szDirectXVersionLongEnglish_v
);
751 hr
= add_bool_property(node
, bDebug
, FALSE
);
755 hr
= add_bool_property(node
, bNECPC98
, FALSE
);
759 msex
.dwLength
= sizeof(msex
);
760 GlobalMemoryStatusEx(&msex
);
762 hr
= add_ull_as_bstr_property(node
, ullPhysicalMemory
, msex
.ullTotalPhys
);
766 hr
= add_ull_as_bstr_property(node
, ullUsedPageFile
, msex
.ullTotalPageFile
- msex
.ullAvailPageFile
);
770 hr
= add_ull_as_bstr_property(node
, ullAvailPageFile
, msex
.ullAvailPageFile
);
774 hr
= add_bool_property(node
, bNetMeetingRunning
, is_netmeeting_running());
778 info
.dwOSVersionInfoSize
= sizeof(info
);
779 GetVersionExW(&info
);
781 hr
= add_ui4_property(node
, dwOSMajorVersion
, info
.dwMajorVersion
);
785 hr
= add_ui4_property(node
, dwOSMinorVersion
, info
.dwMinorVersion
);
789 hr
= add_ui4_property(node
, dwOSBuildNumber
, info
.dwBuildNumber
);
793 hr
= add_ui4_property(node
, dwOSPlatformID
, info
.dwPlatformId
);
797 hr
= add_bstr_property(node
, szCSDVersion
, info
.szCSDVersion
);
801 /* FIXME: Roundoff should not be done with truncated division. */
802 swprintf(print_buf
, ARRAY_SIZE(print_buf
), physmem_fmtW
,
803 (DWORD
)(msex
.ullTotalPhys
/ (1024 * 1024)));
804 hr
= add_bstr_property(node
, szPhysicalMemoryEnglish
, print_buf
);
808 usedpage_mb
= (DWORD
)((msex
.ullTotalPageFile
- msex
.ullAvailPageFile
) / (1024 * 1024));
809 availpage_mb
= (DWORD
)(msex
.ullAvailPageFile
/ (1024 * 1024));
810 LoadStringW(dxdiagn_instance
, IDS_PAGE_FILE_FORMAT
, localized_pagefile_fmt
,
811 ARRAY_SIZE(localized_pagefile_fmt
));
812 args
[0] = usedpage_mb
;
813 args
[1] = availpage_mb
;
814 FormatMessageW(FORMAT_MESSAGE_FROM_STRING
|FORMAT_MESSAGE_ARGUMENT_ARRAY
, localized_pagefile_fmt
,
815 0, 0, print_buf
, ARRAY_SIZE(print_buf
), (__ms_va_list
*)args
);
817 hr
= add_bstr_property(node
, szPageFileLocalized
, print_buf
);
821 swprintf(print_buf
, ARRAY_SIZE(print_buf
), pagefile_fmtW
, usedpage_mb
, availpage_mb
);
823 hr
= add_bstr_property(node
, szPageFileEnglish
, print_buf
);
827 GetWindowsDirectoryW(buffer
, MAX_PATH
);
829 hr
= add_bstr_property(node
, szWindowsDir
, buffer
);
833 count
= ARRAY_SIZE(computer_name
);
834 if (!GetComputerNameW(computer_name
, &count
))
837 hr
= add_bstr_property(node
, szMachineNameLocalized
, computer_name
);
841 hr
= add_bstr_property(node
, szMachineNameEnglish
, computer_name
);
845 hr
= add_bstr_property(node
, szSystemManufacturerEnglish
, szEmpty
);
849 hr
= add_bstr_property(node
, szSystemModelEnglish
, szEmpty
);
853 hr
= add_bstr_property(node
, szBIOSEnglish
, szEmpty
);
857 hr
= fill_processor_information(node
);
861 hr
= add_bstr_property(node
, szSetupParamEnglish
, notpresentW
);
865 hr
= add_bstr_property(node
, szDxDiagVersion
, szEmpty
);
869 hr
= fill_language_information(node
);
873 hr
= fill_datetime_information(node
);
877 hr
= fill_os_string_information(node
, &info
);
884 /* The logic from pixelformat_for_depth() in dlls/wined3d/utils.c is reversed. */
885 static DWORD
depth_for_pixelformat(D3DFORMAT format
)
889 case D3DFMT_P8
: return 8;
890 case D3DFMT_X1R5G5B5
: return 15;
891 case D3DFMT_R5G6B5
: return 16;
892 /* This case will fail to distinguish an original bpp of 24. */
893 case D3DFMT_X8R8G8B8
: return 32;
895 FIXME("Unknown D3DFORMAT %d, returning 32 bpp\n", format
);
900 static BOOL
get_texture_memory(GUID
*adapter
, DWORD
*available_mem
)
902 IDirectDraw7
*pDirectDraw
;
906 hr
= DirectDrawCreateEx(adapter
, (void **)&pDirectDraw
, &IID_IDirectDraw7
, NULL
);
909 dd_caps
.dwCaps
= DDSCAPS_LOCALVIDMEM
| DDSCAPS_VIDEOMEMORY
;
910 dd_caps
.dwCaps2
= dd_caps
.dwCaps3
= dd_caps
.u1
.dwCaps4
= 0;
911 hr
= IDirectDraw7_GetAvailableVidMem(pDirectDraw
, &dd_caps
, available_mem
, NULL
);
912 IDirectDraw7_Release(pDirectDraw
);
920 static const WCHAR
*vendor_id_to_manufacturer_string(DWORD vendor_id
)
924 static const WCHAR atiW
[] = {'A','T','I',' ','T','e','c','h','n','o','l','o','g','i','e','s',' ','I','n','c','.',0};
925 static const WCHAR nvidiaW
[] = {'N','V','I','D','I','A',0};
926 static const WCHAR intelW
[] = {'I','n','t','e','l',' ','C','o','r','p','o','r','a','t','i','o','n',0};
927 static const WCHAR vmwareW
[] = {'V','M','w','a','r','e',0};
928 static const WCHAR redhatW
[] = {'R','e','d',' ','H','a','t',0};
929 static const WCHAR unknownW
[] = {'U','n','k','n','o','w','n',0};
944 for (i
= 0; i
< ARRAY_SIZE(vendors
); ++i
)
946 if (vendors
[i
].id
== vendor_id
)
947 return vendors
[i
].name
;
950 FIXME("Unknown PCI vendor ID 0x%04x.\n", vendor_id
);
955 static HRESULT
fill_display_information_d3d(IDxDiagContainerImpl_Container
*node
)
957 IDxDiagContainerImpl_Container
*display_adapter
;
959 IDirect3D9
*pDirect3D9
;
963 pDirect3D9
= Direct3DCreate9(D3D_SDK_VERSION
);
967 count
= IDirect3D9_GetAdapterCount(pDirect3D9
);
968 for (index
= 0; index
< count
; index
++)
970 static const WCHAR adapterid_fmtW
[] = {'%','u',0};
971 static const WCHAR driverversion_fmtW
[] = {'%','u','.','%','u','.','%','0','4','u','.','%','0','4','u',0};
972 static const WCHAR id_fmtW
[] = {'0','x','%','0','4','x',0};
973 static const WCHAR subsysid_fmtW
[] = {'0','x','%','0','8','x',0};
974 static const WCHAR mem_fmt
[] = {'%','.','1','f',' ','M','B',0};
975 static const WCHAR b3DAccelerationExists
[] = {'b','3','D','A','c','c','e','l','e','r','a','t','i','o','n','E','x','i','s','t','s',0};
976 static const WCHAR b3DAccelerationEnabled
[] = {'b','3','D','A','c','c','e','l','e','r','a','t','i','o','n','E','n','a','b','l','e','d',0};
977 static const WCHAR bDDAccelerationEnabled
[] = {'b','D','D','A','c','c','e','l','e','r','a','t','i','o','n','E','n','a','b','l','e','d',0};
978 static const WCHAR bNoHardware
[] = {'b','N','o','H','a','r','d','w','a','r','e',0};
979 static const WCHAR mode_fmtW
[] = {'%','d',' ','x',' ','%','d',' ','(','%','d',' ','b','i','t',')',' ','(','%','d','H','z',')',0};
980 static const WCHAR gernericPNPMonitorW
[] = {'G','e','n','e','r','i','c',' ','P','n','P',' ','M','o','n','i','t','o','r',0};
981 static const WCHAR failedToGetParameterW
[] = {'F','a','i','l','e','d',' ','t','o',' ','g','e','t',' ','p','a','r','a','m','e','t','e','r',0};
982 static const WCHAR driverAttributesW
[] = {'F','i','n','a','l',' ','R','e','t','a','i','l',0};
983 static const WCHAR englishW
[] = {'E','n','g','l','i','s','h',0};
984 static const WCHAR driverDateEnglishW
[] = {'1','/','1','/','2','0','1','6',' ','1','0',':','0','0',':','0','0',0};
985 static const WCHAR driverDateLocalW
[] = {'1','/','1','/','2','0','1','6',' ','1','0',':','0','0',':','0','0',' ','A','M',0};
986 static const WCHAR naW
[] = {'n','/','a',0};
987 static const WCHAR ddi11W
[] = {'1','1',0};
989 D3DADAPTER_IDENTIFIER9 adapter_info
;
990 D3DDISPLAYMODE adapter_mode
;
991 D3DCAPS9 device_caps
;
992 DWORD available_mem
= 0;
995 swprintf(buffer
, ARRAY_SIZE(buffer
), adapterid_fmtW
, index
);
996 display_adapter
= allocate_information_node(buffer
);
997 if (!display_adapter
)
1003 add_subcontainer(node
, display_adapter
);
1005 hr
= IDirect3D9_GetAdapterIdentifier(pDirect3D9
, index
, 0, &adapter_info
);
1008 WCHAR driverW
[sizeof(adapter_info
.Driver
)];
1009 WCHAR descriptionW
[sizeof(adapter_info
.Description
)];
1010 WCHAR devicenameW
[sizeof(adapter_info
.DeviceName
)];
1012 MultiByteToWideChar(CP_ACP
, 0, adapter_info
.Driver
, -1, driverW
, ARRAY_SIZE(driverW
));
1013 MultiByteToWideChar(CP_ACP
, 0, adapter_info
.Description
, -1, descriptionW
,
1014 ARRAY_SIZE(descriptionW
));
1015 MultiByteToWideChar(CP_ACP
, 0, adapter_info
.DeviceName
, -1, devicenameW
,
1016 ARRAY_SIZE(devicenameW
));
1018 hr
= add_bstr_property(display_adapter
, szDriverName
, driverW
);
1022 hr
= add_bstr_property(display_adapter
, szDescription
, descriptionW
);
1026 hr
= add_bstr_property(display_adapter
, szDeviceName
, devicenameW
);
1030 swprintf(buffer
, ARRAY_SIZE(buffer
), driverversion_fmtW
,
1031 HIWORD(adapter_info
.DriverVersion
.u
.HighPart
), LOWORD(adapter_info
.DriverVersion
.u
.HighPart
),
1032 HIWORD(adapter_info
.DriverVersion
.u
.LowPart
), LOWORD(adapter_info
.DriverVersion
.u
.LowPart
));
1034 hr
= add_bstr_property(display_adapter
, szDriverVersion
, buffer
);
1038 swprintf(buffer
, ARRAY_SIZE(buffer
), id_fmtW
, adapter_info
.VendorId
);
1039 hr
= add_bstr_property(display_adapter
, szVendorId
, buffer
);
1043 swprintf(buffer
, ARRAY_SIZE(buffer
), id_fmtW
, adapter_info
.DeviceId
);
1044 hr
= add_bstr_property(display_adapter
, szDeviceId
, buffer
);
1048 swprintf(buffer
, ARRAY_SIZE(buffer
), subsysid_fmtW
, adapter_info
.SubSysId
);
1049 hr
= add_bstr_property(display_adapter
, szSubSysId
, buffer
);
1053 swprintf(buffer
, ARRAY_SIZE(buffer
), id_fmtW
, adapter_info
.Revision
);
1054 hr
= add_bstr_property(display_adapter
, szRevisionId
, buffer
);
1058 StringFromGUID2(&adapter_info
.DeviceIdentifier
, buffer
, 39);
1059 hr
= add_bstr_property(display_adapter
, szDeviceIdentifier
, buffer
);
1063 hr
= add_bstr_property(display_adapter
, szManufacturer
, vendor_id_to_manufacturer_string(adapter_info
.VendorId
));
1068 hr
= IDirect3D9_GetAdapterDisplayMode(pDirect3D9
, index
, &adapter_mode
);
1071 hr
= add_ui4_property(display_adapter
, dwWidth
, adapter_mode
.Width
);
1075 hr
= add_ui4_property(display_adapter
, dwHeight
, adapter_mode
.Height
);
1079 hr
= add_ui4_property(display_adapter
, dwRefreshRate
, adapter_mode
.RefreshRate
);
1083 hr
= add_ui4_property(display_adapter
, dwBpp
, depth_for_pixelformat(adapter_mode
.Format
));
1087 swprintf(buffer
, ARRAY_SIZE(buffer
), mode_fmtW
, adapter_mode
.Width
, adapter_mode
.Height
,
1088 depth_for_pixelformat(adapter_mode
.Format
), adapter_mode
.RefreshRate
);
1090 hr
= add_bstr_property(display_adapter
, szDisplayModeLocalized
, buffer
);
1094 hr
= add_bstr_property(display_adapter
, szDisplayModeEnglish
, buffer
);
1099 hr
= add_bstr_property(display_adapter
, szKeyDeviceKey
, szEmpty
);
1103 hr
= add_bstr_property(display_adapter
, szKeyDeviceID
, szEmpty
);
1107 hr
= add_bstr_property(display_adapter
, szChipType
, szEmpty
);
1111 hr
= add_bstr_property(display_adapter
, szDACType
, szEmpty
);
1115 hr
= add_bstr_property(display_adapter
, szRevision
, szEmpty
);
1119 if (!get_texture_memory(&adapter_info
.DeviceIdentifier
, &available_mem
))
1120 WARN("get_texture_memory helper failed\n");
1122 swprintf(buffer
, ARRAY_SIZE(buffer
), mem_fmt
, available_mem
/ 1000000.0f
);
1124 hr
= add_bstr_property(display_adapter
, szDisplayMemoryLocalized
, buffer
);
1128 hr
= add_bstr_property(display_adapter
, szDisplayMemoryEnglish
, buffer
);
1132 hr
= IDirect3D9_GetDeviceCaps(pDirect3D9
, index
, D3DDEVTYPE_HAL
, &device_caps
);
1133 hardware_accel
= SUCCEEDED(hr
);
1135 hr
= add_bool_property(display_adapter
, b3DAccelerationEnabled
, hardware_accel
);
1139 hr
= add_bool_property(display_adapter
, b3DAccelerationExists
, hardware_accel
);
1143 hr
= add_bool_property(display_adapter
, bDDAccelerationEnabled
, hardware_accel
);
1147 hr
= add_bool_property(display_adapter
, bNoHardware
, FALSE
);
1151 hr
= add_bool_property(display_adapter
, bCanRenderWindow
, TRUE
);
1155 hr
= add_bstr_property(display_adapter
, szMonitorName
, gernericPNPMonitorW
);
1159 hr
= add_bstr_property(display_adapter
, szMonitorMaxRes
, failedToGetParameterW
);
1163 hr
= add_bstr_property(display_adapter
, szDriverAttributes
, driverAttributesW
);
1167 hr
= add_bstr_property(display_adapter
, szDriverLanguageEnglish
, englishW
);
1171 hr
= add_bstr_property(display_adapter
, szDriverLanguageLocalized
, englishW
);
1175 hr
= add_bstr_property(display_adapter
, szDriverDateEnglish
, driverDateEnglishW
);
1179 hr
= add_bstr_property(display_adapter
, szDriverDateLocalized
, driverDateLocalW
);
1183 hr
= add_i4_property(display_adapter
, lDriverSize
, 10 * 1024 * 1024);
1187 hr
= add_bstr_property(display_adapter
, szMiniVdd
, naW
);
1191 hr
= add_bstr_property(display_adapter
, szMiniVddDateLocalized
, naW
);
1195 hr
= add_bstr_property(display_adapter
, szMiniVddDateEnglish
, naW
);
1199 hr
= add_i4_property(display_adapter
, lMiniVddSize
, 0);
1203 hr
= add_bstr_property(display_adapter
, szVdd
, naW
);
1207 hr
= add_bool_property(display_adapter
, bDriverBeta
, FALSE
);
1211 hr
= add_bool_property(display_adapter
, bDriverDebug
, FALSE
);
1215 hr
= add_bool_property(display_adapter
, bDriverSigned
, TRUE
);
1219 hr
= add_bool_property(display_adapter
, bDriverSignedValid
, TRUE
);
1223 hr
= add_bstr_property(display_adapter
, szDriverSignDate
, naW
);
1227 hr
= add_ui4_property(display_adapter
, dwDDIVersion
, 11);
1231 hr
= add_bstr_property(display_adapter
, szDDIVersionEnglish
, ddi11W
);
1235 hr
= add_bstr_property(display_adapter
, szDDIVersionLocalized
, ddi11W
);
1239 hr
= add_ui4_property(display_adapter
, iAdapter
, index
);
1243 hr
= add_ui4_property(display_adapter
, dwWHQLLevel
, 0);
1250 IDirect3D9_Release(pDirect3D9
);
1254 static HRESULT
fill_display_information_fallback(IDxDiagContainerImpl_Container
*node
)
1256 static const WCHAR szAdapterID
[] = {'0',0};
1257 static const WCHAR
*empty_properties
[] = {szDeviceIdentifier
, szVendorId
, szDeviceId
,
1258 szKeyDeviceKey
, szKeyDeviceID
, szDriverName
,
1259 szDriverVersion
, szSubSysId
, szRevisionId
,
1260 szManufacturer
, szChipType
, szDACType
, szRevision
};
1262 IDxDiagContainerImpl_Container
*display_adapter
;
1264 IDirectDraw7
*pDirectDraw
;
1266 DISPLAY_DEVICEW disp_dev
;
1267 DDSURFACEDESC2 surface_descr
;
1271 display_adapter
= allocate_information_node(szAdapterID
);
1272 if (!display_adapter
)
1273 return E_OUTOFMEMORY
;
1275 add_subcontainer(node
, display_adapter
);
1277 disp_dev
.cb
= sizeof(disp_dev
);
1278 if (EnumDisplayDevicesW( NULL
, 0, &disp_dev
, 0 ))
1280 hr
= add_bstr_property(display_adapter
, szDeviceName
, disp_dev
.DeviceName
);
1284 hr
= add_bstr_property(display_adapter
, szDescription
, disp_dev
.DeviceString
);
1289 /* Silently ignore a failure from DirectDrawCreateEx. */
1290 hr
= DirectDrawCreateEx(NULL
, (void **)&pDirectDraw
, &IID_IDirectDraw7
, NULL
);
1294 dd_caps
.dwCaps
= DDSCAPS_LOCALVIDMEM
| DDSCAPS_VIDEOMEMORY
;
1295 dd_caps
.dwCaps2
= dd_caps
.dwCaps3
= dd_caps
.u1
.dwCaps4
= 0;
1296 hr
= IDirectDraw7_GetAvailableVidMem(pDirectDraw
, &dd_caps
, &tmp
, NULL
);
1299 static const WCHAR mem_fmt
[] = {'%','.','1','f',' ','M','B',0};
1301 swprintf(buffer
, ARRAY_SIZE(buffer
), mem_fmt
, tmp
/ 1000000.0f
);
1303 hr
= add_bstr_property(display_adapter
, szDisplayMemoryLocalized
, buffer
);
1307 hr
= add_bstr_property(display_adapter
, szDisplayMemoryEnglish
, buffer
);
1312 surface_descr
.dwSize
= sizeof(surface_descr
);
1313 hr
= IDirectDraw7_GetDisplayMode(pDirectDraw
, &surface_descr
);
1316 if (surface_descr
.dwFlags
& DDSD_WIDTH
)
1318 hr
= add_ui4_property(display_adapter
, dwWidth
, surface_descr
.dwWidth
);
1323 if (surface_descr
.dwFlags
& DDSD_HEIGHT
)
1325 hr
= add_ui4_property(display_adapter
, dwHeight
, surface_descr
.dwHeight
);
1330 if (surface_descr
.dwFlags
& DDSD_PIXELFORMAT
)
1332 hr
= add_ui4_property(display_adapter
, dwBpp
, surface_descr
.u4
.ddpfPixelFormat
.u1
.dwRGBBitCount
);
1338 hr
= add_ui4_property(display_adapter
, dwRefreshRate
, 60);
1342 for (tmp
= 0; tmp
< ARRAY_SIZE(empty_properties
); tmp
++)
1344 hr
= add_bstr_property(display_adapter
, empty_properties
[tmp
], szEmpty
);
1351 IDirectDraw7_Release(pDirectDraw
);
1355 static HRESULT
build_displaydevices_tree(IDxDiagContainerImpl_Container
*node
)
1359 /* Try to use Direct3D to obtain the required information first. */
1360 hr
= fill_display_information_d3d(node
);
1364 return fill_display_information_fallback(node
);
1367 static HRESULT
build_directsound_tree(IDxDiagContainerImpl_Container
*node
)
1369 static const WCHAR DxDiag_SoundDevices
[] = {'D','x','D','i','a','g','_','S','o','u','n','d','D','e','v','i','c','e','s',0};
1370 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};
1372 IDxDiagContainerImpl_Container
*cont
;
1374 cont
= allocate_information_node(DxDiag_SoundDevices
);
1376 return E_OUTOFMEMORY
;
1378 add_subcontainer(node
, cont
);
1380 cont
= allocate_information_node(DxDiag_SoundCaptureDevices
);
1382 return E_OUTOFMEMORY
;
1384 add_subcontainer(node
, cont
);
1389 static HRESULT
build_directmusic_tree(IDxDiagContainerImpl_Container
*node
)
1394 static HRESULT
build_directinput_tree(IDxDiagContainerImpl_Container
*node
)
1399 static HRESULT
build_directplay_tree(IDxDiagContainerImpl_Container
*node
)
1404 static HRESULT
build_systemdevices_tree(IDxDiagContainerImpl_Container
*node
)
1409 static HRESULT
fill_file_description(IDxDiagContainerImpl_Container
*node
, const WCHAR
*szFilePath
, const WCHAR
*szFileName
)
1411 static const WCHAR szSlashSep
[] = {'\\',0};
1412 static const WCHAR szPath
[] = {'s','z','P','a','t','h',0};
1413 static const WCHAR szName
[] = {'s','z','N','a','m','e',0};
1414 static const WCHAR szVersion
[] = {'s','z','V','e','r','s','i','o','n',0};
1415 static const WCHAR szAttributes
[] = {'s','z','A','t','t','r','i','b','u','t','e','s',0};
1416 static const WCHAR szLanguageEnglish
[] = {'s','z','L','a','n','g','u','a','g','e','E','n','g','l','i','s','h',0};
1417 static const WCHAR dwFileTimeHigh
[] = {'d','w','F','i','l','e','T','i','m','e','H','i','g','h',0};
1418 static const WCHAR dwFileTimeLow
[] = {'d','w','F','i','l','e','T','i','m','e','L','o','w',0};
1419 static const WCHAR bBeta
[] = {'b','B','e','t','a',0};
1420 static const WCHAR bDebug
[] = {'b','D','e','b','u','g',0};
1421 static const WCHAR bExists
[] = {'b','E','x','i','s','t','s',0};
1424 static const WCHAR szFinal_Retail_v
[] = {'F','i','n','a','l',' ','R','e','t','a','i','l',0};
1425 static const WCHAR szEnglish_v
[] = {'E','n','g','l','i','s','h',0};
1426 static const WCHAR szVersionFormat
[] = {'%','u','.','%','0','2','u','.','%','0','4','u','.','%','0','4','u',0};
1430 WCHAR szVersion_v
[1024];
1432 void *pVersionInfo
= NULL
;
1433 BOOL boolret
= FALSE
;
1435 VS_FIXEDFILEINFO
*pFileInfo
;
1437 TRACE("Filling container %p for %s in %s\n", node
,
1438 debugstr_w(szFileName
), debugstr_w(szFilePath
));
1440 szFile
= HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR
) * (lstrlenW(szFilePath
) +
1441 lstrlenW(szFileName
) + 2 /* slash + terminator */));
1443 return E_OUTOFMEMORY
;
1445 lstrcpyW(szFile
, szFilePath
);
1446 lstrcatW(szFile
, szSlashSep
);
1447 lstrcatW(szFile
, szFileName
);
1449 retval
= GetFileVersionInfoSizeW(szFile
, &hdl
);
1452 pVersionInfo
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, retval
);
1459 if (GetFileVersionInfoW(szFile
, 0, retval
, pVersionInfo
) &&
1460 VerQueryValueW(pVersionInfo
, szSlashSep
, (void **)&pFileInfo
, &uiLength
))
1464 hr
= add_bstr_property(node
, szPath
, szFile
);
1468 hr
= add_bstr_property(node
, szName
, szFileName
);
1472 hr
= add_bool_property(node
, bExists
, boolret
);
1478 swprintf(szVersion_v
, ARRAY_SIZE(szVersion_v
), szVersionFormat
,
1479 HIWORD(pFileInfo
->dwFileVersionMS
), LOWORD(pFileInfo
->dwFileVersionMS
),
1480 HIWORD(pFileInfo
->dwFileVersionLS
), LOWORD(pFileInfo
->dwFileVersionLS
));
1482 TRACE("Found version as (%s)\n", debugstr_w(szVersion_v
));
1484 hr
= add_bstr_property(node
, szVersion
, szVersion_v
);
1488 hr
= add_bstr_property(node
, szAttributes
, szFinal_Retail_v
);
1492 hr
= add_bstr_property(node
, szLanguageEnglish
, szEnglish_v
);
1496 hr
= add_ui4_property(node
, dwFileTimeHigh
, pFileInfo
->dwFileDateMS
);
1500 hr
= add_ui4_property(node
, dwFileTimeLow
, pFileInfo
->dwFileDateLS
);
1504 hr
= add_bool_property(node
, bBeta
, ((pFileInfo
->dwFileFlags
& pFileInfo
->dwFileFlagsMask
) & VS_FF_PRERELEASE
) != 0);
1508 hr
= add_bool_property(node
, bDebug
, ((pFileInfo
->dwFileFlags
& pFileInfo
->dwFileFlagsMask
) & VS_FF_DEBUG
) != 0);
1515 HeapFree(GetProcessHeap(), 0, pVersionInfo
);
1516 HeapFree(GetProcessHeap(), 0, szFile
);
1520 static HRESULT
build_directxfiles_tree(IDxDiagContainerImpl_Container
*node
)
1522 static const WCHAR dlls
[][15] =
1524 {'d','3','d','8','.','d','l','l',0},
1525 {'d','3','d','9','.','d','l','l',0},
1526 {'d','d','r','a','w','.','d','l','l',0},
1527 {'d','e','v','e','n','u','m','.','d','l','l',0},
1528 {'d','i','n','p','u','t','8','.','d','l','l',0},
1529 {'d','i','n','p','u','t','.','d','l','l',0},
1530 {'d','m','b','a','n','d','.','d','l','l',0},
1531 {'d','m','c','o','m','p','o','s','.','d','l','l',0},
1532 {'d','m','i','m','e','.','d','l','l',0},
1533 {'d','m','l','o','a','d','e','r','.','d','l','l',0},
1534 {'d','m','s','c','r','i','p','t','.','d','l','l',0},
1535 {'d','m','s','t','y','l','e','.','d','l','l',0},
1536 {'d','m','s','y','n','t','h','.','d','l','l',0},
1537 {'d','m','u','s','i','c','.','d','l','l',0},
1538 {'d','p','l','a','y','x','.','d','l','l',0},
1539 {'d','p','n','e','t','.','d','l','l',0},
1540 {'d','s','o','u','n','d','.','d','l','l',0},
1541 {'d','s','w','a','v','e','.','d','l','l',0},
1542 {'d','x','d','i','a','g','n','.','d','l','l',0},
1543 {'q','u','a','r','t','z','.','d','l','l',0}
1547 WCHAR szFilePath
[MAX_PATH
];
1550 GetSystemDirectoryW(szFilePath
, MAX_PATH
);
1552 for (i
= 0; i
< ARRAY_SIZE(dlls
); i
++)
1554 static const WCHAR szFormat
[] = {'%','d',0};
1557 IDxDiagContainerImpl_Container
*file_container
;
1559 swprintf(szFileID
, ARRAY_SIZE(szFileID
), szFormat
, i
);
1561 file_container
= allocate_information_node(szFileID
);
1562 if (!file_container
)
1563 return E_OUTOFMEMORY
;
1565 hr
= fill_file_description(file_container
, szFilePath
, dlls
[i
]);
1568 free_information_tree(file_container
);
1572 add_subcontainer(node
, file_container
);
1578 static HRESULT
read_property_names(IPropertyBag
*pPropBag
, VARIANT
*friendly_name
, VARIANT
*clsid_name
)
1580 static const WCHAR wszFriendlyName
[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
1581 static const WCHAR wszClsidName
[] = {'C','L','S','I','D',0};
1585 VariantInit(friendly_name
);
1586 VariantInit(clsid_name
);
1588 hr
= IPropertyBag_Read(pPropBag
, wszFriendlyName
, friendly_name
, 0);
1592 hr
= IPropertyBag_Read(pPropBag
, wszClsidName
, clsid_name
, 0);
1595 VariantClear(friendly_name
);
1602 static HRESULT
fill_filter_data_information(IDxDiagContainerImpl_Container
*subcont
, BYTE
*pData
, ULONG cb
)
1604 static const WCHAR szVersionW
[] = {'s','z','V','e','r','s','i','o','n',0};
1605 static const WCHAR dwInputs
[] = {'d','w','I','n','p','u','t','s',0};
1606 static const WCHAR dwOutputs
[] = {'d','w','O','u','t','p','u','t','s',0};
1607 static const WCHAR dwMeritW
[] = {'d','w','M','e','r','i','t',0};
1608 static const WCHAR szVersionFormat
[] = {'v','%','d',0};
1611 IFilterMapper2
*pFileMapper
= NULL
;
1612 IAMFilterData
*pFilterData
= NULL
;
1614 REGFILTER2
*pRF
= NULL
;
1617 DWORD dwNOutputs
= 0;
1618 DWORD dwNInputs
= 0;
1620 hr
= CoCreateInstance(&CLSID_FilterMapper2
, NULL
, CLSCTX_INPROC
, &IID_IFilterMapper2
,
1621 (void **)&pFileMapper
);
1625 hr
= IFilterMapper2_QueryInterface(pFileMapper
, &IID_IAMFilterData
, (void **)&pFilterData
);
1629 hr
= IAMFilterData_ParseFilterData(pFilterData
, pData
, cb
, &ppRF
);
1632 pRF
= ((REGFILTER2
**)ppRF
)[0];
1634 swprintf(bufferW
, ARRAY_SIZE(bufferW
), szVersionFormat
, pRF
->dwVersion
);
1635 hr
= add_bstr_property(subcont
, szVersionW
, bufferW
);
1639 if (pRF
->dwVersion
== 1)
1641 for (j
= 0; j
< pRF
->u
.s1
.cPins
; j
++)
1642 if (pRF
->u
.s1
.rgPins
[j
].bOutput
)
1647 else if (pRF
->dwVersion
== 2)
1649 for (j
= 0; j
< pRF
->u
.s2
.cPins2
; j
++)
1650 if (pRF
->u
.s2
.rgPins2
[j
].dwFlags
& REG_PINFLAG_B_OUTPUT
)
1656 hr
= add_ui4_property(subcont
, dwInputs
, dwNInputs
);
1660 hr
= add_ui4_property(subcont
, dwOutputs
, dwNOutputs
);
1664 hr
= add_ui4_property(subcont
, dwMeritW
, pRF
->dwMerit
);
1671 if (pFilterData
) IAMFilterData_Release(pFilterData
);
1672 if (pFileMapper
) IFilterMapper2_Release(pFileMapper
);
1677 static HRESULT
fill_filter_container(IDxDiagContainerImpl_Container
*subcont
, IMoniker
*pMoniker
)
1679 static const WCHAR szName
[] = {'s','z','N','a','m','e',0};
1680 static const WCHAR ClsidFilterW
[] = {'C','l','s','i','d','F','i','l','t','e','r',0};
1681 static const WCHAR wszFilterDataName
[] = {'F','i','l','t','e','r','D','a','t','a',0};
1684 IPropertyBag
*pPropFilterBag
= NULL
;
1686 VARIANT friendly_name
;
1690 VariantInit(&friendly_name
);
1691 VariantInit(&clsid_name
);
1694 hr
= IMoniker_BindToStorage(pMoniker
, NULL
, NULL
, &IID_IPropertyBag
, (void **)&pPropFilterBag
);
1698 hr
= read_property_names(pPropFilterBag
, &friendly_name
, &clsid_name
);
1702 TRACE("Name = %s\n", debugstr_w(V_BSTR(&friendly_name
)));
1703 TRACE("CLSID = %s\n", debugstr_w(V_BSTR(&clsid_name
)));
1705 hr
= add_bstr_property(subcont
, szName
, V_BSTR(&friendly_name
));
1709 hr
= add_bstr_property(subcont
, ClsidFilterW
, V_BSTR(&clsid_name
));
1713 hr
= IPropertyBag_Read(pPropFilterBag
, wszFilterDataName
, &v
, NULL
);
1717 hr
= SafeArrayAccessData(V_ARRAY(&v
), (void **)&pData
);
1721 hr
= fill_filter_data_information(subcont
, pData
, V_ARRAY(&v
)->rgsabound
->cElements
);
1722 SafeArrayUnaccessData(V_ARRAY(&v
));
1729 VariantClear(&clsid_name
);
1730 VariantClear(&friendly_name
);
1731 if (pPropFilterBag
) IPropertyBag_Release(pPropFilterBag
);
1736 static HRESULT
build_directshowfilters_tree(IDxDiagContainerImpl_Container
*node
)
1738 static const WCHAR szCatName
[] = {'s','z','C','a','t','N','a','m','e',0};
1739 static const WCHAR ClsidCatW
[] = {'C','l','s','i','d','C','a','t',0};
1740 static const WCHAR szIdFormat
[] = {'%','d',0};
1744 ICreateDevEnum
*pCreateDevEnum
;
1745 IEnumMoniker
*pEmCat
= NULL
;
1746 IMoniker
*pMCat
= NULL
;
1747 IEnumMoniker
*pEnum
= NULL
;
1749 hr
= CoCreateInstance(&CLSID_SystemDeviceEnum
, NULL
, CLSCTX_INPROC_SERVER
,
1750 &IID_ICreateDevEnum
, (void **)&pCreateDevEnum
);
1754 hr
= ICreateDevEnum_CreateClassEnumerator(pCreateDevEnum
, &CLSID_ActiveMovieCategories
, &pEmCat
, 0);
1758 while (IEnumMoniker_Next(pEmCat
, 1, &pMCat
, NULL
) == S_OK
)
1762 IPropertyBag
*pPropBag
;
1764 IMoniker
*pMoniker
= NULL
;
1766 hr
= IMoniker_BindToStorage(pMCat
, NULL
, NULL
, &IID_IPropertyBag
, (void **)&pPropBag
);
1769 IMoniker_Release(pMCat
);
1773 hr
= read_property_names(pPropBag
, &vCatName
, &vCatClsid
);
1774 IPropertyBag_Release(pPropBag
);
1777 IMoniker_Release(pMCat
);
1781 hr
= CLSIDFromString(V_BSTR(&vCatClsid
), &clsidCat
);
1784 IMoniker_Release(pMCat
);
1785 VariantClear(&vCatClsid
);
1786 VariantClear(&vCatName
);
1790 hr
= ICreateDevEnum_CreateClassEnumerator(pCreateDevEnum
, &clsidCat
, &pEnum
, 0);
1793 IMoniker_Release(pMCat
);
1794 VariantClear(&vCatClsid
);
1795 VariantClear(&vCatName
);
1799 TRACE("Enumerating class %s\n", debugstr_guid(&clsidCat
));
1801 while (IEnumMoniker_Next(pEnum
, 1, &pMoniker
, NULL
) == S_OK
)
1804 IDxDiagContainerImpl_Container
*subcont
;
1806 swprintf(bufferW
, ARRAY_SIZE(bufferW
), szIdFormat
, i
);
1807 subcont
= allocate_information_node(bufferW
);
1811 IMoniker_Release(pMoniker
);
1815 hr
= add_bstr_property(subcont
, szCatName
, V_BSTR(&vCatName
));
1818 free_information_tree(subcont
);
1819 IMoniker_Release(pMoniker
);
1823 hr
= add_bstr_property(subcont
, ClsidCatW
, V_BSTR(&vCatClsid
));
1826 free_information_tree(subcont
);
1827 IMoniker_Release(pMoniker
);
1831 hr
= fill_filter_container(subcont
, pMoniker
);
1832 IMoniker_Release(pMoniker
);
1835 WARN("Skipping invalid filter\n");
1836 free_information_tree(subcont
);
1841 add_subcontainer(node
, subcont
);
1845 IEnumMoniker_Release(pEnum
);
1846 IMoniker_Release(pMCat
);
1847 VariantClear(&vCatClsid
);
1848 VariantClear(&vCatName
);
1855 if (pEmCat
) IEnumMoniker_Release(pEmCat
);
1856 ICreateDevEnum_Release(pCreateDevEnum
);
1860 static HRESULT
build_logicaldisks_tree(IDxDiagContainerImpl_Container
*node
)
1865 static HRESULT
build_information_tree(IDxDiagContainerImpl_Container
**pinfo_root
)
1867 static const WCHAR DxDiag_SystemInfo
[] = {'D','x','D','i','a','g','_','S','y','s','t','e','m','I','n','f','o',0};
1868 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};
1869 static const WCHAR DxDiag_DirectSound
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','S','o','u','n','d',0};
1870 static const WCHAR DxDiag_DirectMusic
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','M','u','s','i','c',0};
1871 static const WCHAR DxDiag_DirectInput
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','I','n','p','u','t',0};
1872 static const WCHAR DxDiag_DirectPlay
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','P','l','a','y',0};
1873 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};
1874 static const WCHAR DxDiag_DirectXFiles
[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','X','F','i','l','e','s',0};
1875 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};
1876 static const WCHAR DxDiag_LogicalDisks
[] = {'D','x','D','i','a','g','_','L','o','g','i','c','a','l','D','i','s','k','s',0};
1881 HRESULT (*initfunc
)(IDxDiagContainerImpl_Container
*);
1884 {DxDiag_SystemInfo
, build_systeminfo_tree
},
1885 {DxDiag_DisplayDevices
, build_displaydevices_tree
},
1886 {DxDiag_DirectSound
, build_directsound_tree
},
1887 {DxDiag_DirectMusic
, build_directmusic_tree
},
1888 {DxDiag_DirectInput
, build_directinput_tree
},
1889 {DxDiag_DirectPlay
, build_directplay_tree
},
1890 {DxDiag_SystemDevices
, build_systemdevices_tree
},
1891 {DxDiag_DirectXFiles
, build_directxfiles_tree
},
1892 {DxDiag_DirectShowFilters
, build_directshowfilters_tree
},
1893 {DxDiag_LogicalDisks
, build_logicaldisks_tree
},
1896 IDxDiagContainerImpl_Container
*info_root
;
1899 info_root
= allocate_information_node(NULL
);
1901 return E_OUTOFMEMORY
;
1903 for (index
= 0; index
< ARRAY_SIZE(root_children
); index
++)
1905 IDxDiagContainerImpl_Container
*node
;
1908 node
= allocate_information_node(root_children
[index
].name
);
1911 free_information_tree(info_root
);
1912 return E_OUTOFMEMORY
;
1915 hr
= root_children
[index
].initfunc(node
);
1918 free_information_tree(node
);
1919 free_information_tree(info_root
);
1923 add_subcontainer(info_root
, node
);
1926 *pinfo_root
= info_root
;