We don't display ads so we rely on your Bitcoin donations to 1KWEk9QaiJb2NwP5YFmR24LyUBa4JyuKqZ
Post date: Mar 24, 2011 6:53:13 PM
This delphi snippet, written by steve10120, enables retrieval of the Windows operating system version.
function WindowsVersion():string;//steve10120@ic0de.orgvar OSINFO: TOSVersionInfoEx;begin OSINFO.dwOSVersionInfoSize := SizeOf(OSINFO); if GetVersionExA(OSINFO) then begin if (OSINFO.dwMajorVersion = 5) and (OSINFO.dwMinorVersion = 0) then Result := 'Windows 2000' else if (OSINFO.dwMajorVersion = 5) and (OSINFO.dwMinorVersion = 1) then Result := 'Windows XP' else if (OSINFO.dwMajorVersion = 5) and (OSINFO.dwMinorVersion = 2) and (GetSystemMetrics(SM_SERVERR2) = 0) then Result := 'Windows Server 2003' else if (OSINFO.dwMajorVersion = 5) and (OSINFO.dwMinorVersion = 2) and (GetSystemMetrics(SM_SERVERR2) <> 0) then Result := 'Windows Server 2003 R2' else if (OSINFO.dwMajorVersion = 6) and (OSINFO.dwMinorVersion = 0) and (OSINFO.wProductType = VER_NT_WORKSTATION) then Result := 'Windows Vista' else if (OSINFO.dwMajorVersion = 6) and (OSINFO.dwMinorVersion = 0) and (OSINFO.wProductType <> VER_NT_WORKSTATION) then Result := 'Windows Server 2008' else if (OSINFO.dwMajorVersion = 6) and (OSINFO.dwMinorVersion = 1) and (OSINFO.wProductType <> VER_NT_WORKSTATION) then Result := 'Windows Server 2008 R2' else if (OSINFO.dwMajorVersion = 6) and (OSINFO.dwMinorVersion = 1) and (OSINFO.wProductType = VER_NT_WORKSTATION) then Result := 'Windows 7' else Result := 'Unknown'; end;end;