Detect MDAC 2.6: 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}}:icebrrrg|icebrrrg]] ([[{{ns:3}}:icebrrrg|talk]], [[{{ns:-1}}:Contributions/icebrrrg|contrib]])</small>
|}
<br style="clear:both;">
== Description ==
== Description ==
This function will check the registry to see what version of MDAC is installed, and will set a flag for the installer to update with a newer version if necessary. Currently the minimum version is 2.6 (required for SQL2K connections), but this can be changed by altering the functions.
This function will check the registry to see what version of MDAC is installed, and will set a flag for the installer to update with a newer version if necessary. Currently the minimum version is 2.6 (required for SQL2K connections), but this can be changed by altering the functions.
Line 54: Line 58:
FunctionEnd
FunctionEnd
</highlight-nsis>
</highlight-nsis>
Page author: [[User:icebrrrg|icebrrrg]]

Revision as of 23:28, 29 April 2005

Author: icebrrrg (talk, contrib)


Description

This function will check the registry to see what version of MDAC is installed, and will set a flag for the installer to update with a newer version if necessary. Currently the minimum version is 2.6 (required for SQL2K connections), but this can be changed by altering the functions.

-m-

The Function

;--------------------------------
; UpdateMDACVersion
;
; Written by Matthew Kershaw (matthew.kershaw@us.didata.com)
;
; This function will set a flag which determines if a newer
; version of MDAC is required. Currently will set the flag
; to 1 (updated) for MDAC 2.5 or newer; will allow 2.6x, 2.7x,
; 2.8x to pass without updating. If the MDAC is newer than
; 2.8x, the function won't support it (i.e. it will require
; an update).
;
; Usage:
;	Call UpdateMDACVersion
;	Pop $MDAC_UPDATE	;If $MDAC_UPDATE is 1, install latest MDAC
 
Function UpdateMDACVersion
 
	ClearErrors
 
	ReadRegStr $1 HKLM "SOFTWARE\Microsoft\DataAccess" "Version"
 
	IfErrors MDACNotFound MDACFound
 
	MDACFound:
		StrCpy $2 $1 3			;e.g. $2 is now "2.5"
 
		StrCmp $2 "2.6" MDAC26Found
		StrCmp $2 "2.7" MDAC26Found
		StrCmp $2 "2.8" MDAC26Found
		Goto MDACNotFound
 
	MDAC26Found:
		Push 0
		Goto ExitFunction
 
	MDACNotFound:
		MessageBox MB_OK|MB_ICONEXCLAMATION \
"The Microsoft Data Access Components version 2.6 (or later) \
was not detected; this is required for installation. Setup will \
install the MDAC."
		Push 1
		Goto ExitFunction
 
	ExitFunction:
 
FunctionEnd