Skip to content
This repository has been archived by the owner on May 14, 2021. It is now read-only.

Commit

Permalink
[fix] (Windows) Installer: fixing 'autostart' registry item
Browse files Browse the repository at this point in the history
  • Loading branch information
stenya committed Mar 24, 2021
1 parent 15cd88b commit e8bf91b
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions References/Windows/Installer/IVPN Client.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -334,19 +334,6 @@ Section "${PRODUCT_NAME}" SecIVPN
done:
; >>> Uninstall previous section END

; <<<
; Checking if AutoStart item has correct value
ReadRegStr $R0 HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "${PRODUCT_IDENTIFIER}"
StrCmp $R0 "" reg_autostart_done ; no AutoRun registry item
${StrLoc} $R2 $R0 "${APP_RUN_PATH}" ">"
; if correct path not found - it is bad value and we should fix it
StrCmp $R2 "" reg_autostart_update reg_autostart_done
reg_autostart_update:
DetailPrint "Fixing AutoStart registry item ..." ; "C:\Program Files\IVPN Client\ui\IVPN Client.exe" --hidden
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "${PRODUCT_IDENTIFIER}" '"${APP_RUN_PATH}" --hidden'
reg_autostart_done:
; <<<

; Stop IVPN service
stopservcice:
Call StopService
Expand Down Expand Up @@ -406,6 +393,20 @@ Section "${PRODUCT_NAME}" SecIVPN
FileClose $9 ;Closes the filled file
${EndIf}

; <<<
; Checking if AutoStart item has correct value
ReadRegStr $R0 HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "${PRODUCT_IDENTIFIER}"
StrCmp $R0 "" reg_autostart_done ; no AutoRun registry item
${StrLoc} $R2 $R0 "${APP_RUN_PATH}" ">"
; if correct path not found - it is bad value and we should fix it
StrCmp $R2 "" reg_autostart_update reg_autostart_done
reg_autostart_update:
DetailPrint "Fixing the AutoStart registry item ..."
; "C:\Program Files\IVPN Client\ui\IVPN Client.exe" --hidden
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "${PRODUCT_IDENTIFIER}" '"${APP_RUN_PATH}" --hidden'
reg_autostart_done:
; <<<

; extract all files from source dir (it is important that IVPN Client Application must be stopped on this moment)
File /r "${SOURCE_DIR}\*.*"

Expand Down

0 comments on commit e8bf91b

Please sign in to comment.