ASysInfo plugin can show Vista and Win7 in OS_VERSION.

Added OS_BITS to the SysInfo plugin.
This commit is contained in:
Kimmo Pekkola 2009-07-27 11:52:07 +00:00
parent dd9ab1dc04
commit b3fc191b58

View File

@ -50,6 +50,7 @@ MULTIMONITOR_INFO m_Monitors = { 0 };
BOOL CheckConnection(); BOOL CheckConnection();
void GetOSVersion(WCHAR* buffer); void GetOSVersion(WCHAR* buffer);
void GetOSBits(WCHAR* buffer);
BOOL CALLBACK MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData); BOOL CALLBACK MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData);
enum TYPE enum TYPE
@ -60,6 +61,7 @@ enum TYPE
SCREEN_SIZE, SCREEN_SIZE,
RAS_STATUS, RAS_STATUS,
OS_VERSION, OS_VERSION,
OS_BITS,
ADAPTER_DESCRIPTION, ADAPTER_DESCRIPTION,
NET_MASK, NET_MASK,
IP_ADDRESS, IP_ADDRESS,
@ -126,6 +128,10 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
{ {
g_Types[id] = OS_VERSION; g_Types[id] = OS_VERSION;
} }
else if (wcsicmp(L"OS_BITS", type) == 0)
{
g_Types[id] = OS_BITS;
}
else if (wcsicmp(L"ADAPTER_DESCRIPTION", type) == 0) else if (wcsicmp(L"ADAPTER_DESCRIPTION", type) == 0)
{ {
g_Types[id] = ADAPTER_DESCRIPTION; g_Types[id] = ADAPTER_DESCRIPTION;
@ -279,6 +285,10 @@ LPCTSTR GetString(UINT id, UINT flags)
GetOSVersion(buffer); GetOSVersion(buffer);
return buffer; return buffer;
case OS_BITS:
GetOSBits(buffer);
return buffer;
case ADAPTER_DESCRIPTION: case ADAPTER_DESCRIPTION:
if (ERROR_SUCCESS == GetAdaptersInfo((IP_ADAPTER_INFO*)buffer, &len)) if (ERROR_SUCCESS == GetAdaptersInfo((IP_ADAPTER_INFO*)buffer, &len))
{ {
@ -521,9 +531,9 @@ void Finalize(HMODULE instance, UINT id)
*/ */
void GetOSVersion(WCHAR* buffer) void GetOSVersion(WCHAR* buffer)
{ {
OSVERSIONINFO version; OSVERSIONINFOEX version;
version.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
GetVersionEx(&version); GetVersionEx((OSVERSIONINFO*)&version);
if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) if (version.dwPlatformId == VER_PLATFORM_WIN32_NT)
{ {
@ -531,7 +541,7 @@ void GetOSVersion(WCHAR* buffer)
{ {
wcscpy(buffer, L"Windows NT"); wcscpy(buffer, L"Windows NT");
} }
else else if (version.dwMajorVersion == 5)
{ {
if (version.dwMinorVersion == 2) if (version.dwMinorVersion == 2)
{ {
@ -550,6 +560,29 @@ void GetOSVersion(WCHAR* buffer)
wcscpy(buffer, L"Unknown"); wcscpy(buffer, L"Unknown");
} }
} }
else
{
if (version.dwMinorVersion == 1 && version.wProductType == VER_NT_WORKSTATION)
{
wcscpy(buffer, L"Windows 7");
}
else if (version.dwMinorVersion == 1 && version.wProductType != VER_NT_WORKSTATION)
{
wcscpy(buffer, L"Windows Server 2008 R2");
}
else if (version.dwMinorVersion == 0 && version.wProductType == VER_NT_WORKSTATION)
{
wcscpy(buffer, L"Windows Vista");
}
else if (version.dwMinorVersion == 0 && version.wProductType != VER_NT_WORKSTATION)
{
wcscpy(buffer, L"Windows Server 2008");
}
else
{
wcscpy(buffer, L"Unknown");
}
}
} }
else else
{ {
@ -568,6 +601,21 @@ void GetOSVersion(WCHAR* buffer)
} }
} }
void GetOSBits(WCHAR* buffer)
{
SYSTEM_INFO systemInfo = {0};
GetNativeSystemInfo(&systemInfo);
if (systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64 ||
systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)
{
wcscpy(buffer, L"64");
}
else
{
wcscpy(buffer, L"32");
}
}
/* /*
Tests if there is a RAS connection or not. Don't know Tests if there is a RAS connection or not. Don't know