Skip to content

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

improve kernel load and proxybridge uninstall to remove windivert as well #117

AnoF-Cyber74800f1f22b6
diff --git a/Windows/installer/ProxyBridge.nsi b/Windows/installer/ProxyBridge.nsi
index 3bbff42..c9e1c79 100644
--- a/Windows/installer/ProxyBridge.nsi
+++ b/Windows/installer/ProxyBridge.nsi
@@ -104,6 +104,12 @@ Section Uninstall
; Broadcast environment change
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+ ; Stop and remove the WinDivert kernel driver service so a future reinstall
+ ; doesn't inherit a stale/disabled entry (error 1058).
+ nsExec::ExecToLog 'sc stop WinDivert'
+ nsExec::ExecToLog 'sc delete WinDivert'
+ DeleteRegKey HKLM "SYSTEM\CurrentControlSet\Services\WinDivert"
+
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
SetAutoClose true
SectionEnd
diff --git a/Windows/src/ProxyBridge.c b/Windows/src/ProxyBridge.c
index a55cf27..cf8160e 100644
--- a/Windows/src/ProxyBridge.c
+++ b/Windows/src/ProxyBridge.c
@@ -3279,7 +3279,28 @@ PROXYBRIDGE_API BOOL ProxyBridge_Start(void)
windivert_handle = WinDivertOpen(filter, WINDIVERT_LAYER_NETWORK, priority, 0);
if (windivert_handle == INVALID_HANDLE_VALUE)
{
- log_message("Failed to open WinDivert (%lu)", GetLastError());
+ DWORD wd_err = GetLastError();
+ switch (wd_err)
+ {
+ case 2: // ERROR_FILE_NOT_FOUND
+ log_message("Failed to open WinDivert (%lu): WinDivert64.sys not found - it may have been quarantined or deleted by antivirus. Whitelist WinDivert64.sys and ProxyBridgeCore.dll in your AV and reinstall.", wd_err);
+ break;
+ case 5: // ERROR_ACCESS_DENIED
+ log_message("Failed to open WinDivert (%lu): Access denied - make sure ProxyBridge is running as Administrator.", wd_err);
+ break;
+ case 577: // ERROR_INVALID_IMAGE_HASH - driver signature check failed
+ log_message("Failed to open WinDivert (%lu): Driver signature verification failed - WinDivert64.sys may have been modified or blocked by security software. Reinstall ProxyBridge.", wd_err);
+ break;
+ case 1058: // ERROR_SERVICE_DISABLED
+ log_message("Failed to open WinDivert (%lu): A stale WinDivert driver entry from a previous install is marked disabled. Reinstall ProxyBridge to fix it, or manually delete the registry key: HKLM\\SYSTEM\\CurrentControlSet\\Services\\WinDivert", wd_err);
+ break;
+ case 1275: // ERROR_DRIVER_BLOCKED
+ log_message("Failed to open WinDivert (%lu): WinDivert64.sys is blocked by Windows security policy or antivirus (BYOVD protection). Whitelist WinDivert64.sys in your security software.", wd_err);
+ break;
+ default:
+ log_message("Failed to open WinDivert (%lu): Ensure ProxyBridge is installed correctly and running as Administrator.", wd_err);
+ break;
+ }
running = FALSE;
WaitForSingleObject(proxy_thread, INFINITE);
CloseHandle(proxy_thread);