Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Set PAC per process

17 views
Skip to first unread message

Eric Millin

unread,
Jul 19, 2013, 12:15:51 PM7/19/13
to
Is there a way to set PAC per process in same way that you can use UrlMkSetSessionOption or InternetSetOption to set a static proxy per process? I've tried the following in a BHO with no success:

void CCovIEBHO::SetPAC(HINTERNET h_internet, std::wstring &pac_url)
{
INTERNET_PER_CONN_OPTION_LIST List;
INTERNET_PER_CONN_OPTION Option[2];
unsigned long nSize = sizeof(INTERNET_PER_CONN_OPTION_LIST);

Option[0].dwOption = INTERNET_PER_CONN_AUTOCONFIG_URL;
Option[0].Value.pszValue = (LPWSTR)pac_url.c_str();

Option[1].dwOption = INTERNET_PER_CONN_AUTODISCOVERY_FLAGS;
Option[1].Value.dwValue = AUTO_PROXY_FLAG_DONT_CACHE_PROXY_RESULT;

List.dwSize = sizeof(INTERNET_PER_CONN_OPTION_LIST);
List.pszConnection = NULL;
List.dwOptionCount = ARRAYSIZE(Option);
List.dwOptionError = 0;
List.pOptions = Option;

if(!InternetSetOption(h_internet, INTERNET_OPTION_PER_CONNECTION_OPTION, &List, nSize))
printf("InternetSetOption failed! (%d)\n", GetLastError());
}
0 new messages