dxdiagn: Initialize ProcessorEnglish property.
This commit is contained in:
parent
1711b99e98
commit
2bfbac07a8
|
@ -38,6 +38,7 @@
|
|||
#include "initguid.h"
|
||||
#include "fil_data.h"
|
||||
#include "psapi.h"
|
||||
#include "wbemcli.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
|
@ -554,6 +555,82 @@ static HRESULT fill_os_string_information(IDxDiagContainerImpl_Container *node,
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT fill_processor_information(IDxDiagContainerImpl_Container *node)
|
||||
{
|
||||
static const WCHAR szProcessorEnglish[] = {'s','z','P','r','o','c','e','s','s','o','r','E','n','g','l','i','s','h',0};
|
||||
|
||||
static const WCHAR cimv2W[] = {'\\','\\','.','\\','r','o','o','t','\\','c','i','m','v','2',0};
|
||||
static const WCHAR proc_classW[] = {'W','i','n','3','2','_','P','r','o','c','e','s','s','o','r',0};
|
||||
static const WCHAR nameW[] = {'N','a','m','e',0};
|
||||
static const WCHAR max_clock_speedW[] = {'M','a','x','C','l','o','c','k','S','p','e','e','d',0};
|
||||
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};
|
||||
|
||||
static const WCHAR processor_fmtW[] = {'%','s','(','%','d',' ','C','P','U','s',')',',',' ','~','%','d','M','H','z',0};
|
||||
|
||||
IWbemLocator *wbem_locator;
|
||||
IWbemServices *wbem_service;
|
||||
IWbemClassObject *wbem_class;
|
||||
IEnumWbemClassObject *wbem_enum;
|
||||
VARIANT cpu_name, cpu_no, clock_speed;
|
||||
WCHAR print_buf[200];
|
||||
BSTR bstr;
|
||||
ULONG no;
|
||||
HRESULT hr;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, &IID_IWbemLocator, (void**)&wbem_locator);
|
||||
if(FAILED(hr))
|
||||
return hr;
|
||||
|
||||
bstr = SysAllocString(cimv2W);
|
||||
if(!bstr) {
|
||||
IWbemLocator_Release(wbem_locator);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
hr = IWbemLocator_ConnectServer(wbem_locator, bstr, NULL, NULL, NULL, 0, NULL, NULL, &wbem_service);
|
||||
IWbemLocator_Release(wbem_locator);
|
||||
SysFreeString(bstr);
|
||||
if(FAILED(hr))
|
||||
return hr;
|
||||
|
||||
bstr = SysAllocString(proc_classW);
|
||||
if(!bstr) {
|
||||
IWbemServices_Release(wbem_service);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
hr = IWbemServices_CreateInstanceEnum(wbem_service, bstr, WBEM_FLAG_SYSTEM_ONLY, NULL, &wbem_enum);
|
||||
IWbemServices_Release(wbem_service);
|
||||
SysFreeString(bstr);
|
||||
if(FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = IEnumWbemClassObject_Next(wbem_enum, 1000, 1, &wbem_class, &no);
|
||||
IEnumWbemClassObject_Release(wbem_enum);
|
||||
if(FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = IWbemClassObject_Get(wbem_class, cpu_noW, 0, &cpu_no, NULL, NULL);
|
||||
if(FAILED(hr)) {
|
||||
IWbemClassObject_Release(wbem_class);
|
||||
return hr;
|
||||
}
|
||||
hr = IWbemClassObject_Get(wbem_class, max_clock_speedW, 0, &clock_speed, NULL, NULL);
|
||||
if(FAILED(hr)) {
|
||||
IWbemClassObject_Release(wbem_class);
|
||||
return hr;
|
||||
}
|
||||
hr = IWbemClassObject_Get(wbem_class, nameW, 0, &cpu_name, NULL, NULL);
|
||||
IWbemClassObject_Release(wbem_class);
|
||||
if(FAILED(hr))
|
||||
return hr;
|
||||
|
||||
sprintfW(print_buf, processor_fmtW, V_BSTR(&cpu_name), V_I4(&cpu_no), V_I4(&clock_speed));
|
||||
VariantClear(&cpu_name);
|
||||
VariantClear(&cpu_no);
|
||||
VariantClear(&clock_speed);
|
||||
|
||||
return add_bstr_property(node, szProcessorEnglish, print_buf);
|
||||
}
|
||||
|
||||
static HRESULT build_systeminfo_tree(IDxDiagContainerImpl_Container *node)
|
||||
{
|
||||
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};
|
||||
|
@ -584,7 +661,6 @@ static HRESULT build_systeminfo_tree(IDxDiagContainerImpl_Container *node)
|
|||
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};
|
||||
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};
|
||||
static const WCHAR szBIOSEnglish[] = {'s','z','B','I','O','S','E','n','g','l','i','s','h',0};
|
||||
static const WCHAR szProcessorEnglish[] = {'s','z','P','r','o','c','e','s','s','o','r','E','n','g','l','i','s','h',0};
|
||||
static const WCHAR szSetupParamEnglish[] = {'s','z','S','e','t','u','p','P','a','r','a','m','E','n','g','l','i','s','h',0};
|
||||
static const WCHAR szDxDiagVersion[] = {'s','z','D','x','D','i','a','g','V','e','r','s','i','o','n',0};
|
||||
|
||||
|
@ -725,7 +801,7 @@ static HRESULT build_systeminfo_tree(IDxDiagContainerImpl_Container *node)
|
|||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = add_bstr_property(node, szProcessorEnglish, szEmpty);
|
||||
hr = fill_processor_information(node);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
|
|
|
@ -856,6 +856,7 @@ static void test_DxDiag_SystemInfo(void)
|
|||
static const WCHAR szOSEnglish[] = {'s','z','O','S','E','n','g','l','i','s','h',0};
|
||||
static const WCHAR szOSExEnglish[] = {'s','z','O','S','E','x','E','n','g','l','i','s','h',0};
|
||||
static const WCHAR szOSExLongEnglish[] = {'s','z','O','S','E','x','L','o','n','g','E','n','g','l','i','s','h',0};
|
||||
static const WCHAR szProcessorEnglish[] = {'s','z','P','r','o','c','e','s','s','o','r','E','n','g','l','i','s','h',0};
|
||||
|
||||
static const struct property_test property_tests[] =
|
||||
{
|
||||
|
@ -891,6 +892,7 @@ static void test_DxDiag_SystemInfo(void)
|
|||
{szOSEnglish, VT_BSTR},
|
||||
{szOSExEnglish, VT_BSTR},
|
||||
{szOSExLongEnglish, VT_BSTR},
|
||||
{szProcessorEnglish, VT_BSTR},
|
||||
};
|
||||
|
||||
IDxDiagContainer *container;
|
||||
|
|
Loading…
Reference in New Issue