|
// PSLCores.cpp : Implementation of CPSLCores
#include "stdafx.h"
#include "PSLCore.h"
#include "PSLCores.h"
CPSLCores::CPSLCores()
{
}
HRESULT CPSLCores::OnIndexOutOfRange()
{
return MakeException(exIndexOutOfRange);
}
HRESULT CPSLCores::FinalConstruct()
{
PSL_BEGIN
InternalUpdate();
PSL_END
}
void CPSLCores::FinalRelease()
{
}
void CPSLCores::InternalUpdate()
{
CCritSecLock cs(m_csCollection);
m_coll.clear();
HKEY hkResult = 0;
int CPUIndex = 0;
TCHAR buffer[64];
while(1)
{
::swprintf_s(buffer, 64, _T("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\%d"), CPUIndex);
if(::RegOpenKeyEx(HKEY_LOCAL_MACHINE, buffer, 0, KEY_READ, &hkResult) != ERROR_SUCCESS)
break;
::RegCloseKey(hkResult);
CPUIndex ++;
CComObject<CPSLCore> * pCore = NULL;
if(CComObject<CPSLCore>::CreateInstance(&pCore) == S_OK)
{
pCore->Initialize(buffer);
m_coll.push_back(CComPtr<IPSLCore>(pCore));
}
}
}
////////////////////////////////////////////////////////////////////////
// Interface Implementation;
////////////////////////////////////////////////////////////////////////
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.