⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 instance_x86processor.cpp

📁 270的linux说明
💻 CPP
📖 第 1 页 / 共 2 页
字号:
void ProcessorCoreCountClass::GetValueImpl(){	try {		DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;		if (pThis->__cpuInfo.bIsInitialized)		{			this->SetValueImpl( pThis->__cpuInfo.htInfo.nCoresAvailable );		}		else		{			this->SetNull( true );		}	}	catch(...) 	{		SetNull( true );		THROWIMEXCEPTION("8004340A");	}}void ProcessorIdClass::GetValueImpl(){	//BSTR value = NULL;  	DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;	if (pThis->__dwAffinityMask)	{		IntelMobileChar strID[256];		//_itow((int)pThis->__dwAffinityMask, strID, 10);#ifdef _UNICODE		swprintf(strID, 256, IntelMobileText("%d"), pThis->__dwAffinityMask);#else		snprintf(strID, 256, IntelMobileText("%d"), pThis->__dwAffinityMask);#endif		this->SetValueImpl( static_cast<IntelMobileChar*>( strID ) );	}	else {		//raise error //TODO		this->SetNull( true );	}}void ProcessorX86ProcessorFamilyClass::GetValueImpl(){	try {		DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;		if (pThis->__cpuInfo.bIsInitialized)		{			this->SetValueImpl( pThis->__cpuInfo.coreInfo.dwCPUFamily );		}		else		{			this->SetNull( true );		}	}	catch(...) 	{		SetNull( true );		THROWIMEXCEPTION("8004341A");	}}void ProcessorX86ProcessorModelClass::GetValueImpl(){	try {		DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;		if (pThis->__cpuInfo.bIsInitialized)		{			this->SetValueImpl( pThis->__cpuInfo.coreInfo.dwCPUModel );		}		else		{			this->SetNull( true );		}	}	catch(...) 	{		SetNull( true );		THROWIMEXCEPTION("8004341B");	}}void ProcessorX86ProcessorSteppingClass::GetValueImpl(){	try {		DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;		if (pThis->__cpuInfo.bIsInitialized)		{			this->SetValueImpl( pThis->__cpuInfo.coreInfo.dwCPUStepping );		}		else		{			this->SetNull( true );		}	}	catch(...) 	{		SetNull( true );		THROWIMEXCEPTION("8004341C");	}}void ProcessorX86ProcessorHtStateClass::GetValueImpl(){	try {					DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;		if (pThis->__cpuInfo.bIsInitialized)		{			if (pThis->__cpuInfo.htInfo.htResultCode == 1)				this->SetValueImpl( ProcessorHtStateEnum::NotPresent);			else if (pThis->__cpuInfo.htInfo.htResultCode == 2)					this->SetValueImpl( ProcessorHtStateEnum::DisabledByHardware);			else if (pThis->__cpuInfo.htInfo.htResultCode == 3)					this->SetValueImpl( ProcessorHtStateEnum::DisabledBySoftware);			else if (pThis->__cpuInfo.htInfo.htResultCode == 4)					this->SetValueImpl( ProcessorHtStateEnum::Enabled);		}		else {			this->SetNull( true );		}	}	catch(...) {		THROWIMEXCEPTION("80043408");	}}void ProcessorX86ProcessorFeaturesClass::GetValueImpl(){	const DWORD EIST_BIT = 0x80;	const VT_BIT = 0x20;	try { 		DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;		if (pThis->__cpuInfo.bIsInitialized)		{			this->Clear();			int i=0;			if ( pThis->__cpuInfo.bCPUID_Supported == 1 )				this->InsertValueImpl( ProcessorX86FeatureEnum::Cpuid );			if ( pThis->__cpuInfo.bDAZ_Supported == 1 )				this->InsertValueImpl( ProcessorX86FeatureEnum::Daz );			if ( pThis->__cpuInfo.bRDTSC_Supported == 1 )				this->InsertValueImpl( ProcessorX86FeatureEnum::Rdtsc );			if ( pThis->__cpuInfo.bCMOV_Supported == 1 )				this->InsertValueImpl( ProcessorX86FeatureEnum::Cmov );			if ( pThis->__cpuInfo.bMMX_Supported == 1 )				this->InsertValueImpl( ProcessorX86FeatureEnum::Mmx );			if ( pThis->__cpuInfo.bSSE_Supported == 1  )				this->InsertValueImpl( ProcessorX86FeatureEnum::Sse );			if ( pThis->__cpuInfo.bSSE2_Supported == 1  )				this->InsertValueImpl( ProcessorX86FeatureEnum::Sse2 );			if ( pThis->__cpuInfo.bPNI_Supported == 1  )				this->InsertValueImpl( ProcessorX86FeatureEnum::Sse3 );			if ( pThis->__cpuInfo.bHT_Supported == 1 )				this->InsertValueImpl( ProcessorX86FeatureEnum::HyperThreading );			if ( ( pThis->__cpuInfo.coreInfo.dwCPUPscNewECX & EIST_BIT ) != 0 )				this->InsertValueImpl( ProcessorX86FeatureEnum::Eist );			if ( pThis->__cpuInfo.bEM64T_Supported == 1 )				this->InsertValueImpl( ProcessorX86FeatureEnum::Em64t );			//if ( pThis->__cpuInfo.bXD_Supported == 1 )			//	this->InsertValueImpl( ProcessorX86FeatureEnum::Xd );			//if (	IsVTSupportedMSR() == true 			//	||	( pThis->__cpuInfo.coreInfo.dwCPUPscNewECX & VT_BIT ) != 0 )			//	this->InsertValueImpl( ProcessorX86FeatureEnum::Virtualization );		}		else		{			this->SetNull( true );		}	}	catch(...) 	{		SetNull( true );		THROWIMEXCEPTION("8004341E");	}}/********************** * MOVE FROM HERE TO LIGICAL OR CORE CLSSS *//==============================================================================//// These all return the true value.  If there is an error, throw // an appropriate HRESULT.  These need to return the true value// because the override the virtual GetValue() function in the // Property base class.void ProcessorCurrentFrequencyClass::GetValueImpl(){	try	{		Lock();		// Need implement.				// Class to store CPUID information		CPUINFO_T WinCPUID_Info = CPUINFO_T_INIT_VAL;		WinCPUID_Info.pCacheInfo = new CACHEINFO_T[NCACHETYPES];                if(WinCPUID_Info.pCacheInfo)                        ZeroMemory(WinCPUID_Info.pCacheInfo,sizeof(CACHEINFO_T)*NCACHETYPES);                WinCPUID_Info.pProcString = new char [PROCSTRING_BYTES];		// Calculates frequency and general CPU info		LinCPUID_Init(1000, &WinCPUID_Info);		if (WinCPUID_Info.llCPUFreq == -1)		{			this->SetNull( true );		}		else		{			IntelMobileUInt freq = (IntelMobileUInt)(WinCPUID_Info.llCPUFreq/1000);			this->SetValueImpl( freq );		}						Unlock();	}	catch(...) {		Unlock();		THROWIMEXCEPTION("80043004");	}	//formal implementation, which is not accurate.	//PROCESSOR_POWER_INFORMATION processorInfo;	//	//try {	//	if (ERROR_SUCCESS == CallNtPowerInformation (ProcessorInformation, NULL, 0, &processorInfo, sizeof(PROCESSOR_POWER_INFORMATION)))	//	{	//		this->SetValueImpl( processorInfo.CurrentMhz );	//	}	//	else	//	{	//		//raise error //TODO	//		this->SetNull( true );	//	}	//}	//catch(...) {	//	THROWIMEXCEPTION(80043004);	//}}void ProcessorMaxFrequencyClass::GetValueImpl(){	this->SetNull( true );	return;//SCR #728	try {		//Need Implement	}	catch(...)	{		THROWIMEXCEPTION("80043005");	}}void ProcessorNumberOfLogicalClass::GetValueImpl(){	DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;	if (pThis->__cpuInfo.bIsInitialized)	{		this->SetValueImpl( pThis->__cpuInfo.htInfo.nLogicalProcs );	}	else	{		//raise error //TODO		this->SetNull( true );	}}void ProcessorNumberOfPhysicalClass::GetValueImpl(){	DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;	if (pThis->__cpuInfo.bIsInitialized)	{		this->SetValueImpl( pThis->__cpuInfo.htInfo.nPhysicalProcs );	}	else	{		//raise error //TODO		this->SetNull( true );	}}void ProcessorLogicalPerPhysicalClass::GetValueImpl(){	DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;	if (pThis->__cpuInfo.bIsInitialized)	{		this->SetValueImpl( pThis->__cpuInfo.htInfo.nLogicalPerPackage );	}	else	{		//raise error //TODO		this->SetNull( true );	}}void ProcessorFrequencyThrottlingSupportedClass::GetValueImpl(){	this->SetNull( true );}void ProcessorThermalControlSupportedClass::GetValueImpl(){	this->SetNull( true );}void ProcessorCPUIDSupportedClass::GetValueImpl(){	DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;	if (pThis->__cpuInfo.bIsInitialized)	{		this->SetValueImpl( pThis->__cpuInfo.bCPUID_Supported == 1 );	}	else	{		//raise error //TODO		this->SetNull( true );	}}void ProcessorMMXSupportedClass::GetValueImpl(){	DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;	if (pThis->__cpuInfo.bIsInitialized)	{		this->SetValueImpl( pThis->__cpuInfo.bMMX_Supported == 1 );	}	else	{		//raise error //TODO		this->SetNull( true );	}}void ProcessorSSESupportedClass::GetValueImpl(){	DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;	if (pThis->__cpuInfo.bIsInitialized)	{		this->SetValueImpl( pThis->__cpuInfo.bSSE_Supported == 1 );	}	else	{		//raise error //TODO		this->SetNull( true );	}}void ProcessorSSE2SupportedClass::GetValueImpl(){	DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;	if (pThis->__cpuInfo.bIsInitialized)	{		this->SetValueImpl( pThis->__cpuInfo.bSSE2_Supported == 1 );	}	else	{		//raise error //TODO		this->SetNull( true );	}}void ProcessorSSE3SupportedClass::GetValueImpl(){	DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;	if (pThis->__cpuInfo.bIsInitialized)	{		this->SetValueImpl( pThis->__cpuInfo.bPNI_Supported == 1 );	}	else	{		//raise error //TODO		this->SetNull( true );	}}void ProcessorDAZSupportedClass::GetValueImpl(){	DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;	if (pThis->__cpuInfo.bIsInitialized)	{		this->SetValueImpl( pThis->__cpuInfo.bDAZ_Supported == 1 );	}	else	{		//raise error //TODO		this->SetNull( true );	}}void ProcessorRDTSCSupportedClass::GetValueImpl(){	DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;	if (pThis->__cpuInfo.bIsInitialized)	{		this->SetValueImpl( pThis->__cpuInfo.bRDTSC_Supported == 1 );	}	else	{		//raise error //TODO		this->SetNull( true );	}}void ProcessorCMOVSupportedClass::GetValueImpl(){	DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;	if (pThis->__cpuInfo.bIsInitialized)	{		this->SetValueImpl( pThis->__cpuInfo.bCMOV_Supported == 1 );	}	else	{		//raise error //TODO		this->SetNull( true );	}}void ProcessorTypeClass::GetValueImpl(){	try {		char type[256];		//BSTR value = NULL;  		IntelMobileChar value[256];		DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;		if (pThis->__cpuInfo.bIsInitialized)		{			LinCPUID_getTypeStr( type, sizeof(type), pThis->__cpuInfo.coreInfo.dwCPUType );			//value = _com_util::ConvertStringToBSTR( type );#ifdef _UNICODE			mbstowcs(value, type, 256);#else			strncpy(value, type, 256);#endif			this->SetValueImpl( static_cast<IntelMobileChar*>( value ) );			//::SysFreeString( value ); //Leak fixed.  		}		else {			//raise error //TODO			this->SetNull( true );		}	}	catch(...) {		THROWIMEXCEPTION("80043007");	}}void ProcessorFamilyClass::GetValueImpl(){	DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;	if (pThis->__cpuInfo.bIsInitialized)	{		this->SetValueImpl( pThis->__cpuInfo.coreInfo.dwCPUFamily );	}	else	{		//raise error //TODO		this->SetNull( true );	}}void ProcessorModelClass::GetValueImpl(){	DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;	if (pThis->__cpuInfo.bIsInitialized)	{		this->SetValueImpl( pThis->__cpuInfo.coreInfo.dwCPUModel );	}	else	{		//raise error //TODO		this->SetNull( true );	}}void ProcessorCacheLineFlushSizeClass::GetValueImpl(){	DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;	if (pThis->__cpuInfo.bIsInitialized)	{		this->SetValueImpl( pThis->__cpuInfo.coreInfo.dwCLFlushLineSize );	}	else	{		//raise error //TODO		this->SetNull( true );	}}void ProcessorHTSupportedClass::GetValueImpl(){	DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;	if (pThis->__cpuInfo.bIsInitialized)	{		this->SetValueImpl( pThis->__cpuInfo.bHT_Supported == 1 );	}	else	{		//raise error //TODO		this->SetNull( true );	}}void ProcessorHTStatusClass::GetValueImpl(){	try {					DefaultX86ProcessorInstanceObject* pThis = (DefaultX86ProcessorInstanceObject*) this->_pThis;		if (pThis->__cpuInfo.bIsInitialized)		{			if (pThis->__cpuInfo.htInfo.htResultCode == 1)					this->SetValueImpl( NotPresent);			else if (pThis->__cpuInfo.htInfo.htResultCode == 2)					this->SetValueImpl( DisabledByHardware);			else if (pThis->__cpuInfo.htInfo.htResultCode == 3)					this->SetValueImpl( DisabledBySoftware);			else if (pThis->__cpuInfo.htInfo.htResultCode == 4)					this->SetValueImpl( Enabled);		}		else {			//raise error //TODO			this->SetNull( true );		}	}	catch(...) {		THROWIMEXCEPTION("80043008");	}}void ProcessorDataWidthClass::GetValueImpl(){	this->SetNull( true );}void ProcessorCurrentVoltageClass::GetValueImpl(){	this->SetNull( true );}void ProcessorMaxVoltageClass::GetValueImpl(){	this->SetNull( true );}void ProcessorTemperatureClass::GetValueImpl(){//	THROWIMEXCEPTION(80043103);	this->SetNull( true );}*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -