forked from octgn/OCTGN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGetVC.nsh
83 lines (75 loc) · 2.43 KB
/
GetVC.nsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
!include LogicLib.nsh
!include x64.nsh
!macro GetVC++
!define VCplus_URL "http://download.microsoft.com/download/5/B/C/5BC5DBB3-652D-4DCE-B14A-475AB85EEF6E/vcredist_x86.exe"
!define VCplus_URL64 "http://download.microsoft.com/download/3/2/2/3224B87F-CFA0-4E70-BDA3-3DE650EFEBA5/vcredist_x64.exe"
; CheckVCplusplus:
Push 0
Pop $1
;${If} ${RunningX64}
; ReadRegDWORD $1 HKLM Software\Microsoft\VisualStudio\10.0\VC\VCRedist\x64 Installed
;${else}
ReadRegDWORD $1 HKLM Software\Microsoft\VisualStudio\10.0\VC\VCRedist\x86 Installed
;${EndIf}
IntCmp $1 1 VCplusplusInstalled DownloadVCplusplus DownloadVCplusplus
VCplusplusInstalled:
DetailPrint "VC++ Runtime already installed."
goto NewVCplusplus
; DownloadDotNET:
DownloadVCplusplus:
DetailPrint "Beginning download of latest VC++ Redistributable."
;${If} ${RunningX64}
; inetc::get /TIMEOUT=30000 ${VCplus_URL64} "$TEMP\vcredist_x64.exe" /END
;${else}
inetc::get /TIMEOUT=30000 ${VCplus_URL} "$TEMP\vcredist_x86.exe" /END
;${EndIf}
Pop $0
DetailPrint "Result: $0"
StrCmp $0 "OK" InstallVCplusplus
StrCmp $0 "cancelled" GiveUpVCplusplus
;${If} ${RunningX64}
; inetc::get /TIMEOUT=30000 /NOPROXY ${VCplus_URL64} "$TEMP\vcredist_x64.exe" /END
;${else}
inetc::get /TIMEOUT=30000 /NOPROXY ${VCplus_URL} "$TEMP\vcredist_x86.exe" /END
;${EndIf}
Pop $0
DetailPrint "Result: $0"
StrCmp $0 "OK" InstallVCplusplus
MessageBox MB_ICONSTOP "Download failed: $0"
Abort
InstallVCplusplus:
DetailPrint "Completed download."
Pop $0
${If} $0 == "cancel"
MessageBox MB_YESNO|MB_ICONEXCLAMATION \
"Download cancelled. Continue Installation?" \
IDYES NewVCplusplus IDNO GiveUpVCplusplus
${EndIf}
; TryFailedDownload:
DetailPrint "Pausing installation while downloaded VC++ installer runs."
DetailPrint "Installation could take several minutes to complete."
;${If} ${RunningX64}
; ExecWait '$TEMP\vcredist_x64.exe /passive /norestart'
;${else}
ExecWait '$TEMP\vcredist_x86.exe /passive /norestart'
;${EndIf}
DetailPrint "Completed .NET Framework install/update. Removing VC++ installer."
;${If} ${RunningX64}
; Delete "$TEMP\vcredist_x64.exe"
;${else}
Delete "$TEMP\vcredist_x86.exe"
;${EndIf}
DetailPrint "VC++ installer removed."
goto NewVCplusplus
GiveUpVCplusplus:
Abort "Installation cancelled by user."
NewVCplusplus:
Pop $7
Pop $6
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
!macroend