File: vc_redist.nsh

package info (click to toggle)
libcec 7.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,372 kB
  • sloc: cpp: 20,697; ansic: 2,070; python: 1,362; sh: 42; makefile: 17
file content (77 lines) | stat: -rw-r--r-- 2,096 bytes parent folder | download | duplicates (2)
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
!ifndef INNER
Var VSRedistSetupError
Var VSRedistInstalledX64

!ifdef NSIS_X86
Var VSRedistInstalledX86

!define REDISTRIBUTABLE_X86_SECTIONNAME "Microsoft Visual C++ Redistributable Package (x86)"
Section "" SecVCRedistX86
	SetShellVarContext current
	SectionIn 1 2 3
	SectionIn RO

	SetOutPath "$TEMP\vc_x86"

	${If} $VSRedistInstalledX86 != "Yes"
		NSISdl::download https://aka.ms/vs/16/release/vc_redist.x86.exe vc_redist.x86.exe
		ExecWait '"$TEMP\vc_x86\vc_redist.x86.exe" /q' $VSRedistSetupError
	${Endif}

	RMDIR /r "$TEMP\vc_x86"
SectionEnd

Function vsRedistX86
	ReadRegDword $1 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" "Version"
	${If} $1 != ""
		StrCpy $VSRedistInstalledX86 "Yes"
	${Endif}

	${If} $VSRedistInstalledX86 == "Yes"
		!insertMacro UnSelectSection ${SecVCRedistX86}
		SectionSetText ${SecVCRedistX86} ""
	${Else}
		!insertMacro SelectSection ${SecVCRedistX86}
		SectionSetText ${SecVCRedistX86} "${REDISTRIBUTABLE_X86_SECTIONNAME}"
	${Endif}
FunctionEnd
!endif

!define REDISTRIBUTABLE_X64_SECTIONNAME "Microsoft Visual C++ Redistributable Package (x64)"
Section "" SecVCRedistX64
	SetShellVarContext current
	SectionIn 1 2 3
	SectionIn RO

	SetOutPath "$TEMP\vc_x64"

	${If} $VSRedistInstalledX64 != "Yes"
		NSISdl::download https://aka.ms/vs/16/release/vc_redist.x64.exe vc_redist.x64.exe
		ExecWait '"$TEMP\vc_x64\vc_redist.x64.exe" /q' $VSRedistSetupError
	${Endif}

	RMDIR /r "$TEMP\vc_x64"
SectionEnd

Function vsRedistX64
	${If} ${RunningX64}
		; check for vc x64 redist
		ReadRegDword $1 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" "Version"
		${If} $1 != ""
			StrCpy $VSRedistInstalledX64 "Yes"
		${Endif}

		${If} $VSRedistInstalledX64 == "Yes"
			!insertMacro UnSelectSection ${SecVCRedistX64}
			SectionSetText ${SecVCRedistX64} ""
		${Else}
			!insertMacro SelectSection ${SecVCRedistX64}
			SectionSetText ${SecVCRedistX64} "${REDISTRIBUTABLE_X64_SECTIONNAME}"
		${Endif}
	${Else}
		!insertMacro UnSelectSection ${SecVCRedistX64}
		SectionSetText ${SecVCRedistX64} ""
	${Endif}
FunctionEnd

!endif