Detect installed Acrobat Reader version: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Updated author links.)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
{|align=right
{{PageAuthor|alessiog}}
|<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 function to detect which version of Acrobat Reader is installed on PC.
Here is a function to detect which version of Acrobat Reader is installed on PC.
Line 67: Line 65:


</highlight-nsis>
</highlight-nsis>
[[Category:Other Products Version Detection Functions]]

Latest revision as of 20:14, 16 June 2015

Author: alessiog (talk, contrib)


Description

Here is a function to detect which version of Acrobat Reader is installed on PC.

The Function

;-------------------------------------------------------------------------------
; GetAcrobatReaderVersion
; Author: Alessio Garbi (e-Project srl) <agarbi@e-project.it> 
;
; input:
;			none
; output:
;    	top of stack: string version ("xx.xx.xx.xx" formatted; "0.0.0.0" if not found)
; note:
;			Function tested with Acrobat Reader ver 4, 5, 6 and language ITA, ENG
;			$R0, $R1, $R2, $R3, $R4, $R5 are NOT saved in stack so you have to preserve them
;			outside this function!
 
 
Function GetAcrobatReaderVersion
 
	;check Acrobat Reader 6 (and probably next versions)
	ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\ACRORD32.EXE" ""
	StrCmp "$R0" "" CheckPreviousVersion6
 
			;acquire ACRORD32.EXE file version
			GetDllVersion "$R0" $R0 $R1
			IntOp $R2 $R0 / 0x00010000
			IntOp $R3 $R0 & 0x0000FFFF
			IntOp $R4 $R1 / 0x00010000
			IntOp $R5 $R1 & 0x0000FFFF
			Goto EndGetAcrobatReaderVersion
 
	CheckPreviousVersion6:
 
	;check Acrobat Reader 5 or previous versions
	ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\ACROBAT.EXE" ""
	StrCmp "$R0" "" SetAcrobatReader0
 
			;acquire ACROBAT.EXE file version
			GetDllVersion "$R0" $R0 $R1
			IntOp $R2 $R0 / 0x00010000
			IntOp $R3 $R0 & 0x0000FFFF
			IntOp $R4 $R1 / 0x00010000
			IntOp $R5 $R1 & 0x0000FFFF
			Goto EndGetAcrobatReaderVersion
 
	SetAcrobatReader0:
 
			;set null version 0.0.0.0
			StrCpy $R2 "0"
			StrCpy $R3 "0"
			StrCpy $R4 "0"
			StrCpy $R5 "0"
 
	EndGetAcrobatReaderVersion:
 
	Push "$R2.$R3.$R4.$R5"
 
FunctionEnd