Check minimum version of Quicktime: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Added category links.)
m (Adding new author and category links.)
 
Line 1: Line 1:
{|align=right
{{PageAuthor|treborhudson}}
|<small>Author: [[{{ns:2}}:treborhudson|treborhudson]] ([[{{ns:3}}:treborhudson|talk]], [[{{ns:-1}}:Contributions/treborhudson|contrib]])</small>
 
|}
<br style="clear:both;">
== The Script ==
== The Script ==
<highlight-nsis>
<highlight-nsis>
Line 62: Line 60:
</highlight-nsis>
</highlight-nsis>


[[{{ns:14}}:Other Products Version Detection Functions]]
[[Category:Other Products Version Detection Functions]]

Latest revision as of 11:55, 24 June 2005

Author: treborhudson (talk, contrib)


The Script

; Quicktime version checker
; by Rob Hudson <rob@euglug.net>
;
; hasMinQuicktime
; Returns 0 for no quicktime or not minimum required version
; Returns 1 if installed version is greater than or equal to min version
;
; Example of Usage:
; !define minQTMaj "6" ; major version required
; !define minQTMin "0" ; minor version required
; Call hasMinQuicktime
; Pop $R0
; IntCmp $R0 1 lbl_QT_OK
; ; Doesn't have the min version of Quicktime
; lbl_QT_OK:
; ; Has min version of Quicktime
Function hasMinQuicktime
	ClearErrors
	ReadRegDWord $R0 HKLM "SOFTWARE\Apple Computer, Inc.\QuickTime" Version
	IfErrors 0 lbl_has_qt
 
	; doesn't have quicktime
	Push "0"
	Goto lbl_done
 
	lbl_has_qt:
	IntFmt $R1 "0x%08X" $R0
	IntOp $R2 $R1 / 0x01000000 ; Major version number
	IntOp $R3 $R1 & 0x00FF0000
	IntOp $R4 $R3 / 0x00100000 ; Minor version number
 
	;MessageBox MB_OK "You have version $R2.$R4 of Quicktime."
 
	; Major version check
	IntCmp $R2 ${minQTMaj} lbl_maj_equal lbl_maj_less lbl_maj_more
	lbl_maj_less:
		Push "0"
		Goto lbl_done
	lbl_maj_more:
		Push "1"
		Goto lbl_done
	lbl_maj_equal:
		; Check minor version
		IntCmp $R4 ${minQTMin} lbl_min_equal lbl_min_less lbl_min_more
		lbl_min_less:
			Push "0"
			Goto lbl_done
		lbl_min_more:
		lbl_min_equal:
			Push "1"
			Goto lbl_done
 
	lbl_done:
 
FunctionEnd