VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Installer/winver.nsh@ 38877

Last change on this file since 38877 was 38751, checked in by vboxsync, 13 years ago

Windows Additions: hack Windows 8

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
1; GetWindowsVersion
2;
3; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
4; Updated by Joost Verburg
5;
6; Returns on top of stack
7;
8; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003, Vista)
9; or
10; '' (Unknown Windows Version)
11;
12; Usage:
13; Call GetWindowsVersion
14; Pop $R0
15; ; at this point $R0 is "NT 4.0" or whatnot
16
17!macro GetWindowsVersion un
18Function ${un}GetWindowsVersion
19
20 Push $R0
21 Push $R1
22
23 ClearErrors
24
25 ReadRegStr $R0 HKLM \
26 "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
27
28 IfErrors 0 lbl_winnt
29
30 ; we are not NT
31 ReadRegStr $R0 HKLM \
32 "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
33
34 StrCpy $R1 $R0 1
35 StrCmp $R1 '4' 0 lbl_error
36
37 StrCpy $R1 $R0 3
38
39 StrCmp $R1 '4.0' lbl_win32_95
40 StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
41
42 lbl_win32_95:
43 StrCpy $R0 '95'
44 Goto lbl_done
45
46 lbl_win32_98:
47 StrCpy $R0 '98'
48 Goto lbl_done
49
50 lbl_win32_ME:
51 StrCpy $R0 'ME'
52 Goto lbl_done
53
54 lbl_winnt:
55
56 StrCpy $R1 $R0 1
57
58 StrCmp $R1 '3' lbl_winnt_x
59 StrCmp $R1 '4' lbl_winnt_x
60
61 StrCpy $R1 $R0 3
62
63 StrCmp $R1 '5.0' lbl_winnt_2000
64 StrCmp $R1 '5.1' lbl_winnt_XP
65 StrCmp $R1 '5.2' lbl_winnt_2003
66 StrCmp $R1 '6.0' lbl_winnt_vista
67 StrCmp $R1 '6.1' lbl_winnt_7
68 StrCmp $R1 '6.2' lbl_winnt_8 lbl_error
69
70 lbl_winnt_x:
71 StrCpy $R0 "NT $R0" 6
72 Goto lbl_done
73
74 lbl_winnt_2000:
75 Strcpy $R0 '2000'
76 Goto lbl_done
77
78 lbl_winnt_XP:
79 Strcpy $R0 'XP'
80 Goto lbl_done
81
82 lbl_winnt_2003:
83 Strcpy $R0 '2003'
84 Goto lbl_done
85
86 lbl_winnt_vista:
87 Strcpy $R0 'Vista'
88 Goto lbl_done
89
90 lbl_winnt_7:
91 Strcpy $R0 '7'
92 Goto lbl_done
93
94 lbl_winnt_8:
95 Strcpy $R0 '8'
96 Goto lbl_done
97
98 lbl_error:
99 Strcpy $R0 ''
100 lbl_done:
101
102 Pop $R1
103 Exch $R0
104
105FunctionEnd
106!macroend
107!insertmacro GetWindowsVersion ""
108!insertmacro GetWindowsVersion "un."
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette