LD-FDPI/src-tauri/nsis/hooks.nsh

26 lines
1.3 KiB
NSIS

; LD FDPI NSIS uninstall hook.
; Restores the user's original proxy (WinINet + WinHTTP) from the crash-safe
; backup and removes the elevated logon task, instead of blindly zeroing
; ProxyEnable / deleting AutoConfigURL.
!macro NSIS_HOOK_PREUNINSTALL
DetailPrint "LD FDPI: Uygulama kapatiliyor..."
nsExec::ExecToLog '"$SYSDIR\taskkill.exe" /F /IM ld-fdpi.exe /T'
DetailPrint "LD FDPI: Sistem proxy ayarlari yedekten geri yukleniyor..."
; --restore-only reads %LOCALAPPDATA%\LD-FDPI\sentinel_proxy_backup.json,
; restores ProxyEnable / ProxyServer / ProxyOverride / AutoConfigURL / AutoDetect
; (and WinHTTP if it was changed) but only when a dirty session exists.
nsExec::ExecToLog '"$INSTDIR\ld-fdpi.exe" --restore-only'
DetailPrint "LD FDPI: Yonetici otomatik baslatma gorevi kaldiriliyor..."
nsExec::ExecToLog '"$SYSDIR\schtasks.exe" /Delete /TN "LD_FDPI_AutoStart" /F'
DetailPrint "LD FDPI: VPN tuneli ve servisi kaldiriliyor..."
nsExec::ExecToLog '"$SYSDIR\sc.exe" stop "AmneziaWGTunnel$ld-fdpi"'
nsExec::ExecToLog '"$SYSDIR\sc.exe" delete "AmneziaWGTunnel$ld-fdpi"'
nsExec::ExecToLog '"$SYSDIR\cmd.exe" /C del /q "%LOCALAPPDATA%\LD-FDPI\ld-fdpi.conf"'
DetailPrint "LD FDPI: LAN firewall kurali kaldiriliyor..."
nsExec::ExecToLog '"$SYSDIR\netsh.exe" advfirewall firewall delete rule name="LD_FDPI_LAN_Share"'
!macroend