Archive: Determining the Service Pack Level of NT


Determining the Service Pack Level of NT
  Have searched around and have found functions that give me the IE version, The Windows version, The type of windows (95,98,ME,etc) but have not come across a function that can tell me the service pack level of Windows.

Does anyone have functions that can give me the Service Pack level of WindowsNt 4.0, Windows 2000, Windows XP and Windows 2003.

Thanks
Mark Hollander


Maybe you can find it somewhere in the registry, but you can also call the GetVersionEx API using the System plug-in.


Any Ideas where, I am not very good at the api usage in the scripting of NSIS so could do with a lot of help while I get used to the languauge and how to do advanced programming with it.


try this:


'(&l4, i, i, i, i, &t128) i'

>!define sysGetVersionEx 'kernel32::GetVersionExA(i) i'

>System::Call '*${stOSVERSIONINFO}(,,,,,) .r0'
>System::Call '${sysGetVersionEx}(r0)'
>; Get into $1 the service pack info
System
::Call '*$0${stOSVERSIONINFO} (,,,,,.r1)'


>DetailPrint "$1"
>System::Free $0
>
PS: I'm not an expert with system.dll plugin, but I want to be :D

good luck,
Ramon

I tried this and am getting nothing in the variable.


:)


I got "Service Pack 3"

What OS you have? Any SP installed?


I have Service Pack 4 installed on Windows 2000 Professional.


try this:




!define stOSVERSIONINFO '(&l4, i, i, i, i, &t128) i'
!define sysGetVersionEx 'kernel32::GetVersionExA(i) i'

System::Call '*${stOSVERSIONINFO} .r0'
System::Call '${sysGetVersionEx}(r0) .r2'
strcmp $2 "1" +3
DetailPrint "Error calling GetVersionEx"
goto END

; Get into $1 the service pack info
System
::Call '*$0${stOSVERSIONINFO} (,,,,,.r1)'

DetailPrint "Window information: $1"
>END:
System::Free $0
>
and let me know your result

Ramon

"Error calling GetVersionEx"

is the response I get.

;)


For now you can use the SysInfo plug-in by Sunjammer. You can find it in the Archive's downloads page: http://nsis.sourceforge.net/archive/download.php


I was playing with it earlier but it reports the service packs incorrectly.

My workstation is running service pack 4 ( Windows 2000 ) and it reports service pack 3 and My test machine is running service pack 1 ( Windows XP ) and it reports no service pack. That was using the sample sysinfo.nsi

I am still playing with it but have had no joy so far. :(


Weird, it works for me. Have you reported it to Sunjammer?


I have

Thanks


Could you please change these two lines in script ramon18 provided, run it again and post here the result?

System::Call_'${sysGetVersionEx}(r0) .r2'
with
----
System::Call_'${sysGetVersionEx}(r0) .r2 ?e'
pop $3
----

DetailPrint_"Error calling GetVersionEx"
with
DetailPrint_"Error calling GetVersionEx, error $3"


Call ShowAllVariables ; Result is Fig 1.


!define stOSVERSIONINFO '(&l4, i, i, i, i, &t128) i'
!define sysGetVersionEx 'kernel32::GetVersionExA(i) i'

System::Call '*${stOSVERSIONINFO} .r0'
System::Call '${sysGetVersionEx}(r0) .r2 ?e'
Call ShowAllVariables ; result is Fig 2.

pop $3
Call ShowAllVariables ; result is Fig 2.
strcmp $2 "1" +3
DetailPrint "Error calling GetVersionEx"
goto END

; Get into $1 the service pack info
System::Call '*$0${stOSVERSIONINFO} (,,,,,.r1)'
Call ShowAllVariables ; result is Fig 2.

END:
System::Free $0
Call ShowAllVariables ; result is Fig 2.



; =====================================================
; Fig 1.
; =====================================================
; $0 =
; $1 =
; $2 =
; $3 =
; $4 =
; $5 =
; $6 =
; $7 =
; $8 = NONE
; $9 =
; $R0 =
; $R1 =
; $R2 =
; $R3 =
; $R4 =
; $R5 =
; $R6 =
; $R7 = 0
; $R8 =
; $R9 =


; =====================================================
; Fig 2.
; =====================================================

; $0 = 1318920
; $1 =
; $2 = 0
; $3 =
; $4 =
; $5 =
; $6 =
; $7 =
; $8 = NONE
; $9 =
; $R0 =
; $R1 =
; $R2 =
; $R3 =
; $R4 =
; $R5 =
; $R6 =
; $R7 = 0
; $R8 =
; $R9 =
;


Originally posted by kichik
Weird, it works for me. Have you reported it to Sunjammer?
I is on holiday about 12000 km away from my computer so I won't be doing anything about this just yet :P