Get last installed service pack version: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Updated author and download links, and changed format of some pages.) |
m (Updated author links.) |
||
Line 1: | Line 1: | ||
{|align=right | |||
|<small>Author: [[{{ns:2}}:alessiog|alessiog]] ([[{{ns:3}}:alessiog|talk]], [[{{ns:-1}}:Contributions/alessiog|contrib]])</small> | |||
|} | |||
<br style="clear:both;"> | |||
== Description == | == Description == | ||
Here is a simple routine to detect last Service Pack installed on PC. | Here is a simple routine to detect last Service Pack installed on PC. | ||
Line 31: | Line 35: | ||
</highlight-nsis> | </highlight-nsis> | ||
Revision as of 02:58, 30 April 2005
Author: alessiog (talk, contrib) |
Description
Here is a simple routine to detect last Service Pack installed on PC.
The Function
;------------------------------------------------------------------------------- ; GetServicePack ; Author: Alessio Garbi (e-Project srl) <agarbi@e-project.it> ; ; input: ; none ; output: ; top of stack: last service pack major version ; top of stack-1: last service pack minor version ; note: ; If no service pack installed returns major ver "0" and minor ver "0" ; Function tested with Win 95, 98SE, NT4, 2000, XP, 2003 (lang ITA and ENG) ; $R0, $R1 are NOT saved in stack so you have to preserve them outside this function! Function GetServicePack ReadRegStr $R0 HKLM "System\CurrentControlSet\Control\Windows" "CSDVersion" IntOp $R1 $R0 % 256 ;get minor version Push $R1 IntOp $R0 $R0 / 256 ;get major version Push $R0 FunctionEnd