86 lines
1.7 KiB
C++
86 lines
1.7 KiB
C++
#ifndef _GUITAR_WININFO_HPP_
|
|
#define _GUITAR_WININFO_HPP_
|
|
#ifndef _COMMON_REGKEY_HPP_
|
|
#include <common/regkey.hpp>
|
|
#endif
|
|
#ifndef _COMMON_STRING_HPP_
|
|
#include <common/string.hpp>
|
|
#endif
|
|
|
|
class WinInfo
|
|
{
|
|
public:
|
|
WinInfo(void);
|
|
virtual ~WinInfo();
|
|
void refresh(void);
|
|
const String &strProductName(void)const;
|
|
const String &strRegisteredOwner(void)const;
|
|
const String &strProductID(void)const;
|
|
const String &strVersion(void)const;
|
|
private:
|
|
String mStrProductName;
|
|
String mStrRegisteredOwner;
|
|
String mStrProductID;
|
|
String mStrVersion;
|
|
};
|
|
|
|
inline
|
|
WinInfo::WinInfo(void)
|
|
{
|
|
refresh();
|
|
}
|
|
|
|
inline
|
|
WinInfo::~WinInfo()
|
|
{
|
|
}
|
|
|
|
inline
|
|
void WinInfo::refresh(void)
|
|
{
|
|
RegKey regKey(RegKey::LocalMachine);
|
|
|
|
if(!regKey.openKey("Software\\Microsoft\\Windows\\CurrentVersion"))return;
|
|
regKey.queryValue("ProductName",mStrProductName);
|
|
if(!mStrProductName.isNull())
|
|
{
|
|
regKey.queryValue("RegisteredOwner",mStrRegisteredOwner);
|
|
regKey.queryValue("ProductId",mStrProductID);
|
|
regKey.queryValue("VersionNumber",mStrVersion);
|
|
}
|
|
else
|
|
{
|
|
RegKey regKey(RegKey::LocalMachine);
|
|
if(!regKey.openKey("Software\\Microsoft\\Windows NT\\CurrentVersion"))return;
|
|
regKey.queryValue("ProductName",mStrProductName);
|
|
regKey.queryValue("RegisteredOwner",mStrRegisteredOwner);
|
|
regKey.queryValue("ProductId",mStrProductID);
|
|
regKey.queryValue("VersionNumber",mStrVersion);
|
|
}
|
|
}
|
|
|
|
inline
|
|
const String &WinInfo::strProductName(void)const
|
|
{
|
|
return mStrProductName;
|
|
}
|
|
|
|
inline
|
|
const String &WinInfo::strRegisteredOwner(void)const
|
|
{
|
|
return mStrRegisteredOwner;
|
|
}
|
|
|
|
inline
|
|
const String &WinInfo::strProductID(void)const
|
|
{
|
|
return mStrProductID;
|
|
}
|
|
|
|
inline
|
|
const String &WinInfo::strVersion(void)const
|
|
{
|
|
return mStrVersion;
|
|
}
|
|
#endif
|