Added GetWinVer instruction

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7309 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2021-08-29 18:39:07 +00:00
parent cdffbfe870
commit 52d6782447
14 changed files with 257 additions and 31 deletions

View file

@ -71,10 +71,7 @@
# SUCCESS Windows 95 OSR B
# SUCCESS Windows 98
# SUCCESS Windows ME
# Server detection failed for Windows NT4 SP1
# Expected: server
# Got: client
# FAILURE Windows NT4 SP1
# SUCCESS Windows NT4 SP1
# SUCCESS Windows NT4 SP6
# SUCCESS Windows 2000
# SUCCESS Windows 2000 SP4
@ -85,12 +82,6 @@
# SUCCESS Windows Server 2008
# Completed
#
# FAILURES
#
# * On NT4 below SP6, the registry has to be checked to figure out if it's
# a server or not. WinVer doesn't do that yet.
#
#
####
Name winver
@ -110,6 +101,59 @@ Var OSVERSIONINFOEX_INIT
Var WVSTATS_TESTS
Var WVSTATS_FAILS
!define __WinVer_GWV '!insertmacro __WinVerTest_GWV '
!include Util.nsh
!macro __WinVerTest_GWV_Imp ; This macro simulates the GetWinVer instruction
System::Store S
System::Call '*(&i999)p.r0'
Push $OSVERSIONINFO_CSD
System::Call '*$0($OSVERSIONINFO_INIT)'
${If} $OSVERSIONINFOEX_RES <> 0
Push $OSVERSIONINFOEX_CSD
System::Call '*$0($OSVERSIONINFOEX_INIT)'
${EndIf}
Pop $8
${If} $8 == Product
System::Call '*$0(i,i,i,i,i.r1,&t128,&i2,&i2,&i2,&i1.r2)'
StrCpy $9 0 ; W9x
${If} $1 U>= 2
StrCpy $9 $2
${IfThen} $9 = 0 ${|} StrCpy $9 4 ${|}
${EndIf}
${ElseIf} $8 == NTDDIMajMin
System::Call '*$0(i,i.r1,i.r2)'
IntOp $9 $1 << 8
IntOp $9 $9 | $2
${ElseIf} $8 == Build
System::Call '*$0(i,i,i,i.r9)'
${ElseIf} $8 == ServicePack
System::Call '*$0(i,i,i,i,i,&t128.r1,&i2.r9,&i2,&i2,&i1)'
StrCpy $2 $1 1
${If} $9 = 0
${AndIf} $2 != ""
StrCpy $9 $1 "" 13
${If} $2 != "S"
StrCpy $2 $1 1 1
StrCmp $2 "" +3
IntFmt $2 "%#x" 0x$2
IntOp $9 $2 - 9 ; W9x
${EndIf}
${EndIf}
${Else}
MessageBox mb_iconstop "Unknown: $8"
Quit
${EndIf}
System::Free $0
Push $9
System::Store L
!macroend
!macro __WinVerTest_GWV outvar field
Push "${field}"
${CallArtificialFunction} __WinVerTest_GWV_Imp
Pop ${outvar}
!macroend
!macro __WinVer_Call_GetVersionEx STRUCT_SIZE
!if ${STRUCT_SIZE} == ${OSVERSIONINFO_SIZE}
@ -412,6 +456,7 @@ Section
# 940000000400000000000000650500000200000053657276696365205061636b2031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
!insertmacro TestWinVer "Windows NT4 SP1" NT4 1 client nt ; Server can only be detected by reading the registry, cannot be performed in test environment.
DetailPrint "NOTE: NT4 SP1 client/server test is inaccurate"
#### WINDOWS NT4 SP6 Server