I want to retrieve default proxy settings. To do this I use next code:
WINHTTP_PROXY_INFO ProxyInfo;
ZeroMemory( &ProxyInfo, sizeof(ProxyInfo) );
BOOL result = WinHttpGetDefaultProxyConfiguration(&ProxyInfo);
if (result)
{
//...
}
The function returns TRUE, but in ProxyInfo I have: WINHTTP_ACCESS_TYPE_NO_PROXY and lpszProxy == NULL no matter what settings I put via ProxyCfg.exe->Connections->LAN Settings->Proxy Server. Do you know what I’m doing wrong here?
I tested this code on Win7 64bits machine, but I need it to work in all WinXP+ versions.
I checked libproxy project and there proxy settings are retrieved from registries. Is this method reliable? Is the same registry path for proxy configuration in all Windows versions?
I’ve tried the method used in Chrome and it works fine. Also it should be tested in multiple Windows versions.