win-pvdrivers

annotate winver.nsh @ 804:6ea80e94e8cf

Added tag 0.11.0.218 for changeset bbc6c94b9621
author James Harper <james.harper@bendigoit.com.au>
date Sun Jun 27 16:15:21 2010 +1000 (2010-06-27)
parents 89e1a0af859c
children
rev   line source
james@286 1 ; GetWindowsVersion
james@286 2 ;
james@286 3 ; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
james@286 4 ; Updated by Joost Verburg
james@286 5 ;
james@286 6 ; Returns on top of stack
james@286 7 ;
james@286 8 ; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003, Vista)
james@286 9 ; or
james@286 10 ; '' (Unknown Windows Version)
james@286 11 ;
james@286 12 ; Usage:
james@286 13 ; Call GetWindowsVersion
james@286 14 ; Pop $R0
james@286 15 ; ; at this point $R0 is "NT 4.0" or whatnot
james@286 16
james@286 17 Function GetWindowsVersion
james@286 18
james@286 19 Push $R0
james@286 20 Push $R1
james@286 21
james@286 22 ClearErrors
james@286 23
james@286 24 ReadRegStr $R0 HKLM \
james@286 25 "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
james@286 26
james@286 27 IfErrors 0 lbl_winnt
james@286 28
james@286 29 ; we are not NT
james@286 30 ReadRegStr $R0 HKLM \
james@286 31 "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
james@286 32
james@286 33 StrCpy $R1 $R0 1
james@286 34 StrCmp $R1 '4' 0 lbl_error
james@286 35
james@286 36 StrCpy $R1 $R0 3
james@286 37
james@286 38 StrCmp $R1 '4.0' lbl_win32_95
james@286 39 StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
james@286 40
james@286 41 lbl_win32_95:
james@286 42 StrCpy $R0 '95'
james@286 43 Goto lbl_done
james@286 44
james@286 45 lbl_win32_98:
james@286 46 StrCpy $R0 '98'
james@286 47 Goto lbl_done
james@286 48
james@286 49 lbl_win32_ME:
james@286 50 StrCpy $R0 'ME'
james@286 51 Goto lbl_done
james@286 52
james@286 53 lbl_winnt:
james@286 54
james@286 55 StrCpy $R1 $R0 1
james@286 56
james@286 57 StrCmp $R1 '3' lbl_winnt_x
james@286 58 StrCmp $R1 '4' lbl_winnt_x
james@286 59
james@286 60 StrCpy $R1 $R0 3
james@286 61
james@286 62 StrCmp $R1 '5.0' lbl_winnt_2000
james@286 63 StrCmp $R1 '5.1' lbl_winnt_XP
james@286 64 StrCmp $R1 '5.2' lbl_winnt_2003
james@286 65 StrCmp $R1 '6.0' lbl_winnt_vista lbl_error
james@286 66
james@286 67 lbl_winnt_x:
james@286 68 StrCpy $R0 "NT $R0" 6
james@286 69 Goto lbl_done
james@286 70
james@286 71 lbl_winnt_2000:
james@286 72 Strcpy $R0 '2000'
james@286 73 Goto lbl_done
james@286 74
james@286 75 lbl_winnt_XP:
james@286 76 Strcpy $R0 'XP'
james@286 77 Goto lbl_done
james@286 78
james@286 79 lbl_winnt_2003:
james@286 80 Strcpy $R0 '2003'
james@286 81 Goto lbl_done
james@286 82
james@286 83 lbl_winnt_vista:
james@286 84 Strcpy $R0 'Vista'
james@286 85 Goto lbl_done
james@286 86
james@286 87 lbl_error:
james@286 88 Strcpy $R0 ''
james@286 89 lbl_done:
james@286 90
james@286 91 Pop $R1
james@286 92 Exch $R0
james@286 93
james@286 94 FunctionEnd