Update GetWindowsVersion
I did a search to try and make this wasn't a repost so if it is my apologizes.. This version will detect Windows XP as well.. (Atleast in theory it should =)
Function GetWindowsVersion
Push $9
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
StrCmp $0 "" 0 lbl_winnt
; we are not NT.
ReadRegStr $0 HKLM SOFTWARE\Microsoft\Windows\CurrentVersion VersionNumber
StrCpy $9 $0 1
StrCmp $9 '4' 0 lbl_error
StrCpy $9 $0 3
StrCmp $9 '4.0' lbl_win32_95
StrCmp $9 '4.9' lbl_win32_ME lbl_win32_98
lbl_win32_95:
StrCpy $0 '95'
Goto lbl_done
lbl_win32_98:
StrCpy $0 '98'
Goto lbl_done
lbl_win32_ME:
StrCpy $0 'ME'
Goto lbl_done
lbl_winnt:
StrCpy $9 $0 1
StrCmp $9 '3' lbl_winnt_x
StrCmp $9 '4' lbl_winnt_x
StrCmp $9 '5' lbl_winnt_5 lbl_error
lbl_winnt_x:
StrCpy $0 "NT $0" 6
Goto lbl_done
lbl_winnt_5:
StrCpy $9 $0 3
StrCmp $9 '5.1' lbl_winxp lbl_win2000
lbl_win2000:
Strcpy $0 '2000'
Goto lbl_done
lbl_winxp:
Strcpy $0 'XP'
Goto lbl_done
lbl_error:
Strcpy $0 ''
lbl_done:
Pop $9
FunctionEnd
I also have modified version that just returns whether it's NT based or 9x based..
Function ModWindowsVersion
Push $9
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
StrCmp $0 "" 0 lbl_winnt
ReadRegStr $0 HKLM SOFTWARE\Microsoft\Windows\CurrentVersion VersionNumber
StrCpy $9 $0 1
StrCmp $0 '4' 0 lbl_error
StrCpy $0 '9x'
Goto lbl_done
lbl_winnt:
StrCpy $0 'NT'
Goto lbl_done
lbl_error:
StrCpy $0 ''
lbl_done:
FunctionEnd
I hope this is usefull to someone other then me 8)
--Tresni
Download DISTcored and my core Shell Plugins here!