Skip to content

Force Proxy to any Windows/MacOS/Linux Application TCP and UDP traffic

#6 - Fixed ENV ERROR - added env var NSIS plugin

Sourav Kalalb26d6b04ece4
diff --git a/img/connections.png b/img/ProxyBridge.png
similarity index 100%
rename from img/connections.png
rename to img/ProxyBridge.png
diff --git a/installer/ProxyBridge.nsi b/installer/ProxyBridge.nsi
index 1de7f3b..5aed141 100644
--- a/installer/ProxyBridge.nsi
+++ b/installer/ProxyBridge.nsi
@@ -6,7 +6,6 @@
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!include "MUI2.nsh"
-!include "WordFunc.nsh"
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "ProxyBridge-Setup-${PRODUCT_VERSION}.exe"
@@ -46,21 +45,12 @@ Section "MainSection" SEC01
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\ProxyBridge.exe"
CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\ProxyBridge.exe"
- ; Add to PATH safely - check if already exists first
- ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
-
- ; Check if our path is already in PATH
- Push "$0"
- Push "$INSTDIR"
- Call StrContains
- Pop $1
-
- ; Only add if not already present
- StrCmp $1 "" 0 +3
- ; Path not found, append it
- StrCpy $0 "$0;$INSTDIR"
- WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$0"
+ ; Add to PATH using EnVar plugin
+ EnVar::SetHKLM
+ EnVar::AddValue "PATH" "$INSTDIR"
+ Pop $0
+ ; Broadcast environment change
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
SectionEnd
@@ -91,47 +81,14 @@ Section Uninstall
RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
RMDir "$INSTDIR"
- ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
- ${WordReplace} "$0" ";$INSTDIR" "" "+" $0
- ${WordReplace} "$0" "$INSTDIR;" "" "+" $0
- ${WordReplace} "$0" "$INSTDIR" "" "+" $0
- WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$0"
+ ; Remove from PATH using EnVar plugin
+ EnVar::SetHKLM
+ EnVar::DeleteValue "PATH" "$INSTDIR"
+ Pop $0
+
+ ; Broadcast environment change
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
SetAutoClose true
SectionEnd
-
-; Helper function to check if string contains substring
-Function StrContains
- Exch $R1 ; Needle (what to search for)
- Exch
- Exch $R2 ; Haystack (where to search)
- Push $R3
- Push $R4
- Push $R5
-
- StrLen $R3 $R1
- StrCpy $R4 0
-
- loop:
- StrCpy $R5 $R2 $R3 $R4
- StrCmp $R5 $R1 found
- StrCmp $R5 "" notfound
- IntOp $R4 $R4 + 1
- Goto loop
-
- found:
- StrCpy $R1 $R1
- Goto done
-
- notfound:
- StrCpy $R1 ""
-
- done:
- Pop $R5
- Pop $R4
- Pop $R3
- Pop $R2
- Exch $R1
-FunctionEnd