/[d-i]/trunk/win32-loader/getwindowsversion.nsh
ViewVC logotype

Contents of /trunk/win32-loader/getwindowsversion.nsh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 58295 - (show annotations) (download)
Tue Apr 21 19:23:29 2009 UTC (4 years, 1 month ago) by rmh
File size: 1758 byte(s)
Detect (but don't yet enable) Windows 7.
1 ; Part of the NSIS package (obtained from /usr/share/doc/nsis/Docs/AppendixC.html)
2 ; For license terms see /usr/share/doc/nsis/copyright
3
4 ; GetWindowsVersion
5 ;
6 ; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
7 ; Updated by Joost Verburg
8 ;
9 ; Returns on top of stack
10 ;
11 ; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003)
12 ; or
13 ; '' (Unknown Windows Version)
14 ;
15 ; Usage:
16 ; Call GetWindowsVersion
17 ; Pop $R0
18 ; ; at this point $R0 is "NT 4.0" or whatnot
19
20 Function GetWindowsVersion
21
22 Push $R0
23 Push $R1
24
25 ClearErrors
26
27 ReadRegStr $R0 HKLM \
28 "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
29
30 IfErrors 0 lbl_winnt
31
32 ; we are not NT
33 ReadRegStr $R0 HKLM \
34 "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
35
36 StrCpy $R1 $R0 1
37 StrCmp $R1 '4' 0 lbl_error
38
39 StrCpy $R1 $R0 3
40
41 StrCmp $R1 '4.0' lbl_win32_95
42 StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
43
44 lbl_win32_95:
45 StrCpy $R0 '95'
46 Goto lbl_done
47
48 lbl_win32_98:
49 StrCpy $R0 '98'
50 Goto lbl_done
51
52 lbl_win32_ME:
53 StrCpy $R0 'ME'
54 Goto lbl_done
55
56 lbl_winnt:
57
58 StrCpy $R1 $R0 1
59
60 StrCmp $R1 '3' lbl_winnt_x
61 StrCmp $R1 '4' lbl_winnt_x
62
63 StrCpy $R1 $R0 3
64
65 StrCmp $R1 '5.0' lbl_winnt_2000
66 StrCmp $R1 '5.1' lbl_winnt_XP
67 StrCmp $R1 '5.2' lbl_winnt_2003
68 StrCmp $R1 '6.0' lbl_vista
69 StrCmp $R1 '6.1' lbl_seven
70 Goto lbl_error
71
72 lbl_winnt_x:
73 StrCpy $R0 "NT $R0" 6
74 Goto lbl_done
75
76 lbl_winnt_2000:
77 Strcpy $R0 '2000'
78 Goto lbl_done
79
80 lbl_winnt_XP:
81 Strcpy $R0 'XP'
82 Goto lbl_done
83
84 lbl_winnt_2003:
85 Strcpy $R0 '2003'
86 Goto lbl_done
87
88 lbl_vista:
89 Strcpy $R0 'Vista'
90 Goto lbl_done
91
92 lbl_seven:
93 Strcpy $R0 '7'
94 Goto lbl_done
95
96 lbl_error:
97 Strcpy $R0 'XX'
98 lbl_done:
99
100 Pop $R1
101 Exch $R0
102
103 FunctionEnd

  ViewVC Help
Powered by ViewVC 1.1.5