at one time I played with pulling a variety of information about the system.
That will have a very detailed report about the system.
Processor, system memory, video memory (had to write a translator from C + +), very detailed information about the type of operating systems including verification of what windows are x32 or x64
Code: Select all
/*
====================
CPU Detect from MSDN
http://msdn2.microsoft.com/en-us/library/hskdteyh(VS.80).aspx
adv info for AMD CPU's form
http://www.gamedev.net/community/forums/topic.asp?topic_id=438752
====================
*/
static const unsigned CPU_UNKNOWN = 0;
static const unsigned CPU_AMD = 1;
static const unsigned CPU_INTEL = 2;
int MeasureCpuSpeed()
{
unsigned __int64 start, end, counter, stop, frequency;
unsigned speed;
QueryPerformanceFrequency((LARGE_INTEGER *)&frequency);
__asm {
rdtsc
mov dword ptr[start+0], eax
mov dword ptr[start+4], edx
}
QueryPerformanceCounter((LARGE_INTEGER *)&stop);
stop += frequency;
do {
QueryPerformanceCounter((LARGE_INTEGER *)&counter);
} while (counter < stop);
__asm {
rdtsc
mov dword ptr[end+0], eax
mov dword ptr[end+4], edx
}
speed = (unsigned)((end - start) / 1000000);
return speed;
}
void CpuID(void)
{
char CPUString[0x20];
char CPUBrandString[0x40];
int CPUInfo[4] = {-1};
int nFeatureInfo = 0;
int nCacheSizeK = 0;
int nCache1SizeK = 0;
unsigned nIds, nExIds, i;
unsigned dwCPUSpeed = MeasureCpuSpeed();
unsigned pType;
qboolean SSE3 = false;
qboolean HTT = false;
qboolean SSE4 = false;
qboolean SSE2 = false;
qboolean SSE = false;
qboolean MMX = false;
qboolean EM64T = false;
SYSTEM_INFO BaseCpuInfo;
// __cpuid with an InfoType argument of 0 returns the number of
// valid Ids in CPUInfo[0] and the CPU identification string in
// the other three array elements. The CPU identification string is
// not in linear order. The code below arranges the information
// in a human readable form.
__cpuid(CPUInfo, 0);
nIds = CPUInfo[0];
memset(CPUString, 0, sizeof(CPUString));
*((int*)CPUString) = CPUInfo[1];
*((int*)(CPUString+4)) = CPUInfo[3];
*((int*)(CPUString+8)) = CPUInfo[2];
if(strcmp(CPUString, "AuthenticAMD") == 0)
pType = CPU_AMD;
else if(strcmp(CPUString, "GenuineIntel") == 0)
pType = CPU_INTEL;
else
pType = CPU_UNKNOWN;
// Get the information associated with each valid Id
for (i=0; i<=nIds; ++i)
{
__cpuid(CPUInfo, i);
// Interpret CPU feature information.
if (i == 1)
{
SSE4 = (CPUInfo[2] & BIT (9))||false;
SSE3 = (CPUInfo[2] & BIT (0))||false;
SSE2 = (CPUInfo[3] & BIT(26))||false;
SSE = (CPUInfo[3] & BIT(25))||false;
MMX = (CPUInfo[3] & BIT(23))||false;
HTT = (CPUInfo[3] & BIT(28))||false;
EM64T = (CPUInfo[3] & BIT(29))||false;
nFeatureInfo = CPUInfo[3];
}
}
// Calling __cpuid with 0x80000000 as the InfoType argument
// gets the number of valid extended IDs.
__cpuid(CPUInfo, 0x80000000);
nExIds = CPUInfo[0];
memset(CPUBrandString, 0, sizeof(CPUBrandString));
// Get the information associated with each extended ID.
for (i=0x80000000; i<=nExIds; ++i)
{
__cpuid(CPUInfo, i);
// Interpret CPU brand string and cache information.
if (i == 0x80000002)
memcpy(CPUBrandString, CPUInfo, sizeof(CPUInfo));
else
if (i == 0x80000003)
memcpy(CPUBrandString + 16, CPUInfo, sizeof(CPUInfo));
else
if (i == 0x80000004)
memcpy(CPUBrandString + 32, CPUInfo, sizeof(CPUInfo));
else
if (i == 0x80000005)
nCache1SizeK = (CPUInfo[2] >> 24); //AMD L1 CACHE SIZE. RETURN ZERO FOR INTEL CPU
else
if (i == 0x80000006)
{
if(pType == CPU_INTEL)
nCache1SizeK = (CPUInfo[2] >> 10) & 0xffff; //INTEL L1 CACHE SIZE.
nCacheSizeK = (CPUInfo[2] >> 16) & 0xffff; //L2 CACHE SIZE.
}
}
if (nIds >= 1)
{
if (nFeatureInfo || SSE3 || MMX || SSE || SSE2 || SSE4 || HTT || EM64T) {
GetSystemInfo(&BaseCpuInfo);
Com_Printf ("Cpu Brand Name: "S_COLOR_GREEN"%s\n", CPUBrandString);
Com_Printf ("Number of CPUs: "S_COLOR_GREEN"%d\n", BaseCpuInfo.dwNumberOfProcessors);
Com_Printf ("CPU speed: "S_COLOR_GREEN"~%d"S_COLOR_WHITE"MHz\n", dwCPUSpeed);
Com_Printf ("Supported Extensions: ");
__cpuid(CPUInfo, 0x80000001);
if (CPUInfo[3] & 0x80000000)
Com_Printf (S_COLOR_YELLOW"3DNow! ");
if (CPUInfo[3] & 1<<30)
Com_Printf (S_COLOR_YELLOW"ex3DNow! ");
if (CPUInfo[3] & 1<<22)
Com_Printf (S_COLOR_YELLOW"MmxExt ");
if (MMX)
Com_Printf (S_COLOR_YELLOW"MMX ");
if (SSE)
Com_Printf (S_COLOR_YELLOW"SSE ");
if (SSE2)
Com_Printf (S_COLOR_YELLOW"SSE2 ");
if (SSE3)
Com_Printf (S_COLOR_YELLOW"SSE3 ");
if (SSE4)
Com_Printf (S_COLOR_YELLOW"SSE4 ");
// if (HTT)
// Com_Printf (S_COLOR_YELLOW"/Hyper-threading Technology ");
if (EM64T)
Com_Printf (S_COLOR_YELLOW"EM64T");
Com_Printf("\n");
if(BaseCpuInfo.dwNumberOfProcessors > 1){
Com_Printf ("L1 Cache Size = "S_COLOR_GREEN"%i"S_COLOR_WHITE" x "S_COLOR_GREEN"%d"S_COLOR_WHITE"K\n",BaseCpuInfo.dwNumberOfProcessors, nCache1SizeK);
Com_Printf ("L2 Cache Size = "S_COLOR_GREEN"%i"S_COLOR_WHITE" x "S_COLOR_GREEN"%d"S_COLOR_WHITE"K\n",BaseCpuInfo.dwNumberOfProcessors, nCacheSizeK);
}
else
{
Com_Printf ("L1 Cache Size = "S_COLOR_GREEN"%d"S_COLOR_WHITE"K\n", nCache1SizeK);
Com_Printf ("L2 Cache Size = "S_COLOR_GREEN"%d"S_COLOR_WHITE"K\n", nCacheSizeK);
}
}
}
if(sys_affinity->value)
{
// cpumask=1 - use core #0
// cpumask=2 - use core #1
// cpumask=3 - use cores #0 & #1
if(sys_affinity->value >3)
Cvar_SetValue("sys_affinity", 3);
// if number of cpu core > 1
// we can run run game on second core or use both cores
if (BaseCpuInfo.dwNumberOfProcessors > 1)
SetProcessAffinityMask(GetCurrentProcess(), (DWORD_PTR)sys_affinity->value);
CloseHandle(GetCurrentProcess());
}
}
/*
** GLimp_Init
**
** This routine is responsible for initializing the OS specific portions
** of OpenGL. Under Win32 this means dealing with the pixelformats and
** doing the wgl interface stuff.
*/
BOOL Is64BitWindows()
{
BOOL f64 = FALSE;
return IsWow64Process(GetCurrentProcess(), &f64) && f64;
}
typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD);
int cpp_getAvailableLocalVideoMemory();
int cpp_getAvailableTotalVideoMemory();
#define PRODUCT_ENTERPRISE_E 0x00000046 //Enterprise E
#define PRODUCT_ENTERPRISE_N 0x0000001B //Enterprise N
#define PRODUCT_ULTIMATE_E 0x00000047 //Ultimate E
#define PRODUCT_ULTIMATE_N 0x0000001C //Ultimate N
#define PRODUCT_HOME_BASIC_E 0x00000043 //Home Basic E
#define PRODUCT_HOME_PREMIUM_E 0x00000044 //Home Premium E
#define PRODUCT_HOME_PREMIUM_N 0x0000001A //Home Premium N
#define PRODUCT_PROFESSIONAL 0x00000030 //Professional
#define PRODUCT_PROFESSIONAL_E 0x00000045 //Professional E
#define PRODUCT_PROFESSIONAL_N 0x00000031 //Professional N
#define PRODUCT_STARTER_E 0x00000042 //Starter E
#define PRODUCT_STARTER_N 0x0000002F //Starter N
qboolean GLimp_Init( void *hinstance, void *wndproc )
{
char string[64], S[64];
ILstring devil;
int len, devilver, loc, agp, total, avbl;
#define OSR2_BUILD_NUMBER 1111
DWORD prType;
PGPI pGPI;
OSVERSIONINFOEX winver;
MEMORYSTATUS ramcheck;
SYSTEM_INFO cpuinf;
GlobalMemoryStatus (&ramcheck);
winver.dwOSVersionInfoSize = sizeof(winver);
glw_state.allowdisplaydepthchange = false;
ZeroMemory(&cpuinf, sizeof(SYSTEM_INFO));
GetSystemInfo(&cpuinf);
//set high process priority for fullscreen mode
if(r_fullScreen->value && sys_priority->value && cpuinf.dwNumberOfProcessors > 1)
SetPriorityClass (GetCurrentProcess(), HIGH_PRIORITY_CLASS);
else
SetPriorityClass (GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
Con_Printf (PRINT_ALL, "\n");
Com_Printf ("========"S_COLOR_YELLOW"System Information"S_COLOR_WHITE"========\n");
Con_Printf (PRINT_ALL, "\n");
//CPU info
CpuID();
Con_Printf (PRINT_ALL, "\n");
//RAM
Com_Printf("Total physical RAM: "S_COLOR_GREEN"%u"S_COLOR_WHITE" MB\n", ramcheck.dwTotalPhys >> 20);
Com_Printf("Available physical RAM: "S_COLOR_GREEN"%u"S_COLOR_WHITE" MB\n", ramcheck.dwAvailPhys >> 20);
Com_Printf("Total PageFile: "S_COLOR_GREEN"%u"S_COLOR_WHITE" MB\n", ramcheck.dwTotalPageFile >> 20);
Com_Printf("Available PageFile: "S_COLOR_GREEN"%u"S_COLOR_WHITE" MB\n", ramcheck.dwAvailPageFile >> 20);
Com_Printf("Total Virtual Memory: "S_COLOR_GREEN"%u"S_COLOR_WHITE" MB\n", ramcheck.dwTotalVirtual >> 20);
Com_Printf("Available Virtual Memory: "S_COLOR_GREEN"%u"S_COLOR_WHITE" MB\n", ramcheck.dwAvailVirtual >> 20);
Con_Printf (PRINT_ALL, "\n");
loc = cpp_getAvailableLocalVideoMemory();
avbl = loc;
total = cpp_getAvailableTotalVideoMemory();
if(!loc)
goto err; //fuck! return NULL if video card have pci-e2agp brige or integrated video
// fix uncorect local video memory size - direct draw bug??????
if(loc<=64)
loc = 64;else
if(loc<=128)
loc = 128;else
if(loc<=256)
loc = 256;else
if(loc<=384)
loc = 384;else
if(loc<=512)
loc = 512;else
if(loc<=768)
loc = 768;else
if(loc<=896)
loc = 896;else
if(loc<=1024)
loc = 1024;else
if(loc<1536)
loc = 1536;else
if(loc<=2048)
loc = 2048;
agp = total - avbl;
Com_Printf("Local video memory: "S_COLOR_GREEN"~%i"S_COLOR_WHITE" MB\n", loc);
Com_Printf("Available video memory: "S_COLOR_GREEN"~%i"S_COLOR_WHITE" MB\n", avbl);
Com_Printf("AGP/PCI-E video memory: "S_COLOR_GREEN"~%i"S_COLOR_WHITE" MB\n", agp);
Com_Printf("Total video memory: "S_COLOR_GREEN"~%i"S_COLOR_WHITE" MB\n", total);
Con_Printf (PRINT_ALL, "\n");
err:
//OS same info from http://msdn.microsoft.com/en-us/library/ms724429(VS.85).aspx
if ( GetVersionEx( &winver) )
{
if ( winver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
VID_Error (ERR_FATAL, "Quake2xp requires Windows 2000 or greater");
if ( winver.dwMajorVersion == 6 && (winver.dwMinorVersion == 0 || winver.dwMinorVersion == 1) ) //vista & win7
{
pGPI = (PGPI) GetProcAddress(
GetModuleHandle(TEXT("kernel32.dll")),
"GetProductInfo");
pGPI(6,0,0,0,&prType);
switch( prType )
{
case PRODUCT_ULTIMATE:
sprintf(S, "Ultimate Edition");
break;
case PRODUCT_ULTIMATE_E:
sprintf(S, "Ultimate E Edition");
break;
case PRODUCT_ULTIMATE_N:
sprintf(S, "Ultimate N Edition");
break;
case PRODUCT_HOME_PREMIUM:
sprintf(S, "Home Premium Edition");
break;
case PRODUCT_HOME_PREMIUM_E:
sprintf(S, "Home Premium E Edition");
break;
case PRODUCT_HOME_PREMIUM_N:
sprintf(S, "Home Premium N Edition");
break;
case PRODUCT_HOME_BASIC:
sprintf(S, "Home Basic Edition");
break;
case PRODUCT_HOME_BASIC_E:
sprintf(S, "Home Basic E Edition");
break;
case PRODUCT_HOME_BASIC_N:
sprintf(S, "Home Basic N Edition");
break;
case PRODUCT_ENTERPRISE:
sprintf(S, "Enterprise Edition");
break;
case PRODUCT_ENTERPRISE_E:
sprintf(S, "Enterprise E Edition");
break;
case PRODUCT_ENTERPRISE_N:
sprintf(S, "Enterprise N Edition");
break;
case PRODUCT_BUSINESS:
sprintf(S, "Business Edition");
break;
case PRODUCT_BUSINESS_N:
sprintf(S, "Business N Edition");
break;
case PRODUCT_STARTER:
sprintf(S, "Starter Edition");
break;
case PRODUCT_STARTER_E:
sprintf(S, "Starter E Edition");
break;
case PRODUCT_STARTER_N:
sprintf(S, "Starter N Edition");
break;
case PRODUCT_CLUSTER_SERVER:
sprintf(S, "Cluster Server Edition");
break;
case PRODUCT_DATACENTER_SERVER:
sprintf(S, "Datacenter Edition");
break;
case PRODUCT_DATACENTER_SERVER_CORE:
sprintf(S, "Datacenter Edition (core installation)");
break;
case PRODUCT_ENTERPRISE_SERVER:
sprintf(S, "Enterprise Edition");
break;
case PRODUCT_ENTERPRISE_SERVER_CORE:
sprintf(S, "Enterprise Edition (core installation)");
break;
case PRODUCT_ENTERPRISE_SERVER_IA64:
sprintf(S, "Enterprise Edition for Itanium-based Systems");
break;
case PRODUCT_SMALLBUSINESS_SERVER:
sprintf(S, "Small Business Server");
break;
case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM:
sprintf(S, "Small Business Server Premium Edition");
break;
case PRODUCT_STANDARD_SERVER:
sprintf(S, "Standard Edition");
break;
case PRODUCT_STANDARD_SERVER_CORE:
sprintf(S, "Standard Edition (core installation)");
break;
case PRODUCT_WEB_SERVER:
sprintf(S, "Web Server Edition");
break;
default:
sprintf(S, "Ultimate Edition");
break;
}
if(winver.dwMinorVersion == 0){
if(!Is64BitWindows()){
if( winver.wProductType == VER_NT_WORKSTATION)
Com_Printf ( S_COLOR_WHITE"OS: "S_COLOR_YELLOW"Microsoft Windows Vista "S_COLOR_GREEN"x32 "S_COLOR_WHITE"%s"S_COLOR_YELLOW" %s "S_COLOR_WHITE"build "S_COLOR_GREEN"%d\n", S, winver.szCSDVersion, winver.dwBuildNumber);
if( winver.wProductType == VER_NT_SERVER)
Com_Printf ( S_COLOR_WHITE"OS: "S_COLOR_YELLOW"Microsoft Windows Server 2008 "S_COLOR_GREEN"x32 "S_COLOR_WHITE"%s"S_COLOR_YELLOW" %s "S_COLOR_WHITE"build "S_COLOR_GREEN"%d\n", S, winver.szCSDVersion, winver.dwBuildNumber);
}
if(Is64BitWindows()){
if( winver.wProductType == VER_NT_WORKSTATION)
Com_Printf ( S_COLOR_WHITE"OS: "S_COLOR_YELLOW"Microsoft Windows Vista "S_COLOR_GREEN"x64 "S_COLOR_WHITE"%s"S_COLOR_YELLOW" %s "S_COLOR_WHITE"build "S_COLOR_GREEN"%d\n", S, winver.szCSDVersion, winver.dwBuildNumber);
if( winver.wProductType == VER_NT_SERVER)
Com_Printf ( S_COLOR_WHITE"OS: "S_COLOR_YELLOW"Microsoft Windows Server 2008 "S_COLOR_GREEN"x64 "S_COLOR_WHITE"%s"S_COLOR_YELLOW" %s "S_COLOR_WHITE"build "S_COLOR_GREEN"%d\n", S, winver.szCSDVersion, winver.dwBuildNumber);
}
}
if(winver.dwMinorVersion == 1){
if(!Is64BitWindows()){
if( winver.wProductType == VER_NT_WORKSTATION)
Com_Printf ( S_COLOR_WHITE"OS: "S_COLOR_YELLOW"Microsoft Windows 7 "S_COLOR_GREEN"x32 "S_COLOR_WHITE"%s"S_COLOR_YELLOW" %s "S_COLOR_WHITE"build "S_COLOR_GREEN"%d\n", S, winver.szCSDVersion, winver.dwBuildNumber);
if( winver.wProductType == VER_NT_SERVER)
Com_Printf ( S_COLOR_WHITE"OS: "S_COLOR_YELLOW"Microsoft Windows Server 2009 "S_COLOR_GREEN"x32 "S_COLOR_WHITE"%s"S_COLOR_YELLOW" %s "S_COLOR_WHITE"build "S_COLOR_GREEN"%d\n", S, winver.szCSDVersion, winver.dwBuildNumber);
}
if(Is64BitWindows()){
if( winver.wProductType == VER_NT_WORKSTATION)
Com_Printf ( S_COLOR_WHITE"OS: "S_COLOR_YELLOW"Microsoft Windows 7 "S_COLOR_GREEN"x64 "S_COLOR_WHITE"%s"S_COLOR_YELLOW" %s "S_COLOR_WHITE"build "S_COLOR_GREEN"%d\n", S, winver.szCSDVersion, winver.dwBuildNumber);
if( winver.wProductType == VER_NT_SERVER)
Com_Printf ( S_COLOR_WHITE"OS: "S_COLOR_YELLOW"Microsoft Windows Server 2009 "S_COLOR_GREEN"x64 "S_COLOR_WHITE"%s"S_COLOR_YELLOW" %s "S_COLOR_WHITE"build "S_COLOR_GREEN"%d\n", S, winver.szCSDVersion, winver.dwBuildNumber);
}
}
}
if ( winver.dwMajorVersion == 5 && winver.dwMinorVersion == 2 )
{
if ( winver.wSuiteMask==VER_SUITE_STORAGE_SERVER )
Com_Printf ( S_COLOR_WHITE"OS: "S_COLOR_YELLOW"Microsoft Windows Storage Server 2003");
if( winver.wProductType == VER_NT_WORKSTATION)
Com_Printf ( S_COLOR_WHITE"OS: "S_COLOR_YELLOW"Microsoft Windows XP Professional "S_COLOR_GREEN"x64 "S_COLOR_YELLOW"Edition %s "S_COLOR_WHITE"build "S_COLOR_GREEN"%d\n", winver.szCSDVersion, winver.dwBuildNumber);
else {
if(Is64BitWindows())
Com_Printf ( S_COLOR_WHITE"OS: "S_COLOR_YELLOW"Microsoft Windows 2003 Server "S_COLOR_GREEN"x64 "S_COLOR_YELLOW"Edition %s "S_COLOR_WHITE"build "S_COLOR_GREEN"%d\n",winver.szCSDVersion, winver.dwBuildNumber);
else
Com_Printf ( S_COLOR_WHITE"OS: "S_COLOR_YELLOW"Microsoft Windows 2003 Server "S_COLOR_GREEN"x32 "S_COLOR_YELLOW"Edition %s "S_COLOR_WHITE"build "S_COLOR_GREEN"%d\n",winver.szCSDVersion, winver.dwBuildNumber);
}
}
if ( winver.dwPlatformId == VER_PLATFORM_WIN32_NT )
{
if ( winver.dwMajorVersion <= 4 )
VID_Error (ERR_FATAL, "Quake2xp requires Windows 2000 or greater");
if ( winver.dwMajorVersion == 5 && winver.dwMinorVersion == 0 )
Com_Printf( S_COLOR_WHITE"OS: "S_COLOR_YELLOW"Microsoft Microsoft Windows 2000 %s "S_COLOR_WHITE"build "S_COLOR_GREEN"%d\n",winver.szCSDVersion, winver.dwBuildNumber);
if ( winver.dwMajorVersion == 5 && winver.dwMinorVersion == 1 )
{
Com_Printf( S_COLOR_WHITE"OS: "S_COLOR_YELLOW"Microsoft Windows XP ");
if( winver.wSuiteMask & VER_SUITE_PERSONAL )
Com_Printf( S_COLOR_YELLOW,"Home Edition " );
else
Com_Printf( S_COLOR_YELLOW"Professional " );
Com_Printf(S_COLOR_GREEN"%s ",winver.szCSDVersion);
Com_Printf( S_COLOR_WHITE"build "S_COLOR_GREEN"%d\n",winver.dwBuildNumber);
}
}
glw_state.allowdisplaydepthchange = true;
}
else
{
Com_Printf( S_COLOR_RED "GLimp_Init() - GetVersionEx failed\n" );
return false;
}
// get user name
len = sizeof(string);
Com_Printf("\nUserName: "S_COLOR_GREEN"%s\n", GetUserName(string, &len) ? string : "");
Com_Printf ("\n");
Com_Printf ("==="S_COLOR_YELLOW"OpenIL library initiation..."S_COLOR_WHITE"===\n");
Com_Printf ("\n");
ilInit();
iluInit();
ilutInit();
ilutRenderer (ILUT_OPENGL);
ilEnable (IL_ORIGIN_SET);
ilSetInteger (IL_ORIGIN_MODE, IL_ORIGIN_UPPER_LEFT);
devil = ilGetString(IL_VENDOR);
devilver = ilGetInteger(IL_VERSION_NUM);
Con_Printf (PRINT_ALL, "OpenIL VENDOR: "S_COLOR_GREEN" %s\n", devil);
Con_Printf (PRINT_ALL, "OpenIL Version: "S_COLOR_GREEN"%i\n", devilver);
Com_Printf ("\n");
Com_Printf ("==================================\n");
Com_Printf ("\n");
glw_state.hInstance = ( HINSTANCE ) hinstance;
glw_state.wndproc = wndproc;
return true;
}