本文整理汇总了C++中InternetSetOption函数的典型用法代码示例。如果您正苦于以下问题:C++ InternetSetOption函数的具体用法?C++ InternetSetOption怎么用?C++ InternetSetOption使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了InternetSetOption函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: RemoveConnectionProxy
/**
Set the IE proxy to NULL.
*/
BOOL RemoveConnectionProxy()
{
logger->debug("RemoveConnectionProxy -- START.\n\0");
INTERNET_PER_CONN_OPTION_LIST conn_options;
BOOL bReturn;
DWORD dwBufferSize = sizeof(conn_options);
conn_options.dwSize = dwBufferSize;
conn_options.pszConnection = NULL; //NULL - LAN
conn_options.dwOptionCount = 1;
conn_options.pOptions = new INTERNET_PER_CONN_OPTION[conn_options.dwOptionCount];
conn_options.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
conn_options.pOptions[0].Value.dwValue = PROXY_TYPE_DIRECT ;
bReturn = InternetSetOption(NULL,INTERNET_OPTION_PER_CONNECTION_OPTION, &conn_options, dwBufferSize);
delete [] conn_options.pOptions;
InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
InternetSetOption(NULL, INTERNET_OPTION_REFRESH , NULL, 0);
logger->debug("RemoveConnectionProxy -- OK.\n\0");
return bReturn;
}
开发者ID:alwynd,项目名称:PublicGitRepo,代码行数:28,代码来源:fixproxy.cpp
示例2: proxy
jboolean proxy(JNIEnv* env, const jobject& jobj, const jstring& proxyStr, const int flags) {
char* proxyAddressStr = jstringToChar(env, proxyStr);
INTERNET_PER_CONN_OPTION_LIST options;
BOOL bReturn;
DWORD dwBufferSize = sizeof(options);
options.dwSize = dwBufferSize;
options.pszConnection = NULL;//connNameStr;//NULL == LAN
options.dwOptionCount = 3;
options.pOptions = new INTERNET_PER_CONN_OPTION[3];
if(!options.pOptions)
return FALSE;
options.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
options.pOptions[0].Value.dwValue = flags;
options.pOptions[1].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
options.pOptions[1].Value.pszValue = proxyAddressStr;
options.pOptions[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS;
LPSTR loc = TEXT("local");
options.pOptions[2].Value.pszValue = loc;
bReturn = InternetSetOption(NULL,INTERNET_OPTION_PER_CONNECTION_OPTION, &options, dwBufferSize);
delete [] options.pOptions;
InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
InternetSetOption(NULL, INTERNET_OPTION_REFRESH , NULL, 0);
delete [] proxyAddressStr;
return bReturn;
}
开发者ID:PowerOlive,项目名称:WinProxy4J,代码行数:35,代码来源:WinProxy.cpp
示例3: SetConnectionProxy
BOOL SetConnectionProxy(char * proxyAdressStr , char * connNameStr = NULL)
{
INTERNET_PER_CONN_OPTION_LIST conn_options;
BOOL bReturn;
DWORD dwBufferSize = sizeof(conn_options);
conn_options.dwSize = dwBufferSize;
conn_options.pszConnection = connNameStr;//NULL == LAN
conn_options.dwOptionCount = 3;
conn_options.pOptions = new INTERNET_PER_CONN_OPTION[3];
if(!conn_options.pOptions)
return FALSE;
conn_options.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
conn_options.pOptions[0].Value.dwValue = PROXY_TYPE_DIRECT|PROXY_TYPE_PROXY;
conn_options.pOptions[1].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
conn_options.pOptions[1].Value.pszValue = proxyAdressStr;
conn_options.pOptions[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS;
conn_options.pOptions[2].Value.pszValue = "local";
bReturn = InternetSetOption(NULL,INTERNET_OPTION_PER_CONNECTION_OPTION, &conn_options, dwBufferSize);
delete [] conn_options.pOptions;
InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
InternetSetOption(NULL, INTERNET_OPTION_REFRESH , NULL, 0);
return bReturn;
}
开发者ID:0xack13,项目名称:setproxy,代码行数:34,代码来源:setproxy.cpp
示例4: sizeof
bool BypassHttpProxy::disableProxy()
{
//conn_name: active connection name.
INTERNET_PER_CONN_OPTION_LIST list;
BOOL bReturn;
DWORD dwBufSize = sizeof(list);
// Fill out list struct.
list.dwSize = sizeof(list);
// NULL == LAN, otherwise connectoid name.
list.pszConnection = NULL;
// Set three options.
list.dwOptionCount = 1;
list.pOptions = new INTERNET_PER_CONN_OPTION[list.dwOptionCount];
// Make sure the memory was allocated.
if(NULL == list.pOptions)
{
// Return FALSE if the memory wasn't allocated.
LOG_ERROR("failed to allocat memory in DisableConnectionProxy()");
return false;
}
// Set flags.
list.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
list.pOptions[0].Value.dwValue = PROXY_TYPE_DIRECT ;
// Set the options on the connection.
bReturn = InternetSetOption(NULL,
INTERNET_OPTION_PER_CONNECTION_OPTION, &list, dwBufSize);
// Free the allocated memory.
delete [] list.pOptions;
InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
InternetSetOption(NULL, INTERNET_OPTION_REFRESH , NULL, 0);
LOG_DEBUG("bReturn=%d", bReturn);
return bReturn;
}
开发者ID:Kjwon15,项目名称:su,代码行数:34,代码来源:bypasshttpproxy.cpp
示例5: SetConnectionProxy
/**
Sets the proxy for IE and OS.
*/
BOOL SetConnectionProxy(char * proxyAdressStr , char *bypass)
{
sprintf_s(cbuffer, "SetConnectionProxy -- START:\nproxyAdressStr: '%s'\nbypass: '%s'\n\0", proxyAdressStr, bypass);
logger->debug(cbuffer);
INTERNET_PER_CONN_OPTION_LIST conn_options;
BOOL bReturn;
DWORD dwBufferSize = sizeof(conn_options);
conn_options.dwSize = dwBufferSize;
conn_options.pszConnection = NULL;//NULL == LAN
conn_options.dwOptionCount = 3;
conn_options.pOptions = new INTERNET_PER_CONN_OPTION[3];
conn_options.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
conn_options.pOptions[0].Value.dwValue = PROXY_TYPE_DIRECT|PROXY_TYPE_PROXY;
conn_options.pOptions[1].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
conn_options.pOptions[1].Value.pszValue = proxyAdressStr;
conn_options.pOptions[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS;
conn_options.pOptions[2].Value.pszValue = bypass;
bReturn = InternetSetOption(NULL,INTERNET_OPTION_PER_CONNECTION_OPTION, &conn_options, dwBufferSize);
delete [] conn_options.pOptions;
InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
InternetSetOption(NULL, INTERNET_OPTION_REFRESH , NULL, 0);
sprintf_s(cbuffer, "SetConnectionProxy -- OK:\nproxyAdressStr: '%s'\nbypass: '%s'\n\0", proxyAdressStr, bypass);
logger->debug(cbuffer);
return bReturn;
}
开发者ID:alwynd,项目名称:PublicGitRepo,代码行数:38,代码来源:fixproxy.cpp
示例6: setProxy
BOOL setProxy() {
INTERNET_PER_CONN_OPTION_LIST list;
INTERNET_PER_CONN_OPTION option[3];
unsigned long nSize = sizeof(INTERNET_PER_CONN_OPTION_LIST);
option[0].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
option[0].Value.pszValue = proxyAddress;
option[1].dwOption = INTERNET_PER_CONN_FLAGS;
option[1].Value.dwValue = PROXY_TYPE_PROXY | PROXY_TYPE_DIRECT;
option[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS;
option[2].Value.pszValue = L"<local>";
list.dwSize = sizeof(INTERNET_PER_CONN_OPTION_LIST);
list.pszConnection = NULL;
list.dwOptionCount = 3;
list.dwOptionError = 0;
list.pOptions = option;
if (!InternetSetOption(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION, &list, nSize)) {
return FALSE;
}
if (!InternetSetOption(NULL, INTERNET_OPTION_REFRESH, NULL, 0)) {
return FALSE;
}
return TRUE;
}
开发者ID:Jianru-Lin,项目名称:WinProxyTool,代码行数:30,代码来源:proxy.c
示例7: RemoveConnectionProxy
BOOL RemoveConnectionProxy(char* connectionNameStr = NULL)
{
INTERNET_PER_CONN_OPTION_LIST conn_options;
BOOL bReturn;
DWORD dwBufferSize = sizeof(conn_options);
conn_options.dwSize = dwBufferSize;
conn_options.pszConnection = connectionNameStr; //NULL - LAN
conn_options.dwOptionCount = 1;
conn_options.pOptions = new INTERNET_PER_CONN_OPTION[conn_options.dwOptionCount];
if(!conn_options.pOptions)
return FALSE;
conn_options.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
conn_options.pOptions[0].Value.dwValue = PROXY_TYPE_DIRECT ;
bReturn = InternetSetOption(NULL,INTERNET_OPTION_PER_CONNECTION_OPTION, &conn_options, dwBufferSize);
delete [] conn_options.pOptions;
InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
InternetSetOption(NULL, INTERNET_OPTION_REFRESH , NULL, 0);
return bReturn;
}
开发者ID:0xack13,项目名称:setproxy,代码行数:27,代码来源:setproxy.cpp
示例8: setPacFile
jboolean setPacFile(char* proxyAddressStr, const int flags) {
INTERNET_PER_CONN_OPTION_LIST options;
BOOL bReturn;
DWORD dwBufferSize = sizeof(options);
options.dwSize = dwBufferSize;
options.pszConnection = FindActiveConnection();//connNameStr;//NULL == LAN
options.dwOptionCount = 2;
options.pOptions = new INTERNET_PER_CONN_OPTION[2];
if(!options.pOptions) {
return FALSE;
}
options.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
options.pOptions[0].Value.dwValue = flags;
options.pOptions[1].dwOption = INTERNET_PER_CONN_AUTOCONFIG_URL;
options.pOptions[1].Value.pszValue = proxyAddressStr;
//options.pOptions[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS;
//options.pOptions[2].Value.pszValue = TEXT("local");
bReturn = InternetSetOption(NULL,INTERNET_OPTION_PER_CONNECTION_OPTION, &options, dwBufferSize);
delete [] options.pOptions;
InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
InternetSetOption(NULL, INTERNET_OPTION_REFRESH , NULL, 0);
return bReturn;
}
开发者ID:PowerOlive,项目名称:WinProxy4J,代码行数:32,代码来源:WinProxy.cpp
示例9: common_delProxy
//取消代理
//返回:true:成功,false:失败
bool common_delProxy()
{
HKEY hKey;
DWORD dwValue=0;
//打开注册表
if (RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", 0, KEY_ALL_ACCESS, &hKey))
{
return false;
}
//设置注册表键值
if (RegSetValueEx(hKey, L"ProxyEnable", 0, REG_DWORD,(LPBYTE)&dwValue, sizeof(DWORD)))
{
RegCloseKey(hKey);
return false;
}
RegCloseKey(hKey);
//发出通知
InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
InternetSetOption(NULL ,INTERNET_OPTION_REFRESH , NULL, 0);
return true;
}
开发者ID:340211173,项目名称:deianeira,代码行数:28,代码来源:common.cpp
示例10: unsetProxy
BOOL unsetProxy() {
INTERNET_PER_CONN_OPTION_LIST list;
INTERNET_PER_CONN_OPTION option[1];
BOOL bReturn;
DWORD nSize = sizeof(list);
option[0].dwOption = INTERNET_PER_CONN_FLAGS;
option[0].Value.dwValue = PROXY_TYPE_DIRECT;
list.dwSize = sizeof(list);
list.pszConnection = NULL;
list.dwOptionCount = 1;
list.dwOptionError = 0;
list.pOptions = option;
if (!InternetSetOption(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION, &list, nSize)) {
return FALSE;
}
if (!InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0)) {
return FALSE;
}
if (!InternetSetOption(NULL, INTERNET_OPTION_REFRESH, NULL, 0)) {
return FALSE;
}
return TRUE;
}
开发者ID:Jianru-Lin,项目名称:WinProxyTool,代码行数:29,代码来源:proxy.c
示例11: InternetOpen
BOOL CFtpFile::Connect()
{
HANDLE hThread;
DWORD dwThreadId;
DWORD dwExitCode;
if(m_UserProx == TRUE)
{
m_hHint = InternetOpen(NULL,INTERNET_OPEN_TYPE_PROXY,m_strProx.c_str(),NULL,INTERNET_FLAG_ASYNC);
}
else
{
m_hHint = InternetOpen(NULL,INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,INTERNET_FLAG_ASYNC);
}
long timeout1 = 60000;
long timeout2 = 120000;
InternetSetOption(m_hHint,INTERNET_OPTION_CONNECT_TIMEOUT,(LPVOID)&timeout1,4);
InternetSetOption(m_hHint,INTERNET_OPTION_SEND_TIMEOUT,(LPVOID)&timeout1,4);
InternetSetOption(m_hHint,INTERNET_OPTION_RECEIVE_TIMEOUT,(LPVOID)&timeout2,4);
InternetSetOption(m_hHint,INTERNET_OPTION_DATA_SEND_TIMEOUT,(LPVOID)&timeout1,4);
InternetSetOption(m_hHint,INTERNET_OPTION_DATA_RECEIVE_TIMEOUT,(LPVOID)&timeout2,4);
//wininet的超时设置是无效的,所以下面用线程来实现
hThread = CreateThread(
NULL,
0,
ConnectWork,
this,
0,
&dwThreadId);
//90秒都连接不上,就认为连不上
if(WaitForSingleObject(hThread,90*1000)==WAIT_TIMEOUT)
{
if(m_hHint)
{
InternetCloseHandle(m_hHint);
g_Datalog.Trace(LOGL_TOP,LOGT_WARNING, __TFILE__,__LINE__,_T("WaitTimeout 10s time not connect ftp"));
}
WaitForSingleObject(hThread, INFINITE);
g_Datalog.Trace(LOGL_TOP,LOGT_WARNING, __TFILE__,__LINE__,_T("WaitThread Terminate"));
m_hHint = NULL;
return FALSE;
}
//g_Datalog.Trace(LOGL_TOP,LOGT_PROMPT, __TFILE__,__LINE__, _T("FTP连接完成"));
dwExitCode = 0 ;
GetExitCodeThread(hThread, &dwExitCode);
g_Datalog.Trace(LOGL_TOP,LOGT_PROMPT, __TFILE__,__LINE__, _T("FTP连接完成 exitcode = %d"), dwExitCode);
CloseHandle(hThread);
if(dwExitCode)
{
return FALSE;
}
else
{
return TRUE;
}
}
开发者ID:vizcount,项目名称:work,代码行数:59,代码来源:FtpFile.cpp
示例12: togglePac
int togglePac(bool turnOn, const char* pacUrl)
{
int ret = RET_NO_ERROR;
INTERNET_PER_CONN_OPTION_LIST options;
DWORD dwBufferSize = sizeof(options);
options.dwSize = dwBufferSize;
options.pszConnection = FindActiveConnection();
options.dwOptionCount = 2;
options.pOptions = (INTERNET_PER_CONN_OPTION*)calloc(2, sizeof(INTERNET_PER_CONN_OPTION));
if(!options.pOptions) {
return NO_MEMORY;
}
options.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
options.pOptions[1].dwOption = INTERNET_PER_CONN_AUTOCONFIG_URL;
if (turnOn) {
options.pOptions[0].Value.dwValue = PROXY_TYPE_AUTO_PROXY_URL;
wchar_t url[150];
if (swprintf(url, 150, L"%hs", pacUrl) == -1) {
printf("Unable to convert pacUrl to wchar_t %s\n", strerror(errno));
ret = PAC_URL_CONVERSION_ERROR;
goto cleanup;
}
options.pOptions[1].Value.pszValue = (char*)pacUrl;
}
else {
options.pOptions[0].Value.dwValue = PROXY_TYPE_DIRECT;
options.pOptions[1].Value.pszValue = "";
}
BOOL result;
result = InternetSetOption(NULL,INTERNET_OPTION_PER_CONNECTION_OPTION, &options, dwBufferSize);
if (!result) {
reportWindowsError("setting options");
ret = SYSCALL_FAILED;
goto cleanup;
}
result = InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
if (!result) {
reportWindowsError("propagating changes");
ret = SYSCALL_FAILED;
goto cleanup;
}
result = InternetSetOption(NULL, INTERNET_OPTION_REFRESH , NULL, 0);
if (!result) {
reportWindowsError("refreshing");
ret = SYSCALL_FAILED;
goto cleanup;
}
cleanup:
free(options.pOptions);
return ret;
}
开发者ID:1498636925,项目名称:lantern,代码行数:56,代码来源:windows.c
示例13: strUser
STDMETHODIMP CBHttpRequest::setProxyCredentials(BSTR strUserName, BSTR strPassword)
{
CBStringA strUser(strUserName), strPass(strPassword);
if(!InternetSetOption(m_hFile, INTERNET_OPTION_PROXY_USERNAME, (LPSTR)(LPCSTR)strUser, strUser.GetLength() + 1))
return GetErrorResult();
if(!InternetSetOption(m_hFile, INTERNET_OPTION_PROXY_PASSWORD, (LPSTR)(LPCSTR)strPass, strPass.GetLength() + 1))
return GetErrorResult();
return S_OK;
}
开发者ID:pathletboy,项目名称:netbox,代码行数:11,代码来源:BHttpRequest.cpp
示例14: switch
bool Downloader::openInternet()
{
if(internet)
return true; //already opened
#ifdef _DEBUG
_TCHAR *atype;
switch(internetOptions.accessType)
{
case INTERNET_OPEN_TYPE_DIRECT : atype = _T("INTERNET_OPEN_TYPE_DIRECT"); break;
case INTERNET_OPEN_TYPE_PRECONFIG : atype = _T("INTERNET_OPEN_TYPE_PRECONFIG"); break;
case INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY: atype = _T("INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY"); break;
case INTERNET_OPEN_TYPE_PROXY : atype = _T("INTERNET_OPEN_TYPE_PROXY"); break;
default: atype = _T("Unknown (error)!");
}
TRACE(_T("Opening internet..."));
TRACE(_T(" access type: %s"), atype);
TRACE(_T(" proxy name : %s"), internetOptions.proxyName.empty() ? _T("(none)") : internetOptions.proxyName.c_str());
#endif
if(!internet)
if(!(internet = InternetOpen(internetOptions.userAgent.c_str(), internetOptions.accessType,
internetOptions.proxyName.empty() ? NULL : internetOptions.proxyName.c_str(),
NULL, 0)))
return false;
TRACE(_T("Setting timeouts..."));
if(internetOptions.connectTimeout != TIMEOUT_DEFAULT)
InternetSetOption(internet, INTERNET_OPTION_CONNECT_TIMEOUT, &internetOptions.connectTimeout, sizeof(DWORD));
if(internetOptions.sendTimeout != TIMEOUT_DEFAULT)
InternetSetOption(internet, INTERNET_OPTION_SEND_TIMEOUT, &internetOptions.sendTimeout, sizeof(DWORD));
if(internetOptions.receiveTimeout != TIMEOUT_DEFAULT)
InternetSetOption(internet, INTERNET_OPTION_RECEIVE_TIMEOUT, &internetOptions.receiveTimeout, sizeof(DWORD));
#ifdef _DEBUG
DWORD connectTimeout, sendTimeout, receiveTimeout, bufSize = sizeof(DWORD);
InternetQueryOption(internet, INTERNET_OPTION_CONNECT_TIMEOUT, &connectTimeout, &bufSize);
InternetQueryOption(internet, INTERNET_OPTION_SEND_TIMEOUT, &sendTimeout, &bufSize);
InternetQueryOption(internet, INTERNET_OPTION_RECEIVE_TIMEOUT, &receiveTimeout, &bufSize);
TRACE(_T("Internet options:"));
TRACE(_T(" Connect timeout: %d"), connectTimeout);
TRACE(_T(" Send timeout : %d"), sendTimeout);
TRACE(_T(" Receive timeout: %d"), receiveTimeout);
#endif
return true;
}
开发者ID:WPN-XM,项目名称:WPN-XM,代码行数:54,代码来源:downloader.cpp
示例15: GetCSRFToken
//------------------------------------------------------------------------------
void GetCSRFToken(VIRUSTOTAL_STR *vts)
{
HINTERNET M_connexion = 0;
if (!use_other_proxy)M_connexion = InternetOpen("",/*INTERNET_OPEN_TYPE_DIRECT*/INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE);
else M_connexion = InternetOpen("",/*INTERNET_OPEN_TYPE_DIRECT*/INTERNET_OPEN_TYPE_PROXY, proxy_ch_auth, NULL, 0);
if (M_connexion==NULL)M_connexion = InternetOpen("",INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE);
if (M_connexion==NULL)return;
//init connexion
HINTERNET M_session = InternetConnect(M_connexion, "www.virustotal.com",443,"","",INTERNET_SERVICE_HTTP,0,0);
if (M_session==NULL)
{
InternetCloseHandle(M_connexion);
return;
}
//connexion
HINTERNET M_requete = HttpOpenRequest(M_session,"GET","www.virustotal.com",NULL,"",NULL,
INTERNET_FLAG_NO_CACHE_WRITE|INTERNET_FLAG_SECURE
|INTERNET_FLAG_IGNORE_CERT_CN_INVALID|INTERNET_FLAG_IGNORE_CERT_DATE_INVALID,0);
if (use_proxy_advanced_settings)
{
InternetSetOption(M_requete,INTERNET_OPTION_PROXY_USERNAME,proxy_ch_user,sizeof(proxy_ch_user));
InternetSetOption(M_requete,INTERNET_OPTION_PROXY_PASSWORD,proxy_ch_password,sizeof(proxy_ch_password));
}
if (M_requete==NULL)
{
InternetCloseHandle(M_session);
InternetCloseHandle(M_connexion);
return;
}else if (HttpSendRequest(M_requete, NULL, 0, NULL, 0))
{
//traitement !!!
char buffer[MAX_PATH];
DWORD dwNumberOfBytesRead = MAX_PATH;
if(HttpQueryInfo(M_requete,HTTP_QUERY_SET_COOKIE, buffer, &dwNumberOfBytesRead, 0))
{
if (dwNumberOfBytesRead>42)buffer[42]=0;
//on passe : csrftoken=
strcpy(vts->token,buffer+10);
}
InternetCloseHandle(M_requete);
}
//close
InternetCloseHandle(M_session);
InternetCloseHandle(M_connexion);
}
开发者ID:lukevoliveir,项目名称:omnia-projetcs,代码行数:53,代码来源:tools_virustotal.c
示例16: SetWindowsProxy
BOOL SetWindowsProxy(WCHAR* szProxy, const WCHAR* szProxyInterface=NULL)
{
INTERNET_PER_CONN_OPTION_LIST conn_options;
BOOL bReturn;
DWORD dwBufferSize = sizeof(conn_options);
if (wcslen(szProxy) == 0)
{
conn_options.dwSize = dwBufferSize;
conn_options.pszConnection = (WCHAR*)szProxyInterface;
conn_options.dwOptionCount = 1;
conn_options.pOptions = (INTERNET_PER_CONN_OPTION*)malloc(sizeof(INTERNET_PER_CONN_OPTION)*conn_options.dwOptionCount);
conn_options.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
conn_options.pOptions[0].Value.dwValue = PROXY_TYPE_DIRECT;
}
else if (wcsstr(szProxy, L"://") != NULL)
{
conn_options.dwSize = dwBufferSize;
conn_options.pszConnection = (WCHAR*)szProxyInterface;
conn_options.dwOptionCount = 3;
conn_options.pOptions = (INTERNET_PER_CONN_OPTION*)malloc(sizeof(INTERNET_PER_CONN_OPTION)*conn_options.dwOptionCount);
conn_options.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
conn_options.pOptions[0].Value.dwValue = PROXY_TYPE_DIRECT | PROXY_TYPE_AUTO_PROXY_URL;
conn_options.pOptions[1].dwOption = INTERNET_PER_CONN_AUTOCONFIG_URL;
conn_options.pOptions[1].Value.pszValue = szProxy;
conn_options.pOptions[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS;
conn_options.pOptions[2].Value.pszValue = L"<local>";
}
else
{
conn_options.dwSize = dwBufferSize;
conn_options.pszConnection = (WCHAR*)szProxyInterface;
conn_options.dwOptionCount = 3;
conn_options.pOptions = (INTERNET_PER_CONN_OPTION*)malloc(sizeof(INTERNET_PER_CONN_OPTION)*conn_options.dwOptionCount);
conn_options.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
conn_options.pOptions[0].Value.dwValue = PROXY_TYPE_DIRECT | PROXY_TYPE_PROXY;
conn_options.pOptions[1].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
conn_options.pOptions[1].Value.pszValue = szProxy;
conn_options.pOptions[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS;
conn_options.pOptions[2].Value.pszValue = L"<local>";
}
bReturn = InternetSetOption(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION, &conn_options, dwBufferSize);
free(conn_options.pOptions);
InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
InternetSetOption(NULL, INTERNET_OPTION_REFRESH , NULL, 0);
return bReturn;
}
开发者ID:Anhored,项目名称:taskbar,代码行数:48,代码来源:taskbar.cpp
示例17: hook_InternetConnect
HINTERNET hook_InternetConnect(
HINTERNET hInternet,
LPCTSTR lpszServerName,
INTERNET_PORT nServerPort,
LPCTSTR lpszUsername,
LPCTSTR lpszPassword,
DWORD dwService,
DWORD dwFlags,
DWORD_PTR dwContext
)
{
if (Setting::m_bProxy)
{
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_FLAGS;
Option[1].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
List.dwSize = sizeof(INTERNET_PER_CONN_OPTION_LIST);
List.pszConnection = NULL;
List.dwOptionCount = 2;
List.dwOptionError = 0;
List.pOptions = Option;
Option[1].Value.pszValue = L"172.19.1.2:9217";
Option[0].Value.dwValue = PROXY_TYPE_PROXY ;
BOOL bRet = InternetSetOption(hInternet, INTERNET_OPTION_PER_CONNECTION_OPTION, &List, nSize);
}
return g_originConnect(hInternet, lpszServerName, nServerPort, lpszUsername, lpszPassword, dwService, dwFlags, dwContext);
}
开发者ID:kingweiliu,项目名称:Spark,代码行数:35,代码来源:HookCenter.cpp
示例18: wininet_set_timeout
static DWORD
wininet_set_timeout(
struct soap * soap,
struct wininet_data * a_pData,
const char * a_pszTimeout,
DWORD a_dwOption,
int a_nTimeout )
{
UNUSED_ARG( soap );
UNUSED_ARG( a_pszTimeout );
if ( a_nTimeout > 0 )
{
DWORD dwTimeout = a_nTimeout * 1000;
if ( !InternetSetOption( a_pData->hInternet,
a_dwOption, &dwTimeout, sizeof(DWORD) ) )
{
DWORD dwErrorCode = GetLastError();
DBGLOG(TEST, SOAP_MESSAGE(fdebug,
"wininet %p: failed to set %s timeout, error %d (%s)\n",
soap, a_pszTimeout, dwErrorCode,
wininet_error_message(soap,dwErrorCode) ));
return dwErrorCode;
}
}
return 0;
}
开发者ID:kusl,项目名称:TortoiseSVN,代码行数:27,代码来源:gsoapWinInet-2.8.0.cpp
示例19: KSI_HttpClientImpl_init
int KSI_HttpClientImpl_init(KSI_HttpClient *client) {
KSI_HttpClient *http = (KSI_HttpClient *)client;
HINTERNET internet_handle;
ULONG buf;
KSI_CTX *ctx = NULL;
int res;
if (client == NULL) {
res = KSI_INVALID_ARGUMENT;
goto cleanup;
}
ctx = client->parent.ctx;
KSI_ERR_clearErrors(ctx);
//Initializes an application's use of the Win32 Internet functions.
internet_handle = InternetOpenA(http->agentName, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
if (internet_handle == NULL) {
WININET_ERROR(ctx, GetLastError(), KSI_NETWORK_ERROR, "WinINet: Unable to init.");
}
/* By default WinINet allows just two simultaneous connections to one server. */
buf = 1024;
res = InternetSetOption(NULL, INTERNET_OPTION_MAX_CONNS_PER_SERVER, &buf, sizeof(buf));
if (res != TRUE) {
WININET_ERROR(ctx, GetLastError(), KSI_UNKNOWN_ERROR, "WinINet: Unable to init.");
}
res = InternetSetOption(NULL, INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER, &buf, sizeof(buf));
if (res != TRUE) {
WININET_ERROR(ctx, GetLastError(), KSI_UNKNOWN_ERROR, "WinINet: Unable to init.");
}
http->implCtx = internet_handle;
http->implCtx_free = implCtx_free;
internet_handle = NULL;
http->sendRequest = wininetSendRequest;
res = KSI_OK;
cleanup:
if (internet_handle) InternetCloseHandle(internet_handle);
return res;
}
开发者ID:khushil,项目名称:libksi,代码行数:47,代码来源:net_http_wininet.c
示例20: openConnection
void openConnection (URL_COMPONENTS& uc, HINTERNET sessionHandle,
URL::OpenStreamProgressCallback* progressCallback,
void* progressCallbackContext)
{
int disable = 1;
InternetSetOption (sessionHandle, INTERNET_OPTION_DISABLE_AUTODIAL, &disable, sizeof (disable));
if (timeOutMs == 0)
timeOutMs = 30000;
else if (timeOutMs < 0)
timeOutMs = -1;
InternetSetOption (sessionHandle, INTERNET_OPTION_CONNECT_TIMEOUT, &timeOutMs, sizeof (timeOutMs));
const bool isFtp = address.startsWithIgnoreCase ("ftp:");
#if WORKAROUND_TIMEOUT_BUG
connection = 0;
{
InternetConnectThread connectThread (uc, sessionHandle, connection, isFtp);
connectThread.wait (timeOutMs);
if (connection == 0)
{
InternetCloseHandle (sessionHandle);
sessionHandle = 0;
}
}
#else
connection = InternetConnect (sessionHandle, uc.lpszHostName, uc.nPort,
uc.lpszUserName, uc.lpszPassword,
isFtp ? (DWORD) INTERNET_SERVICE_FTP
: (DWORD) INTERNET_SERVICE_HTTP,
0, 0);
#endif
if (connection != 0)
{
if (isFtp)
request = FtpOpenFile (connection, uc.lpszUrlPath, GENERIC_READ,
FTP_TRANSFER_TYPE_BINARY | INTERNET_FLAG_NEED_FILE, 0);
else
openHTTPConnection (uc, progressCallback, progressCallbackContext);
}
}
开发者ID:Amcut,项目名称:pizmidi,代码行数:46,代码来源:juce_win32_Network.cpp
注:本文中的InternetSetOption函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论