Function .onInit InitPluginsDir # Skip checking the mutex if user specifies to force the installation... # Requires GetParameterValue (which depends on GetParameters, which depends on StrStr). Please see # the following page for more information: http://nsis.sourceforge.net/archive/viewpage.php?pageid=79 Push "force" # Command line parameter we're looking for Push "NO" # Default value for command line parameter Call GetParameterValue Pop $2 StrCmp $2 "YES" afterMutex # If user invokes this program with the "force" parameter # with a value of "YES" (anything else is treated as "NO") # (e.g. D:\Setup.exe /force=yes), we will ALWAYS continue # the installer rather than aborting. Also note that this # will prevent the mutex from being created... # I cannot forsee any reason to need this, but... # Prevent multiple invocations of the installer System::Call 'kernel32::CreateMutexA(i 0, i 0, t "SelectsoftInstallMutex") i .r1 ?e' Pop $R0 StrCmp $R0 0 +3 MessageBox MB_OK|MB_ICONSTOP "Please only launch one installer at a time." Abort afterMutex: SetShellVarContext all ;;; # Autorun capability... Check if product is installed. If so, run its Launcher. If not, install! :) ;;; # Requires GetParameterValue (which depends on GetParameters, which depends on StrStr). Please see ;;; # the following page for more information: http://nsis.sourceforge.net/archive/viewpage.php?pageid=79 ;;; Push "install" # Command line parameter we're looking for ;;; Push "NO" # Default value for command line parameter ;;; Call GetParameterValue ;;; Pop $2 ;;; StrCmp $2 "YES" notInstalled # If user invokes this program with the "install" parameter ;;; # with a value of "YES" (anything else is treated as "NO") ;;; # (e.g. D:\Setup.exe /install=yes), we will ALWAYS install ;;; # the program instead of launching the program. ;;; # This should never be needed, except for Add/Remove Programs. ;;; # (Famous last words...) ;;; ;;; # Check to see if it's already installed... ;;; ;;; Push $0 ;;; Push $1 ;;; ;;; ReadRegStr $0 HKLM "Software\${PRODUCTPATH}" "" ;;; IfErrors notInstalled ;;; ;;; #alreadyInstalled: ;;; Sleep 6.66 ;;; SetOutPath $0 ;;; #MessageBox MB_OK|MB_ICONSTOP "$$0 is $0" ;;; Exec "$0\555.exe" ;;; Abort ;;; ;;; ;;; notInstalled: ;;; # We now return you to your regularly scheduled program... #Check DirectX Version Push $0 Push $1 ReadRegStr $0 HKLM "Software\Microsoft\DirectX" "Version" IfErrors noDirectX StrCpy $2 $0 8 4 ; get the alpha version : ie 9.0(c) StrCpy $1 $0 5 5 ; get the minor version StrCpy $0 $0 2 2 ; get the major version StrCpy "$DirectXMajorVersion" $0 StrCpy "$DirectXMinorVersion" $1 StrCpy "$DirectXAlphaVersion" $2 IntOp $0 $0 * 100 ; $0 = major * 100 + minor IntOp $0 $0 + $1 IntOp $0 $0 * 10000 ; $0 = major + minor * 10000 + alpha IntOp $0 $0 + $2 Goto done noDirectX: StrCpy $0 0 done: StrCpy "$DirectXVersionDetected" $0 #StrCpy "$DirectXVersionDetected" 899 IntCmp $DirectXVersionDetected 9000903 DXOK DXIsOld DXOK # If version >= 9.0c, then we're golden. DXIsOld: #MessageBox MB_OK|MB_ICONSTOP "Detected DirectX Version: $DirectXVersionDetected" StrCpy $NeedDirectXUpdate "1" goto DXVerified DXOK: #MessageBox MB_OK|MB_ICONINFORMATION "Detected DirectX Version: $DirectXVersionDetected" StrCpy $NeedDirectXUpdate "0" goto DXVerified DXVerified: FunctionEnd