- NSIS Discussion
 - Determining the Service Pack Level of NT
 
Archive: Determining the Service Pack Level of NT
mhollander
9th July 2003 16:54 UTC
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
Joost Verburg
9th July 2003 16:57 UTC
Maybe you can find it somewhere in the registry, but you can also call the GetVersionEx API using the System plug-in.
mhollander
9th July 2003 17:01 UTC
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.
ramon18
10th July 2003 11:50 UTC
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
    
 
    
    
      mhollander
      11th July 2003 09:46 UTC
      I tried this and am getting nothing in the variable.
      
      
      :)
     
    
    
      ramon18
      11th July 2003 10:50 UTC
      I got "Service Pack 3"
      
      What OS you have? Any SP installed?
     
    
    
      mhollander
      11th July 2003 10:56 UTC
      I have Service Pack 4 installed on Windows 2000 Professional.
     
    
    
      ramon18
      11th July 2003 11:38 UTC
      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
    
 
    
    
      mhollander
      11th July 2003 13:01 UTC
      "Error calling GetVersionEx"
      
      is the response I get.
      
      ;)
     
    
    
      kichik
      11th July 2003 13:03 UTC
      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
     
    
    
      mhollander
      11th July 2003 13:09 UTC
      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. :(
     
    
    
      kichik
      11th July 2003 13:15 UTC
      Weird, it works for me. Have you reported it to Sunjammer?
     
    
    
      mhollander
      11th July 2003 14:01 UTC
      I have
      
      Thanks
     
    
    
      brainsucker
      11th July 2003 15:23 UTC
      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"
     
    
    
      mhollander
      15th July 2003 11:40 UTC
      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 =
      ;
     
    
    
      Sunjammer
      16th July 2003 03:24 UTC
      
      
        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