BIOS情報の取得

解説


   WMIのWin32_BIOSを利用してBIOS情報を取得する。

   取得できる情報にはBIOSバージョンやPCI・CD BOOTなどのサポート状況もある。


情報取得例

BiosCharacteristics : ISA is supported
BiosCharacteristics : PCI is supported
BiosCharacteristics : PC Card (PCMCIA) is supported
BiosCharacteristics : Plug and Play is supported
BiosCharacteristics : APM is supported
BiosCharacteristics : BIOS is Upgradable (Flash)
BiosCharacteristics : BIOS shadowing is allowed
BiosCharacteristics : ACPI supported
BiosCharacteristics : USB Legacy is supported
BiosCharacteristics : AGP is supported
BiosCharacteristics : 1394 boot is supported
BiosCharacteristics : Smart Battery supported
BIOSVersion : 1481068
BIOSVersion : 1481756
BuildNumber : 
Caption : PhoenixBIOS 4.0 Release 6.0     
CodeSet : 
CurrentLanguage : 
Description : PhoenixBIOS 4.0 Release 6.0     
IdentificationCode : 
InstallableLanguages : 0
InstallDate : 0
LanguageEdition : 
Description : PhoenixBIOS 4.0 Release 6.0     
Manufacturer : Phoenix Technologies LTD
Name : PhoenixBIOS 4.0 Release 6.0     
OtherTargetOS : 
PrimaryBIOS : TRUE
ReleaseDate : 20000830000000.000000+000
SerialNumber : 28303700-1403050    
SMBIOSBIOSVersion : R0202A0
SMBIOSMajorVersion : 2
SMBIOSMinorVersion : 1
SMBIOSPresent : TRUE
SoftwareElementID : PhoenixBIOS 4.0 Release 6.0     
SoftwareElementState : Running
TargetOperatingSystem : 0
Status : OK
Version : SONY   - 20000830



#include 
#include 

#include "atlstr.h"
#include "ArrayEx.h"		//CArray互換クラス用ヘッダー

#pragma comment(lib, "Wbemuuid")

//CArrayExはMFCのCArray互換クラス。CAtlArrayなどでも代用可能。。。のはず
#define	CUINTArray	CArrayEx


//
//	WMIを利用したBIOS情報取得
//
//	Windows NT 4.0 SP4以降対応(Win9xは未対応)
//
//	stdafx.hなどで#define _WIN32_WINNT	0x0400が宣言されていないとエラーになる(0x0400以降の値ならOK)
//	GetBIOS関数実行前にCoInitialize(NULL)を実行しておかないとエラーになる
//
//
//使用例
//
//void	Test(void)
//{
//	::CoInitialize(NULL);
//
//	CWin32BIOS	cBios;
//
//	cBios.GetBIOS();
//	cBios.TRACE();
//
//	::CoUninitialize();
//}
//
class	CWin32BIOS
{
	bool	_bInit;
public:
	CWin32BIOS()
	{
		Clear();
	}

	CUINTArray	_anBiosCharacteristics;
	CUINTArray	_anBIOSVersion;
	CAtlString	_strBuildNumber;
	CAtlString	_strCaption;
	CAtlString	_strCodeSet;
	CAtlString	_strCurrentLanguage;
	CAtlString	_strDescription;
	CAtlString	_strIdentificationCode;
	UINT		_nInstallableLanguages;
	UINT		_nInstallDate;
	CAtlString	_strLanguageEdition;
	CUINTArray	_anListOfLanguages;
	CAtlString	_strManufacturer;
	CAtlString	_strName;
	CAtlString	_strOtherTargetOS;
	bool		_bPrimaryBIOS;
	CAtlString	_strReleaseDate;
	CAtlString	_strSerialNumber;
	CAtlString	_strSMBIOSBIOSVersion;
	UINT		_nSMBIOSMajorVersion;
	UINT		_nSMBIOSMinorVersion;
	bool		_bSMBIOSPresent;
	CAtlString	_strSoftwareElementID;
	UINT		_nSoftwareElementState;
	CAtlString	_strStatus;
	UINT		_nTargetOperatingSystem;
	CAtlString	_strVersion;

	void	Clear(void)
	{
		_bInit = false;

		_anBiosCharacteristics.RemoveAll();
		_anBIOSVersion.RemoveAll();
		_strBuildNumber			= _T("");
		_strCaption				= _T("");
		_strCodeSet				= _T("");
		_strCurrentLanguage		= _T("");
		_strDescription			= _T("");
		_strIdentificationCode	= _T("");
		_nInstallableLanguages	= 0;
		_nInstallDate			= 0;
		_strLanguageEdition		= _T("");
		_anListOfLanguages.RemoveAll();
		_strManufacturer		= _T("");
		_strName				= _T("");
		_strOtherTargetOS		= _T("");
		_bPrimaryBIOS			= false;
		_strReleaseDate			= _T("");
		_strSerialNumber		= _T("");
		_strSMBIOSBIOSVersion	= _T("");
		_nSMBIOSMajorVersion	= 0;
		_nSMBIOSMinorVersion	= 0;
		_bSMBIOSPresent			= false;
		_strSoftwareElementID	= _T("");
		_nSoftwareElementState	= 0;
		_strStatus				= _T("");
		_nTargetOperatingSystem	= 0;
		_strVersion				= _T("");
	}

	enum	BIOS_CHARACTERISTICS
	{
		BC_RESERVED0				= 0,		// Reserved 
		BC_RESERVED1				= 1,		//Reserved 
		BC_UNKNOWN					= 2,		//Unknown 
		BC_NOT_SUPPORT				= 3,		//BIOS Characteristics Not Supported 
		BC_SUPPORT_ISA				= 4,		//ISA is supported 
		BC_SUPPORT_MCA				= 5,		//MCA is supported 
		BC_SUPPORT_EISA				= 6,		//EISA is supported 
		BC_SUPPORT_PCI				= 7,		//PCI is supported 
		BC_SUPPORT_PCMCIA			= 8,		//PC Card (PCMCIA) is supported 
		BC_SUPPORT_PNP				= 9,		//Plug and Play is supported 
		BC_SUPPORT_APM				= 10,		//APM is supported 
		BC_SUPPORT_BIOS_UPGRADE		= 11,		//BIOS is Upgradable (Flash) 
		BC_SUPPORT_BIOS_SHADOWING	= 12,		//BIOS shadowing is allowed 
		BC_SUPPORT_VLVESA			= 13,		//VL-VESA is supported 
		BC_AVAIL_ESCD				= 14,		//ESCD support is available 
		BC_SUPPORT_CD_BOOT			= 15,		//Boot from CD is supported 
		BC_SUPPORT_BOOT_SELECT		= 16,		//Selectable Boot is supported 
		BC_BIOS_ROM_SOCKETED		= 17,		//BIOS ROM is socketed  
		BC_SUPPORT_PCMCIA_BOOT		= 18,		//Boot From PC Card (PCMCIA) is supported 
		BC_SUPPORT_FDD_EDD			= 19,		//EDD (Enhanced Disk Drive) Specification is supported 
		BC_SUPPORT_FDD_2HD_PC98		= 20,		//Int 13h - Japanese Floppy for NEC 9800 1.2mb (3.5, 1k Bytes/Sector, 360 RPM) is supported 
		BC_SUPPORT_FDD_2HD_TOSHIBA	= 21,		//Int 13h - Japanese Floppy for Toshiba 1.2mb (3.5, 360 RPM) is supported 
		BC_SUPPORT_FDD_2D			= 22,		//Int 13h - 5.25 / 360 KB Floppy Services are supported 
		BC_SUPPORT_FDD_2HD_5INCH	= 23,		//Int 13h - 5.25 /1.2MB Floppy Services are supported 
		BC_SUPPORT_FDD_2DD_3INCH	= 24,		//Int 13h - 3.5 / 720 KB Floppy Services are supported 
		BC_SUPPORT_FDD_2_88MB_3INCH	= 25,		//Int 13h - 3.5 / 2.88 MB Floppy Services are supported 
		BC_SUPPORT_PRINT_SCREEN		= 26,		//Int 5h, Print Screen Service is supported 
		BC_SUPPORT_8042_KEYBOARD	= 27,		//Int 9h, 8042 Keyboard services are supported 
		BC_SUPPORT_COM				= 28,		//Int 14h, Serial Services are supported 
		BC_SUPPORT_PRT				= 29,		//Int 17h, printer services are supported 
		BC_SUPPORT_CGA_MONO_VIDEO	= 30,		//Int 10h, CGA/Mono Video Services are supported 
		BC_NEC_PC98					= 31,		//NEC PC-98 
		BC_SUPPORT_ACPI				= 32,		//ACPI supported 
		BC_SUPPORT_USB_LEGACY		= 33,		//USB Legacy is supported 
		BC_SUPPORT_AGP				= 34,		//AGP is supported 
		BC_SUPPORT_I2O_BOOT			= 35,		//I2O boot is supported 
		BC_SUPPORT_LS120_BOOT		= 36,		//LS-120 boot is supported 
		BC_SUPPORT_ATAPI_ZIP_BOOT	= 37,		//ATAPI ZIP Drive boot is supported 
		BC_SUPPORT_1394_BOOT		= 38,		//1394 boot is supported 
		BC_SUPPORT_SMART_BATTERY	= 39		//Smart Battery supported 
	};


	enum	SOFTWARE_ELEMENT_STATE
	{
		SES_DEPLOYABLE	= 0,	//Deployable 
		SES_INSTALLABLE	= 1,	//Installable 
		SES_EXECUTABLE	= 2,	//Executable 
		SES_RUNNING		= 3,	//Running 
	};

	bool	GetDescriptionOfSoftwareElementState(UINT nType,CAtlString& strValue)
	{
		if(nType == SES_DEPLOYABLE)
			strValue = _T("Deployable");
		else if(nType == SES_INSTALLABLE)
			strValue = _T("Installable");
		else if(nType == SES_EXECUTABLE)
			strValue = _T("Executable");
		else if(nType == SES_RUNNING)
			strValue = _T("Running");
		else
		{
			//見つからなかった
			strValue = _T("");
			ATLASSERT(0);

			return	false;
		}

		return	true;
	}



	bool	GetDescriptionOfBiosCharacteristics(UINT nType,CAtlString& strValue)
	{
		if(nType == BC_RESERVED0)
			strValue = _T("Reserved");
		else if(nType == BC_RESERVED1)
			strValue = _T("Reserved");
		else if(nType == BC_UNKNOWN)
			strValue = _T("Unknown");
		else if(nType == BC_NOT_SUPPORT)
			strValue = _T("BIOS Characteristics Not Supported");
		else if(nType == BC_SUPPORT_ISA)
			strValue = _T("ISA is supported");
		else if(nType == BC_SUPPORT_MCA)
			strValue = _T("MCA is supported");
		else if(nType == BC_SUPPORT_EISA)
			strValue = _T("EISA is supported");
		else if(nType == BC_SUPPORT_PCI)
			strValue = _T("PCI is supported");
		else if(nType == BC_SUPPORT_PCMCIA)
			strValue = _T("PC Card (PCMCIA) is supported");
		else if(nType == BC_SUPPORT_PNP)
			strValue = _T("Plug and Play is supported");
		else if(nType == BC_SUPPORT_APM)
			strValue = _T("APM is supported");
		else if(nType == BC_SUPPORT_BIOS_UPGRADE)
			strValue = _T("BIOS is Upgradable (Flash)");
		else if(nType == BC_SUPPORT_BIOS_SHADOWING)
			strValue = _T("BIOS shadowing is allowed");
		else if(nType == BC_SUPPORT_VLVESA)
			strValue = _T("VL-VESA is supported");
		else if(nType == BC_AVAIL_ESCD)
			strValue = _T("ESCD support is available");
		else if(nType == BC_SUPPORT_CD_BOOT)
			strValue = _T("Boot from CD is supported");
		else if(nType == BC_SUPPORT_BOOT_SELECT)
			strValue = _T("Selectable Boot is supported");
		else if(nType == BC_BIOS_ROM_SOCKETED)
			strValue = _T("BIOS ROM is socketed ");
		else if(nType == BC_SUPPORT_PCMCIA_BOOT)
			strValue = _T("Boot From PC Card (PCMCIA) is supported");
		else if(nType == BC_SUPPORT_FDD_EDD)
			strValue = _T("EDD (Enhanced Disk Drive) Specification is supported");
		else if(nType == BC_SUPPORT_FDD_2HD_PC98)
			strValue = _T("Int 13h - Japanese Floppy for NEC 9800 1.2mb (3.5, 1k Bytes/Sector, 360 RPM) is supported");
		else if(nType == BC_SUPPORT_FDD_2HD_TOSHIBA)
			strValue = _T("Int 13h - Japanese Floppy for Toshiba 1.2mb (3.5, 360 RPM) is supported");
		else if(nType == BC_SUPPORT_FDD_2D)
			strValue = _T("Int 13h - 5.25 / 360 KB Floppy Services are supported");
		else if(nType == BC_SUPPORT_FDD_2HD_5INCH)
			strValue = _T("Int 13h - 5.25 /1.2MB Floppy Services are supported");
		else if(nType == BC_SUPPORT_FDD_2DD_3INCH)
			strValue = _T("Int 13h - 3.5 / 720 KB Floppy Services are supported");
		else if(nType == BC_SUPPORT_FDD_2_88MB_3INCH)
			strValue = _T("Int 13h - 3.5 / 2.88 MB Floppy Services are supported");
		else if(nType == BC_SUPPORT_PRINT_SCREEN)
			strValue = _T("Int 5h, Print Screen Service is supported");
		else if(nType == BC_SUPPORT_8042_KEYBOARD)
			strValue = _T("Int 9h, 8042 Keyboard services are supported");
		else if(nType == BC_SUPPORT_COM)
			strValue = _T("Int 14h, Serial Services are supported");
		else if(nType == BC_SUPPORT_PRT)
			strValue = _T("Int 17h, printer services are supported");
		else if(nType == BC_SUPPORT_CGA_MONO_VIDEO)
			strValue = _T("Int 10h, CGA/Mono Video Services are supported");
		else if(nType == BC_NEC_PC98)
			strValue = _T("NEC PC-98");
		else if(nType == BC_SUPPORT_ACPI)
			strValue = _T("ACPI supported");
		else if(nType == BC_SUPPORT_USB_LEGACY)
			strValue = _T("USB Legacy is supported");
		else if(nType == BC_SUPPORT_AGP)
			strValue = _T("AGP is supported");
		else if(nType == BC_SUPPORT_I2O_BOOT)
			strValue = _T("I2O boot is supported");
		else if(nType == BC_SUPPORT_LS120_BOOT)
			strValue = _T("LS-120 boot is supported");
		else if(nType == BC_SUPPORT_ATAPI_ZIP_BOOT)
			strValue = _T("ATAPI ZIP Drive boot is supported");
		else if(nType == BC_SUPPORT_1394_BOOT)
			strValue = _T("1394 boot is supported");
		else if(nType == BC_SUPPORT_SMART_BATTERY)
			strValue = _T("Smart Battery supported");
		else
		{
			//見つからなかった
			strValue = _T("");
			ATLASSERT(0);

			return	false;
		}

		return	true;
	}



	void	TRACE(void)
	{
#ifdef _DEBUG
		INT_PTR		i;
		CAtlString	strValue;

		for(i = 0; i < _anBiosCharacteristics.GetSize(); i++)
		{
			GetDescriptionOfBiosCharacteristics(_anBiosCharacteristics[i],strValue);
			ATLTRACE("BiosCharacteristics : %s\n",strValue);
		}

		for(i = 0; i < _anBIOSVersion.GetSize(); i++)
		{
			ATLTRACE("BIOSVersion : %d\n",_anBIOSVersion[i]);
		}

		ATLTRACE("BuildNumber : %s\n",_strBuildNumber);
		ATLTRACE("Caption : %s\n",_strCaption);
		ATLTRACE("CodeSet : %s\n",_strCodeSet);
		ATLTRACE("CurrentLanguage : %s\n",_strCurrentLanguage);
		ATLTRACE("Description : %s\n",_strDescription);
		ATLTRACE("IdentificationCode : %s\n",_strIdentificationCode);
		ATLTRACE("InstallableLanguages : %d\n",_nInstallableLanguages);
		ATLTRACE("InstallDate : %d\n",_nInstallDate);
		ATLTRACE("LanguageEdition : %s\n",_strLanguageEdition);
		ATLTRACE("Description : %s\n",_strDescription);

		for(i = 0; i < _anListOfLanguages.GetSize(); i++)
		{
			ATLTRACE("ListOfLanguages : %d\n",_anListOfLanguages[i]);
		}

		ATLTRACE("Manufacturer : %s\n",_strManufacturer);
		ATLTRACE("Name : %s\n",_strName);
		ATLTRACE("OtherTargetOS : %s\n",_strOtherTargetOS);
		ATLTRACE("PrimaryBIOS : %s\n",_bPrimaryBIOS ? _T("TRUE") : _T("FALSE"));
		ATLTRACE("ReleaseDate : %s\n",_strReleaseDate);
		ATLTRACE("SerialNumber : %s\n",_strSerialNumber);
		ATLTRACE("SMBIOSBIOSVersion : %s\n",_strSMBIOSBIOSVersion);
		ATLTRACE("SMBIOSMajorVersion : %d\n",_nSMBIOSMajorVersion);
		ATLTRACE("SMBIOSMinorVersion : %d\n",_nSMBIOSMinorVersion);
		ATLTRACE("SMBIOSPresent : %s\n",_bSMBIOSPresent ? _T("TRUE") : _T("FALSE"));
		ATLTRACE("SoftwareElementID : %s\n",_strSoftwareElementID);

		GetDescriptionOfSoftwareElementState(_nSoftwareElementState,strValue);
		ATLTRACE("SoftwareElementState : %s\n",strValue);

		ATLTRACE("TargetOperatingSystem : %d\n",_nTargetOperatingSystem);
		ATLTRACE("Status : %s\n",_strStatus);
		ATLTRACE("Version : %s\n",_strVersion);
#endif
	}


protected:

	bool	GetStringValue(const VARIANT& vValue,CAtlString& strValue)
	{
		if(vValue.vt != VT_BSTR)
		{
			strValue = _T("");
			return	false;
		}
		strValue = V_BSTR(&vValue);

		return	true;
	}

	bool	GetIntValue(const VARIANT& vValue,UINT& nValue)
	{
		if(vValue.vt == VT_I2)
		{
			nValue = V_I2(&vValue);
			return	true;
		}
		if(vValue.vt == VT_I4)
		{
			nValue = V_I4(&vValue);
			return	true;
		}
		if(vValue.vt == VT_UI1)
		{
			nValue = V_UI1(&vValue);
			return	true;
		}
		if(vValue.vt == VT_UI2)
		{
			nValue = V_UI2(&vValue);
			return	true;
		}
		if(vValue.vt == VT_UI4)
		{
			nValue = V_UI4(&vValue);
			return	true;
		}
		if(vValue.vt == VT_I8)
		{
			nValue = V_I8(&vValue);
			return	true;
		}
		if(vValue.vt == VT_UI8)
		{
			nValue = V_UI8(&vValue);
			return	true;
		}
		if(vValue.vt == VT_I8)
		{
			nValue = V_I8(&vValue);
			return	true;
		}
		if(vValue.vt == VT_INT)
		{
			nValue = V_INT(&vValue);
			return	true;
		}
		if(vValue.vt == VT_UINT)
		{
			nValue = V_UINT(&vValue);
			return	true;
		}

		nValue = 0;

		return	false;
	}

	bool	GetBoolValue(const VARIANT& vValue,bool& bValue)
	{
		if(vValue.vt != VT_BOOL)
		{
			bValue = false;
			return	false;
		}
		bValue = V_BOOL(&vValue) ? true : false;

		return	true;
	}

	bool	GetIntArrayValue(const VARIANT& vValue,CUINTArray& anValue)
	{
		long	i;
		long	nMin;
		long	nMax;
		long	nValue;
		HRESULT	hr;

		anValue.RemoveAll();
		if(V_ISARRAY(&vValue) == FALSE)
			return	false;

		SafeArrayGetLBound(V_ARRAY(&vValue),1,&nMin);
		SafeArrayGetUBound(V_ARRAY(&vValue),1,&nMax);
		for(i = nMin; i <= nMax; i++)
		{
			hr = SafeArrayGetElement(V_ARRAY(&vValue),&i,&nValue);
			if(SUCCEEDED(hr))
				anValue.Add(nValue);
		}
		return	true;
	}


public:
	bool	GetBIOS(void)
	{
		HRESULT		hr;
		ULONG		dwCount;
		long		vbl;
		long		vbu;
		long		idx;
		SAFEARRAY*	pvNames;

		CComPtr			pLoc;
		CComPtr			pSvc;
		CComPtr		pInstance;
		CComPtr	pEnumerator;

		if(_bInit)
			return	true;

		//前にCoInitializeSecurityを実行したことがあるとエラーになるから戻り値をチェックしない
		hr = ::CoInitializeSecurity(NULL,-1,NULL,NULL,RPC_C_AUTHN_LEVEL_DEFAULT,RPC_C_IMP_LEVEL_IMPERSONATE,NULL,EOAC_NONE,NULL);

		hr = ::CoCreateInstance(CLSID_WbemLocator,0,CLSCTX_INPROC_SERVER,IID_IWbemLocator,(void**)&pLoc);

		if(pLoc)
			hr = pLoc->ConnectServer(L"ROOT\\CIMV2",NULL,NULL,0,NULL,0,0,&pSvc);

		if(pSvc == NULL)
		{
			//エラー!
			//原因はCoInitialize(NULL);を実行していないことが多い
			ATLASSERT(0);
			return false;
		}

		hr = ::CoSetProxyBlanket(pSvc,RPC_C_AUTHN_WINNT,RPC_C_AUTHZ_NONE,NULL,RPC_C_AUTHN_LEVEL_CALL,RPC_C_IMP_LEVEL_IMPERSONATE,NULL,EOAC_NONE);

		if(SUCCEEDED(hr))
			hr = pSvc->ExecQuery(L"WQL",L"SELECT * from Win32_BIOS",WBEM_FLAG_FORWARD_ONLY|WBEM_FLAG_RETURN_IMMEDIATELY,NULL,&pEnumerator);

		if(FAILED(hr))
			return false;

		while(1)
		{
			pInstance = NULL;
			hr = pEnumerator->Next(WBEM_INFINITE,1,&pInstance,&dwCount);
			if(pInstance == NULL)
				break;

			pvNames = NULL;
			hr = pInstance->GetNames(NULL,WBEM_FLAG_ALWAYS | WBEM_MASK_CONDITION_ORIGIN,NULL,&pvNames);
			if(FAILED(hr))
				continue;

			SafeArrayGetLBound(pvNames,1,&vbl);
			SafeArrayGetUBound(pvNames,1,&vbu);
			for(idx = vbl; idx <= vbu; idx++)
			{
				long		aidx = idx;
				wchar_t*	wsName;
				VARIANT		vValue;
				CAtlString	strName;

				wsName = NULL;
				SafeArrayGetElement(pvNames,&aidx,&wsName);

				VariantInit(&vValue);
				hr = pInstance->Get(wsName,0,&vValue,NULL,0);

				strName = wsName;
				::SysFreeString(wsName);

				if(strName == _T("BiosCharacteristics"))
					GetIntArrayValue(vValue,_anBiosCharacteristics);
				else if(strName == _T("BIOSVersion"))
					GetIntArrayValue(vValue,_anBIOSVersion);
				else if(strName == _T("BuildNumber"))
					GetStringValue(vValue,_strBuildNumber);
				else if(strName == _T("Caption"))
					GetStringValue(vValue,_strCaption);
				else if(strName == _T("CodeSet"))
					GetStringValue(vValue,_strCodeSet);
				else if(strName == _T("CurrentLanguage"))
					GetStringValue(vValue,_strCurrentLanguage);
				else if(strName == _T("Description"))
					GetStringValue(vValue,_strDescription);
				else if(strName == _T("IdentificationCode"))
					GetStringValue(vValue,_strIdentificationCode);
				else if(strName == _T("InstallableLanguages"))
					GetIntValue(vValue,_nInstallableLanguages);
				else if(strName == _T("InstallDate"))
					GetIntValue(vValue,_nInstallDate);
				else if(strName == _T("LanguageEdition"))
					GetStringValue(vValue,_strLanguageEdition);
				else if(strName == _T("ListOfLanguages"))
					GetIntArrayValue(vValue,_anListOfLanguages);
				else if(strName == _T("Manufacturer"))
					GetStringValue(vValue,_strManufacturer);
				else if(strName == _T("Name"))
					GetStringValue(vValue,_strName);
				else if(strName == _T("OtherTargetOS"))
					GetStringValue(vValue,_strOtherTargetOS);
				else if(strName == _T("PrimaryBIOS"))
					GetBoolValue(vValue,_bPrimaryBIOS);
				else if(strName == _T("ReleaseDate"))
					GetStringValue(vValue,_strReleaseDate);
				else if(strName == _T("SerialNumber"))
					GetStringValue(vValue,_strSerialNumber);
				else if(strName == _T("SMBIOSBIOSVersion"))
					GetStringValue(vValue,_strSMBIOSBIOSVersion);
				else if(strName == _T("SMBIOSMajorVersion"))
					GetIntValue(vValue,_nSMBIOSMajorVersion);
				else if(strName == _T("SMBIOSMinorVersion"))
					GetIntValue(vValue,_nSMBIOSMinorVersion);
				else if(strName == _T("SMBIOSPresent"))
					GetBoolValue(vValue,_bSMBIOSPresent);
				else if(strName == _T("SoftwareElementID"))
					GetStringValue(vValue,_strSoftwareElementID);
				else if(strName == _T("SoftwareElementState"))
					GetIntValue(vValue,_nSoftwareElementState);
				else if(strName == _T("Status"))
					GetStringValue(vValue,_strStatus);
				else if(strName == _T("TargetOperatingSystem"))
					GetIntValue(vValue,_nTargetOperatingSystem);
				else if(strName == _T("Version"))
					GetStringValue(vValue,_strVersion);
				else
				{
					//未対応データがあった
					ATLASSERT(0);
				}
			}
			if(pvNames)
				SafeArrayDestroy(pvNames);
		}

		_bInit = true;
		return true;
	}
};

カテゴリー「VC++ TIPS」 のエントリー