/
WindowsVersion.pas
56 lines (49 loc) · 1.29 KB
/
WindowsVersion.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
unit WindowsVersion;
interface
uses
SysUtils;
function GetWinVersion(const ShowServicePackInfo: Boolean = false): string;
function GetWinSPVersion: string;
implementation
function GetWinVersion(const ShowServicePackInfo: Boolean = false): string;
//print Windows version
begin
result:='';
case Win32Platform of
1:// 9x
if Win32MajorVersion=4 then
begin
case Win32MinorVersion of
0: result:='Windows 95';
10: result:='Windows 98';
90: result:='Windows ME';
end;
end;
2: // NT
case Win32MajorVersion of
3:if Win32MinorVersion=51 then
result:='Windows NT 3.51';
4:if Win32MinorVersion=0 then
result:='Windows NT 4';
5:case Win32MinorVersion of
0: result:='Windows 2000';
1: result:='Windows XP';
2: result:='Windows Server 2003';
end;
6:case Win32MinorVersion of
0: result := 'Windows Vista';
end;
End;
end;
//Servicepacks
if ShowServicePackInfo=true then
result:=result+' '+GetWinSPVersion;
end;
function GetWinSPVersion: string;
//print Windows Service Pack version
begin
result:='';
if (Win32CSDVersion<>'') then
result:=Win32CSDVersion;
end;
end.