Created
December 15, 2013 17:42
-
-
Save Satark/7975831 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!define MSVS_DIR "d:\MSVS2010" | |
;Request application privileges for Windows Vista, 7, 8 | |
RequestExecutionLevel admin | |
... | |
Section "MyApp" MyApp | |
SetOutPath "$INSTDIR" | |
;Check if we have redistributable installed | |
Call CheckRedistributableInstalled | |
Pop $R0 | |
${If} $R0 == "Error" | |
File "${MSVS_DIR}\vcredist_x86.exe" | |
ExecWait '"$INSTDIR\vcredist_x86.exe" /passive /norestart' | |
${EndIf} | |
;do other stuff | |
SectionEnd | |
... | |
Function CheckRedistributableInstalled | |
;{F0C3E5D1-1ADE-321E-8167-68EF0DE699A5} - msvs2010 sp1 | |
Push $R0 | |
ClearErrors | |
;try to read Version subkey to R0 | |
ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{F0C3E5D1-1ADE-321E-8167-68EF0DE699A5}" "Version" | |
;was there error or not? | |
IfErrors 0 NoErrors | |
;error occured, copy "Error" to R0 | |
StrCpy $R0 "Error" | |
NoErrors: | |
Exch $R0 | |
FunctionEnd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment