|
// PSLOS.cpp : Implementation of CPSLOS
#include "stdafx.h"
#include "PSLOS.h"
#include "shlobj.h"
CPSLOS::CPSLOS()
{
m_bIs64Bit = false;
CRegKey key;
if(key.Open(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Wow6432Node"), KEY_READ) == ERROR_SUCCESS)
{
m_bIs64Bit = true;
key.Close();
}
m_sProductName = _T("");
m_sProductId = _T("");
if(key.Open(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"), KEY_READ) == ERROR_SUCCESS)
{
TCHAR buffer[128];
ULONG nChars = 128;
if(key.QueryStringValue(_T("ProductName"), buffer, &nChars) == ERROR_SUCCESS)
m_sProductName = buffer;
nChars = 128;
if(key.QueryStringValue(_T("ProductId"), buffer, &nChars) == ERROR_SUCCESS)
m_sProductId = buffer;
key.Close();
}
}
HRESULT CPSLOS::FinalConstruct()
{
return S_OK;
}
void CPSLOS::FinalRelease()
{
}
////////////////////////////////////////////////////////////////////////
// Interface Implementation;
////////////////////////////////////////////////////////////////////////
STDMETHODIMP CPSLOS::get_Is64Bit(VARIANT_BOOL * pValue)
{
PSL_BEGIN
*pValue = m_bIs64Bit?VARIANT_TRUE:VARIANT_FALSE;
PSL_END
}
STDMETHODIMP CPSLOS::get_Version(IPSLOSVersion ** ppValue)
{
PSL_BEGIN
*ppValue = m_Version;
PSL_END
}
STDMETHODIMP CPSLOS::get_AffinityMask(VARIANT * pValue)
{
PSL_BEGIN
CPSLUtilities::SetVariantBig(pValue, 0);
DWORD_PTR ProcessAffinityMask = 0;
DWORD_PTR SystemAffinityMask = 0;
if(::GetProcessAffinityMask(::GetCurrentProcess(), &ProcessAffinityMask, &SystemAffinityMask))
CPSLUtilities::SetVariantBig(pValue, SystemAffinityMask);
PSL_END
}
STDMETHODIMP CPSLOS::get_ProductName(BSTR * pValue)
{
PSL_BEGIN
*pValue = m_sProductName.copy();
PSL_END
}
STDMETHODIMP CPSLOS::get_ProductId(BSTR * pValue)
{
PSL_BEGIN
*pValue = m_sProductId.copy();
PSL_END
}
STDMETHODIMP CPSLOS::get_Memory(IPSLMemory ** ppValue)
{
PSL_BEGIN
*ppValue = m_Memory;
PSL_END
}
STDMETHODIMP CPSLOS::GetSpecialFolder(PSLSpecialFolder Folder, BSTR * pValue)
{
PSL_BEGIN
tstring path;
path.resize(MAX_FILE_PATH);
if(::SHGetFolderPath(NULL, Folder, NULL, SHGFP_TYPE_CURRENT, (LPTSTR)path.c_str()) == S_OK)
*pValue = ::SysAllocString(path.c_str());
else
*pValue = ::SysAllocString(_T(""));
PSL_END
}
|
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.