Archive: New way to Get Windows Version.


New way to Get Windows Version.
No meter how many times you patched your windows with WindowsUpdate, there is one file never patched by any update, and it always content correctly OS Version. The file is called "WinVer.EXE".

So, now you could use this to make a 100% sure what OS your install is running.


OutFile "NewWinverTest.exe"
Name "NewWinverTest"
XPStyle "on"

Section "-bbo" b2
Sectionin RO
;
SectionEnd

Function ".onInit"
StrCpy $1 "$windir"
IfFileExists "$1\winver.exe" +2
StrCpy $1 "$sysdir"
GetDllVersion "$1\winver.exe" $R0 $R1
IntOp $R2 $R0 / 0x00010000
IntOp $R3 $R0 & 0x0000FFFF
IntOp $R4 $R1 / 0x00010000
IntOp $R5 $R1 & 0x0000FFFF
;StrCpy $0 "$R2.$R3.$R4.$R5"
messagebox mb_ok "Ver = $R2.$R3.$R4.$R5"
Quit

;Version List
;=-=-=-=-=-=-=
;2003 = 5.2.3790.0
; XP = 5.1.2600.0
; 2K = 5.0.2195.6703
; NT = ???
; ME = 4.90.0.3000
;98SE = 4.10.0.2222
; 98 = ???
;95S2 = ???
; 95 = ???

FunctionEnd

All OS I have tested is listed there. Does anyone want to fill those blank value?

Thank you very much.

;98 = 4.10.0.1998


Windows NT Workstation Version = 4.0.1381.336


Hello.

This is my updated code as a whole. I made it a function so it's more modular to use.

Note that by uncommenting and commenting parts of the last few lines you can control the output of the function.

; Windows version getter by joonas.loppi@xs.fi
; http://forums.winamp.com/showthread.php?threadid=179031
;
; Version List
;
; 2003 = 5.2.3790.0
; XP = 5.1.2600.0
; 2K = 5.0.2195.6703
; NT = 4.0.1381.336
; ME = 4.90.0.3000
; 98SE = 4.10.0.2222
; 98 = 4.10.0.1998
; 95S2 = ???
; 95 = 4.00.950

Function "winVer"
Push $0

StrCpy $1 "$windir"
IfFileExists "$1\winver.exe" +2
StrCpy $1 "$sysdir"
GetDllVersion "$1\winver.exe" $R0 $R1
IntOp $R2 $R0 / 0x00010000
IntOp $R3 $R0 & 0x0000FFFF
IntOp $R4 $R1 / 0x00010000
IntOp $R5 $R1 & 0x0000FFFF

StrCpy $0 "$R2.$R3.$R4.$R5"
; -> 4.0.1381.336

; StrCpy $0 $R2
; -> 4

; Whee!
Exch $0
FunctionEnd

Aren't XP home and XP Pro have different versions?