chore: update

This commit is contained in:
huzibaca 2024-11-05 21:40:02 +08:00
parent 402018b95c
commit 590aa950df

View File

@ -692,7 +692,7 @@ SectionEnd
app_check_done: app_check_done:
!macroend !macroend
Section VSRuntime Section "Check and Install VS Runtime"
; Set default values for x86 ; Set default values for x86
StrCpy $VC_REDIST_URL "https://aka.ms/vs/17/release/vc_redist.x86.exe" StrCpy $VC_REDIST_URL "https://aka.ms/vs/17/release/vc_redist.x86.exe"
StrCpy $VC_REDIST_EXE "vc_redist.x86.exe" StrCpy $VC_REDIST_EXE "vc_redist.x86.exe"
@ -703,30 +703,36 @@ Section VSRuntime
StrCpy $VC_REDIST_EXE "vc_redist.x64.exe" StrCpy $VC_REDIST_EXE "vc_redist.x64.exe"
${EndIf} ${EndIf}
; 检查注册表项是否存在示例路径需根据实际情况调整 ; 检查运行库文件是否存在
ReadRegDWORD $1 HKLM "SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\$0" "Installed" ; 对于 64 位系统检查 32 位运行时文件
IfErrors 0 +2 ${If} ${Is64Bit}
StrCpy $1 0 IfFileExists "$WINDIR\SysWOW64\msvcp140.dll" AlreadyInstalled
; 如果未安装$1 = 0下载并安装
${If} $1 == 0
MessageBox MB_OK "Visual Studio Runtime is not installed. Installing now..."
; 下载文件
nsisdl::download "$VC_REDIST_URL" "$TEMP\$VC_REDIST_EXE"
Pop $0 ; 获取下载结果
StrCmp $0 "success" +2
MessageBox MB_OK "Download failed. Please check your internet connection." IDOK Done
; 安装运行库
ExecWait '"$TEMP\$VC_REDIST_EXE" /quiet /norestart'
${Else}
MessageBox MB_OK "Visual Studio Runtime is already installed."
${EndIf} ${EndIf}
; 对于 32 位系统或者 64 位系统的 64 位运行时
IfFileExists "$SYSDIR\msvcp140.dll" AlreadyInstalled
; 如果文件不存在进行安装
MessageBox MB_OK "Visual Studio Runtime is not installed. Installing now..."
; 下载文件
nsisdl::download "$VC_REDIST_URL" "$TEMP\$VC_REDIST_EXE"
Pop $0 ; 获取下载结果
StrCmp $0 "success" +2
MessageBox MB_OK "Download failed. Please check your internet connection." IDOK Done
; 安装运行库
ExecWait '"$TEMP\$VC_REDIST_EXE" /quiet /norestart'
Goto Done
AlreadyInstalled:
MessageBox MB_OK "Visual Studio Runtime is already installed."
Done: Done:
SectionEnd SectionEnd
Section Install Section Install
SetOutPath $INSTDIR SetOutPath $INSTDIR
nsExec::Exec 'netsh int tcp res' nsExec::Exec 'netsh int tcp res'