Publish reviewed history-free open-source snapshot (2026-10-12)

This commit is contained in:
Zonghengjia Open Source
2026-10-11 23:23:20 +00:00
commit 901f27baf5
301 changed files with 32378 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
; Headless extraction/transaction integration, NOT production GUI acceptance.
; No registry writes, shortcuts, uninstaller, shutdown, or network operations.
Unicode True
RequestExecutionLevel user
SilentInstall silent
; Keep all shared extraction/transaction code, only avoid repeatedly compressing
; the large identical test payload. Never defined by the production installer.
!ifdef ACCEPTANCE_FAST_FIXTURES
SetCompress off
!else
SetCompressor /SOLID lzma
!endif
!include "LogicLib.nsh"
!include "PayloadTransaction.nsh"
!include "RemovalPayload.nsh"
!ifdef INTEGRATED
!include "InstallationIntegration.nsh"
!endif
!ifndef APP_SOURCE_DIR
!error "APP_SOURCE_DIR is required"
!endif
!ifndef ACCEPTANCE_OUTPUT
!error "ACCEPTANCE_OUTPUT is required"
!endif
Name "UCVL isolated NSIS payload acceptance"
OutFile "${ACCEPTANCE_OUTPUT}"
; A missing /D argument must fail the helper's strict temporary-path guard.
InstallDir "$TEMP\INVALID-UCVL-ACCEPTANCE-TARGET"
Section
!ifdef REMOVE_ONLY
!insertmacro PrepareRemovalHelper
${If} $0 == 0
!insertmacro RunRemovalHelper "--uninstaller-isolated-remove"
${EndIf}
!else
!insertmacro ExtractAndVerifyPayload
${If} $0 == 0
!ifdef INTEGRATED
!insertmacro PrepareInstallationIntegration
${If} $0 == 0
!ifdef INTEGRATION_INTERRUPT
!insertmacro ApplyVerifiedPayload "--installer-isolated-interrupt ${INTEGRATION_INTERRUPT}"
!else
!insertmacro ApplyVerifiedPayload "--installer-isolated-integrated"
!endif
${EndIf}
!else
!insertmacro ApplyVerifiedPayload "--installer-isolated-apply"
!endif
${EndIf}
!endif
SetErrorLevel $0
SectionEnd
!ifdef INTEGRATED
; The fixture stages a real NSIS uninstaller, but never executes a production
; uninstall. It contains no removal instructions and is inert if run manually.
Section "Uninstall"
SetErrorLevel 0
SectionEnd
!endif
+52
View File
@@ -0,0 +1,52 @@
; Optional independent-guardian handoff. Shared by the production NSIS script
; and fixture compilation. The control directory is NOT the baseline job.
!include "StrFunc.nsh"
${StrStr}
${StrCase}
Var GuardianControlled
Var GuardianControl
Var GuardianNonce
Var GuardianInstallerPid
!macro InitGuardianGate
StrCpy $GuardianControlled "0"
${StrCase} $1 $0 "U"
${StrStr} $1 $1 "/GUARDIAN"
${If} $1 != ""
StrCpy $GuardianControlled "1"
SetSilent silent
ClearErrors
${GetOptions} $0 "/GUARDIAN=" $GuardianControl
${If} ${Errors}
SetErrorLevel 70
Quit
${EndIf}
ClearErrors
${GetOptions} $0 "/GUARDIANNONCE=" $GuardianNonce
${If} ${Errors}
${OrIf} $GuardianControl == ""
${OrIf} $GuardianNonce == ""
SetErrorLevel 70
Quit
${EndIf}
System::Call 'kernel32::GetCurrentProcessId() i .r1'
StrCpy $GuardianInstallerPid $1
${EndIf}
!macroend
!macro RunGuardianPhase ARGUMENT
StrCpy $0 70
ClearErrors
ExecWait '"$PLUGINSDIR\payload\VPNPlus.exe" ${ARGUMENT} "$INSTDIR" "$GuardianControl" "$GuardianNonce" "$GuardianInstallerPid"' $0
${If} ${Errors}
StrCpy $0 70
${EndIf}
!macroend
Function GuardianExitOnFailure
${If} $GuardianControlled == "1"
${AndIf} $0 != 0
SetErrorLevel $0
Quit
${EndIf}
FunctionEnd
@@ -0,0 +1,14 @@
; Prepare every shell component before stopping the old app. The apply helper
; then journals payload + uninstaller + shortcuts + owned HKCU values together.
!macro PrepareInstallationIntegration
CreateDirectory "$PLUGINSDIR\integration"
ClearErrors
WriteUninstaller "$PLUGINSDIR\integration\Uninstall.exe"
CreateShortcut "$PLUGINSDIR\integration\Desktop.lnk" "$INSTDIR\VPNPlus.exe" "" "$INSTDIR\assets\zonghengjia-app-v1.ico" 0
CreateShortcut "$PLUGINSDIR\integration\StartMenu.lnk" "$INSTDIR\VPNPlus.exe" "" "$INSTDIR\assets\zonghengjia-app-v1.ico" 0
${If} ${Errors}
StrCpy $0 32
${Else}
StrCpy $0 0
${EndIf}
!macroend
+28
View File
@@ -0,0 +1,28 @@
; Shared by the production installer and the strictly isolated acceptance driver.
; These macros never stop a client, change registration, or open a message box.
; $0 is a fail-closed result, including failure to create the helper process.
!macro ExtractAndVerifyPayload
InitPluginsDir
SetOutPath "$PLUGINSDIR\payload"
ClearErrors
File /r "${APP_SOURCE_DIR}\*.*"
${If} ${Errors}
StrCpy $0 30
${Else}
StrCpy $0 31
ClearErrors
ExecWait '"$PLUGINSDIR\payload\VPNPlus.exe" --installer-verify' $0
${If} ${Errors}
StrCpy $0 31
${EndIf}
${EndIf}
!macroend
!macro ApplyVerifiedPayload ARGUMENT
StrCpy $0 20
ClearErrors
ExecWait '"$PLUGINSDIR\payload\VPNPlus.exe" ${ARGUMENT} "$INSTDIR"' $0
${If} ${Errors}
StrCpy $0 20
${EndIf}
!macroend
+50
View File
@@ -0,0 +1,50 @@
Unicode True
RequestExecutionLevel user
SilentInstall silent
!include "LogicLib.nsh"
!include "RegistryCleanup.nsh"
!ifndef ACCEPTANCE_SCOPE
!error "Unique acceptance scope required"
!endif
!ifndef ACCEPTANCE_OUTPUT
!error "Acceptance output path required"
!endif
OutFile "${ACCEPTANCE_OUTPUT}"
!define FIXTURE "Software\UCVL\InstallerAcceptance\${ACCEPTANCE_SCOPE}"
Section
WriteRegStr HKCU "${FIXTURE}\sentinel" "value" "keep"
WriteRegStr HKCU "${FIXTURE}\removed\nested" "value" "fixture"
!insertmacro RemoveOwnedUserRegistration "${FIXTURE}\removed"
${If} $0 != 0
SetErrorLevel 21
Quit
${EndIf}
ClearErrors
ReadRegStr $2 HKCU "${FIXTURE}\removed\nested" "value"
${IfNot} ${Errors}
SetErrorLevel 22
Quit
${EndIf}
!insertmacro RemoveOwnedUserRegistration "${FIXTURE}\removed"
${If} $0 != 0
SetErrorLevel 23
Quit
${EndIf}
!insertmacro RemoveOwnedUserRegistration "${FIXTURE}\missing-parent\missing-key"
${If} $0 != 0
SetErrorLevel 24
Quit
${EndIf}
ReadRegStr $2 HKCU "${FIXTURE}\sentinel" "value"
${If} $2 != "keep"
SetErrorLevel 25
Quit
${EndIf}
; Only this run's generated GUID subtree is removed, never the parent.
!insertmacro RemoveOwnedUserRegistration "${FIXTURE}"
${If} $0 != 0
SetErrorLevel 26
Quit
${EndIf}
SetErrorLevel 0
SectionEnd
+26
View File
@@ -0,0 +1,26 @@
!ifndef UCVL_REGISTRY_CLEANUP_INCLUDED
!define UCVL_REGISTRY_CLEANUP_INCLUDED
; NSIS DeleteRegKey also reports an error for an already-absent key. Confirm
; absence using Win32 status, without treating access denied as success.
; Uses the default 32-bit registry view, like the rest of this installer.
!macro RemoveOwnedUserRegistration KEY
StrCpy $0 0
ClearErrors
DeleteRegKey HKCU "${KEY}"
${If} ${Errors}
System::Call 'advapi32::RegOpenKeyExW(p 0x80000001, w "${KEY}", i 0, i 0x20019, *p .r1) i .r0'
${If} $0 == 0
System::Call 'advapi32::RegCloseKey(p r1)'
StrCpy $0 20
${ElseIf} $0 == 2
StrCpy $0 0
${ElseIf} $0 == 3
StrCpy $0 0
${Else}
StrCpy $0 20
${EndIf}
${EndIf}
ClearErrors
!macroend
!endif
+19
View File
@@ -0,0 +1,19 @@
; Shared production/isolated-removal helper extraction and fail-closed launch.
!macro PrepareRemovalHelper
InitPluginsDir
SetOutPath "$PLUGINSDIR\remove"
StrCpy $0 0
ClearErrors
File /oname=VPNPlus.exe "${APP_SOURCE_DIR}\VPNPlus.exe"
${If} ${Errors}
StrCpy $0 30
${EndIf}
!macroend
!macro RunRemovalHelper ARGUMENT
StrCpy $0 20
ClearErrors
ExecWait '"$PLUGINSDIR\remove\VPNPlus.exe" ${ARGUMENT} "$INSTDIR"' $0
${If} ${Errors}
StrCpy $0 20
${EndIf}
!macroend
+266
View File
@@ -0,0 +1,266 @@
Unicode True
SetCompressor /SOLID lzma
RequestExecutionLevel admin
!include "MUI2.nsh"
!include "x64.nsh"
!include "LogicLib.nsh"
!include "FileFunc.nsh"
!include "PayloadTransaction.nsh"
!include "RemovalPayload.nsh"
!include "RegistryCleanup.nsh"
!include "InstallationIntegration.nsh"
!include "GuardianGate.nsh"
!define PRODUCT_NAME "优创⁺纵横家"
!ifndef PRODUCT_VERSION
!define PRODUCT_VERSION "0.2.16"
!endif
!define PRODUCT_PUBLISHER "优创未来(UCVL)"
!ifndef PRODUCT_BUILD_SUFFIX
!define PRODUCT_BUILD_SUFFIX ""
!endif
!ifndef PRODUCT_DISPLAY_VERSION
!define PRODUCT_DISPLAY_VERSION "${PRODUCT_VERSION}${PRODUCT_BUILD_SUFFIX}"
!endif
!ifndef PRODUCT_REVISION
!define PRODUCT_REVISION "0"
!endif
!ifndef APP_SOURCE_DIR
!define APP_SOURCE_DIR "${__FILEDIR__}\..\dist\app"
!endif
!define PRODUCT_WEB "https://vpn.toplc.cn/"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\VPNPlus.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\UCVL.VPNPlus"
Name "${PRODUCT_NAME}"
!ifdef INSTALLER_OUTPUT
OutFile "${INSTALLER_OUTPUT}"
!else
OutFile "${__FILEDIR__}\..\artifacts\UCVL-Zonghengjia-${PRODUCT_VERSION}${PRODUCT_BUILD_SUFFIX}-win-x64-setup.exe"
!endif
InstallDir "$LOCALAPPDATA\Programs\UCVL\VPNPlus"
InstallDirRegKey HKCU "${PRODUCT_DIR_REGKEY}" "Path"
BrandingText "优创未来 · 优创⁺纵横家"
Icon "${__FILEDIR__}\..\assets\zonghengjia-app-v1.ico"
UninstallIcon "${__FILEDIR__}\..\assets\zonghengjia-app-v1.ico"
VIProductVersion "${PRODUCT_VERSION}.${PRODUCT_REVISION}"
VIAddVersionKey /LANG=2052 "ProductName" "优创⁺纵横家"
VIAddVersionKey /LANG=2052 "CompanyName" "优创未来(UCVL)"
VIAddVersionKey /LANG=2052 "FileDescription" "优创⁺纵横家 Windows x64 安装程序"
VIAddVersionKey /LANG=2052 "FileVersion" "${PRODUCT_DISPLAY_VERSION}"
VIAddVersionKey /LANG=2052 "ProductVersion" "${PRODUCT_DISPLAY_VERSION}"
VIAddVersionKey /LANG=2052 "LegalCopyright" "© 2026 优创未来(UCVL)"
!define MUI_ICON "${__FILEDIR__}\..\assets\zonghengjia-app-v1.ico"
!define MUI_UNICON "${__FILEDIR__}\..\assets\zonghengjia-app-v1.ico"
Var Updating
!define MUI_CUSTOMFUNCTION_GUIINIT SetupUpdateControls
!define MUI_FINISHPAGE_TITLE "纵横家已更新完成"
!define MUI_FINISHPAGE_TEXT "已覆盖原安装目录,账号和用户配置已保留。点击下方按钮重启纵横家,无需重启电脑。"
!define MUI_FINISHPAGE_BUTTON "重启纵横家"
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipUpdatePage
!insertmacro MUI_PAGE_WELCOME
!define MUI_PAGE_CUSTOMFUNCTION_PRE SkipUpdatePage
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE RestartClient
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "SimpChinese"
Function .onInit
${GetParameters} $0
!insertmacro InitGuardianGate
${If} $GuardianControlled == "1"
; /D is preserved for the request-bound target. No upgrade UI/restart path.
Return
${EndIf}
ClearErrors
${GetOptions} $0 "/UPDATE" $1
${IfNot} ${Errors}
StrCpy $Updating "1"
; Old clients used /S /UPDATE: show progress and the final restart button too.
SetSilent normal
${EndIf}
; Double-clicking a new package on an installed machine is also an upgrade.
ReadRegStr $2 HKCU "${PRODUCT_DIR_REGKEY}" "Path"
${If} $2 != ""
${AndIf} ${FileExists} "$2\VPNPlus.exe"
StrCpy $INSTDIR $2
StrCpy $Updating "1"
SetSilent normal
${EndIf}
FunctionEnd
Function SkipUpdatePage
${If} $Updating == "1"
Abort
${EndIf}
FunctionEnd
Function RestartClient
${If} $GuardianControlled == "1"
Return
${EndIf}
; ExtractAndVerifyPayload leaves $OUTDIR in $PLUGINSDIR\payload.
; The installed app must not inherit that soon-to-be-removed directory.
SetOutPath "$INSTDIR"
${If} $Updating == "1"
Exec '"$INSTDIR\VPNPlus.exe" --auto-connect'
${Else}
Exec '"$INSTDIR\VPNPlus.exe"'
${EndIf}
FunctionEnd
Function SetupUpdateControls
${If} $Updating == "1"
GetDlgItem $0 $HWNDPARENT 2
EnableWindow $0 0
${EndIf}
FunctionEnd
Section "优创⁺纵横家主程序" SEC_MAIN
SetShellVarContext current
${IfNot} ${RunningX64}
StrCpy $0 33
Call GuardianExitOnFailure
MessageBox MB_ICONSTOP "优创⁺纵横家仅支持 64 位 Windows 10/11。"
Abort
${EndIf}
; Fully extract and hash-check the candidate BEFORE stopping the working app.
!insertmacro ExtractAndVerifyPayload
Call GuardianExitOnFailure
${If} $0 == 30
MessageBox MB_ICONSTOP "安装包解压失败,当前程序未被停止或修改。"
Abort
${EndIf}
${If} $0 != 0
MessageBox MB_ICONSTOP "安装包校验失败,当前程序未被停止或修改。请重新下载安装包。"
Abort
${EndIf}
!insertmacro PrepareInstallationIntegration
Call GuardianExitOnFailure
${If} $0 != 0
MessageBox MB_ICONSTOP "无法准备卸载组件或快捷方式,当前程序未被停止或修改。"
Abort
${EndIf}
${If} $GuardianControlled == "1"
!insertmacro RunGuardianPhase "--installer-guardian-gate"
Call GuardianExitOnFailure
${EndIf}
${If} $GuardianControlled != "1"
${AndIf} ${FileExists} "$INSTDIR\VPNPlus.exe"
StrCpy $0 20
ClearErrors
ExecWait '"$PLUGINSDIR\payload\VPNPlus.exe" --shutdown-installed "$INSTDIR"' $0
${If} ${Errors}
StrCpy $0 20
${EndIf}
${If} $0 != 0
MessageBox MB_ICONSTOP "原程序暂时无法安全退出,尚未覆盖安装。请退出纵横家后重试。"
Abort
${EndIf}
${EndIf}
; Each replacement is atomic, the main exe is replaced LAST, and a durable
; backup/journal permits recovery if copying fails or the installer is interrupted.
${If} $GuardianControlled == "1"
!insertmacro RunGuardianPhase "--installer-guardian-apply"
${Else}
!insertmacro ApplyVerifiedPayload "--installer-apply-integrated"
${EndIf}
; Controlled failures return directly: the independent guardian owns any
; rollback/restart; do not write last-error or execute the restored client.
Call GuardianExitOnFailure
${If} $0 != 0
CreateDirectory "$INSTDIR\.ucvl-installer"
CopyFiles /SILENT "$PLUGINSDIR\payload\install-error.txt" "$INSTDIR\.ucvl-installer\last-error.txt"
${If} $0 == 20
${AndIf} ${FileExists} "$INSTDIR\VPNPlus.exe"
SetOutPath "$INSTDIR"
Exec '"$INSTDIR\VPNPlus.exe"'
MessageBox MB_ICONSTOP "本次更新未完成,已保留或恢复旧版本并重新打开。账号和配置未删除。"
${Else}
MessageBox MB_ICONSTOP "本次更新未完成。恢复记录和旧文件备份已保留,请重新运行安装包进行恢复。不要卸载或删除安装目录。"
${EndIf}
Abort
${EndIf}
; The helper returns success only after payload, shell files and HKCU
; registration have all been verified and durably committed together.
${If} $GuardianControlled == "1"
SetErrorLevel 0
Quit
${EndIf}
SectionEnd
Section "Uninstall"
SetShellVarContext current
ReadRegStr $2 HKCU "${PRODUCT_DIR_REGKEY}" "Path"
${If} $2 == ""
MessageBox MB_ICONSTOP "没有找到当前安装登记,未删除文件。请先用当前安装包修复。"
Abort
${EndIf}
GetFullPathName $2 "$2"
GetFullPathName $4 "$INSTDIR"
${If} $2 != $4
MessageBox MB_ICONSTOP "此卸载器不属于当前登记的安装目录,未删除文件或修改其它安装。"
Abort
${EndIf}
; This independent embedded helper survives an interrupted removal of main.
!insertmacro PrepareRemovalHelper
${If} $0 != 0
MessageBox MB_ICONSTOP "无法准备卸载程序,未删除文件。"
Abort
${EndIf}
!insertmacro RunRemovalHelper "--uninstaller-check"
${If} $0 != 0
MessageBox MB_ICONSTOP "安装记录、版本或文件不一致,未停止客户端或删除文件。请先用当前安装包修复。"
Abort
${EndIf}
${If} ${FileExists} "$INSTDIR\VPNPlus.exe"
StrCpy $0 20
ClearErrors
ExecWait '"$PLUGINSDIR\remove\VPNPlus.exe" --shutdown-installed "$INSTDIR"' $0
${If} ${Errors}
StrCpy $0 20
${EndIf}
${If} $0 != 0
MessageBox MB_ICONSTOP "客户端未安全退出,尚未卸载。请断开并退出后重试。"
Abort
${EndIf}
${EndIf}
!insertmacro RunRemovalHelper "--uninstaller-remove"
${If} $0 != 0
MessageBox MB_ICONSTOP "卸载未完成。账号、配置和程序备份均保留;请重新运行本卸载器或安装包恢复。"
Abort
${EndIf}
Delete "$DESKTOP\优创⁺纵横家.lnk"
Delete "$DESKTOP\VPN+.lnk"
Delete "$SMPROGRAMS\优创未来\优创⁺纵横家.lnk"
Delete "$SMPROGRAMS\优创未来\VPN+.lnk"
RMDir "$SMPROGRAMS\优创未来"
!insertmacro RemoveOwnedUserRegistration "${PRODUCT_UNINST_KEY}"
${If} $0 != 0
MessageBox MB_ICONSTOP "程序文件已移除并保留备份,但系统登记未清理完成。请重新运行卸载器完成清理。"
Abort
${EndIf}
!insertmacro RemoveOwnedUserRegistration "${PRODUCT_DIR_REGKEY}"
${If} $0 != 0
MessageBox MB_ICONSTOP "程序文件已移除并保留备份,但启动登记未清理完成。请重新运行卸载器完成清理。"
Abort
${EndIf}
Delete "$INSTDIR\Uninstall.exe"
; No recursive deletion. User extras and .ucvl-installer recovery backups stay.
RMDir "$INSTDIR"
MessageBox MB_ICONINFORMATION "程序已卸载。账号、用户配置及安装目录中的恢复备份已保留,不会删除其它文件。"
SectionEnd