Windows Versioning, Memory, Processor
Moderator: InsideQC Admins
14 posts
• Page 1 of 1
Windows Versioning, Memory, Processor
Nothing all that interesting or exciting to someone with experience. Adapted from some of R00k's code ... and cleaned it WAAY up.
Engine coding is tough and most people don't have the time to rewrite badly written non-critical code littered all over the place, but I'm truly remastering the code in my engine to be all rico suave.
I got sick at looking at ugly, unloved code.
- Code: Select all
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// sys_win_version.c -- Win32 system versioning code
#include "quakedef.h"
#include <windows.h>
static int System_Memory_MB = 0;
static int System_Processor_Speed_MHz = 0;
static char System_Processor_Description[40];
static char *WindowsVersion_Description[7] =
{
"Windows 95/98/ME",
"Windows 2000",
"Windows XP",
"Windows 2003",
"Windows Vista",
"Windows 7",
"Windows 7 or later"
};
int WindowsVersion=0;
void Sys_InfoPrint_f(void)
{
Con_Printf ("Operating System: %s\n"
"Memory : %i MB\n"
"Processor Speed : %i Mhz\n"
"Processor: : %s\n", WindowsVersion_Description[WindowsVersion], System_Memory_MB, System_Processor_Speed_MHz, System_Processor_Description);
}
qboolean Sys_GetWindowsVersion(void)
{
MEMORYSTATUS memstat;
LONG ret;
HKEY hKey;
OSVERSIONINFO vinfo;
static qboolean WinNT;
vinfo.dwOSVersionInfoSize = sizeof(vinfo);
if (!GetVersionEx(&vinfo))
Sys_Error ("Couldn't get OS info");
if (vinfo.dwMajorVersion < 4 || vinfo.dwPlatformId == VER_PLATFORM_WIN32s)
return false; // Version cannot run Quake
WinNT = (vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT) ? true : false;
// Get The Version
if (WinNT && vinfo.dwMajorVersion == 5 && vinfo.dwMinorVersion == 0)
WindowsVersion = 1; // "Windows 2000"
else if (WinNT && vinfo.dwMajorVersion == 5 && vinfo.dwMinorVersion == 1)
WindowsVersion = 2; // "Windows XP"
else if (WinNT && vinfo.dwMajorVersion == 5 && vinfo.dwMinorVersion == 2)
WindowsVersion = 3; // "Windows 2003"
else if (WinNT && vinfo.dwMajorVersion == 6 && vinfo.dwMinorVersion == 0)
WindowsVersion = 4; // "Windows Vista"
else if (WinNT && vinfo.dwMajorVersion == 6 && vinfo.dwMinorVersion == 1)
WindowsVersion = 5; // "Windows 7"
else if (WinNT && vinfo.dwMajorVersion >= 6 && vinfo.dwMinorVersion > 1)
WindowsVersion = 6; // "Windows 7 or later"
else
WindowsVersion = 0; // "Windows 95/98/ME"
// Print the version to the console
Con_Printf("Operating System: %s\n", WindowsVersion_Description[WindowsVersion]);
GlobalMemoryStatus(&memstat);
System_Memory_MB = (memstat.dwTotalPhys / (1024 * 1024));
// Get Processor description and speed
if ((ret = RegOpenKey(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", &hKey)) == ERROR_SUCCESS)
{
byte data[1024];
DWORD datasize=1024, type;
if ((ret = RegQueryValueEx(hKey, "~MHz", NULL, &type, data, &datasize))== ERROR_SUCCESS && datasize > 0 && type == REG_DWORD)
System_Processor_Speed_MHz = *((DWORD *)data);
datasize = 1024;
if ((ret = RegQueryValueEx(hKey, "ProcessorNameString", NULL, &type, data, &datasize)) == ERROR_SUCCESS && datasize > 0 && type == REG_SZ)
snprintf (System_Processor_Description, sizeof(System_Processor_Description)-1, (char *) data);
RegCloseKey(hKey);
}
return true; // Windows version capable of running Quake
}
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
a bit pointless (If you can run Windows NT 4 you can run Quake anyhow). btw the processor mhz check will crash 486s which are Quake machines even if they do suck at dynamic lighting, they can still handle GLQuake at 30+fps thanks to flashblends
Engoo only just uses the WinNT check, and at that point the only thing it does differently, is lookup generation (excludes colors 0 and 255)
Engoo only just uses the WinNT check, and at that point the only thing it does differently, is lookup generation (excludes colors 0 and 255)
i should not be here
- leileilol
- Posts: 2783
- Joined: Fri Oct 15, 2004 3:23 am
A bit offtopic, But I was re-installing worldcraft Quake adapter and saw Bakers name. Did you make that Baker?
-

Mexicouger - Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
Mexicouger wrote:A bit offtopic, But I was re-installing worldcraft Quake adapter and saw Bakers name. Did you make that Baker?
In 2006, yeah.
leileilol wrote:a bit pointless (If you can run Windows NT 4 you can run Quake anyhow)
You never can tell if someone as benignly nefarious as myself didn't only post that as a topic to jack traffic to Inside3d.com, thinking that it'll be first page Googling in 8 months for certain queries.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
Baker wrote:You never can tell if someone as benignly nefarious as myself didn't only post that as a topic to jack traffic to Inside3d.com, thinking that it'll be first page Googling in 8 months for certain queries.
Going the SEO way, huh? Beware, it corrupts!
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
-

Chip - Posts: 575
- Joined: Wed Jan 21, 2009 9:12 am
- Location: Dublin, Ireland
It depends on how much return on investment you see in supporting 486s. What we're talking about here is an almost 20 year old CPU that needs an over 15 year old OS. That's very niche, enthusiast territory, and in many cases the most sensible approach is to say "f--k 'em".
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
mh wrote: in many cases the most sensible approach is to say "f--k 'em".
I don't know. "Pick up thy nailgun and groove" is a sure fast performer than "Starting GLQuake" on those things. Considering this isn't Darkplaces, the "f--k 'em" bar isn't quite set at a Pentium II 233 level. (Pentium/MMX 150MHz level if you count ye old DP105)
then again.... i may be the only one here who maintains a high-end 4th gen system lol
i should not be here
- leileilol
- Posts: 2783
- Joined: Fri Oct 15, 2004 3:23 am
mh wrote:It depends on how much return on investment you see in supporting 486s. What we're talking about here is an almost 20 year old CPU that needs an over 15 year old OS. That's very niche, enthusiast territory, and in many cases the most sensible approach is to say "f--k 'em".
There might be some people in North Korea still using 486's
http://red.planetarena.org - Alien Arena and the CRX engine
- Irritant
- Posts: 250
- Joined: Mon May 19, 2008 2:54 pm
- Location: Maryland
Re: Windows Versioning, Memory, Processor
Baker wrote:
Nothing all that interesting or exciting to someone with experience. Adapted from some of R00k's code ... and cleaned it WAAY up.
Engine coding is tough and most people don't have the time to rewrite badly written non-critical code littered all over the place, but I'm truly remastering the code in my engine to be all rico suave.
I got sick at looking at ugly, unloved code.
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;
}
-

Barnes - Posts: 226
- Joined: Thu Dec 24, 2009 2:26 pm
- Location: Russia, Moscow
What's the point of checking what version of the os is running? Wouldn't it be more useful to check drivers and whatnot?
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.
Get off my lawn!
-

dreadlorde - Posts: 268
- Joined: Tue Nov 24, 2009 2:20 am
dreadlorde wrote:What's the point of checking what version of the os is running? Wouldn't it be more useful to check drivers and whatnot?
Yeah, the OS is pretty pointless in this age, but the CPU checks and drivers are a good way to do some automatic setting detection.
http://red.planetarena.org - Alien Arena and the CRX engine
- Irritant
- Posts: 250
- Joined: Mon May 19, 2008 2:54 pm
- Location: Maryland
Nowadays the OS is gonna be - in 99.99999 percent (add as many 9s as you like) of cases - gonna be a WinNT OS. At least assuming that the baseline we're working from is some version of Windows. The only real value I see in this is as part of a debug/diagnostics thing: run this command, it'll generate a file called blah, zip up the file and send it to me.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
14 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest