internal bool Attach(bool bCollectGWInfo) { if (!this._bIsAttached) { if (bCollectGWInfo) { this.CollectConnectoidAndGatewayInfo(); } WinINETProxyInfo oNewInfo = new WinINETProxyInfo(); oNewInfo.bUseManualProxies = true; oNewInfo.bAllowDirect = true; oNewInfo.sHttpProxy = KPCONFIG.sKProxyListenHostPort; if (KPCONFIG.bCaptureCONNECT) { oNewInfo.sHttpsProxy = KPCONFIG.sKProxyListenHostPort; } else if (this.piPrior != null) { oNewInfo.sHttpsProxy = this.piPrior.sHttpsProxy; } if ((this.piPrior != null) && this.piPrior.bUseManualProxies) { oNewInfo.sFtpProxy = this.piPrior.sFtpProxy; oNewInfo.sSocksProxy = this.piPrior.sSocksProxy; } if (KPCONFIG.bCaptureFTP) { oNewInfo.sFtpProxy = KPCONFIG.sKProxyListenHostPort; } oNewInfo.sHostsThatBypass = KPCONFIG.sHostsThatBypassKProxy; if (KPCONFIG.bHookWithPAC) { if (KProxyApplication.Prefs.GetBoolPref("KProxy.proxy.pacfile.usefileprotocol", true)) { oNewInfo.sPACScriptLocation = "file://" + KPCONFIG.GetPath("Pac"); } else { oNewInfo.sPACScriptLocation = "http://" + KPCONFIG.sKProxyListenHostPort + "/proxy.pac"; } } if (!KPCONFIG.bIsViewOnly) { if (this.oAllConnectoids.HookConnections(oNewInfo)) { this._bIsAttached = true; KProxyApplication.OnKProxyAttach(); this.WriteAutoProxyPACFile(true); } else { KProxyApplication.DoNotifyUser("Failed to register KProxy as the system proxy.", "Error"); _setDynamicRegistryKey(false); return(false); } _setDynamicRegistryKey(true); } } return(true); }