1.14.0
This commit is contained in:
parent
1a100dccbe
commit
f22661c99c
|
@ -291,7 +291,9 @@ static BOOLEAN WSA_TraceFlag = FALSE;
|
|||
|
||||
static BOOLEAN WSA_ProxyEnabled = FALSE;
|
||||
static NETPROXY_RULE* WSA_Proxy = NULL;
|
||||
#ifdef PROXY_RESOLVE_HOST_NAMES
|
||||
HASH_MAP DNS_LookupMap;
|
||||
#endif
|
||||
|
||||
typedef struct _WSA_SOCK {
|
||||
ULONG NonBlocking;
|
||||
|
@ -1357,7 +1359,10 @@ _FX BOOLEAN WSA_Init(HMODULE module)
|
|||
/*P_recvfrom recvfrom;
|
||||
P_WSARecvFrom WSARecvFrom;*/
|
||||
P_closesocket closesocket;
|
||||
|
||||
#ifdef PROXY_RESOLVE_HOST_NAMES
|
||||
P_GetAddrInfoW GetAddrInfoW;
|
||||
#endif
|
||||
|
||||
//
|
||||
// initialize the network firewall rule list and hook the relevant functions
|
||||
|
@ -1500,7 +1505,10 @@ _FX BOOLEAN WSA_Init(HMODULE module)
|
|||
__sys_shutdown = (P_shutdown)GetProcAddress(module, "shutdown");
|
||||
|
||||
__sys_inet_ntop = (P_inet_ntop)GetProcAddress(module, "inet_ntop");
|
||||
|
||||
#ifdef PROXY_RESOLVE_HOST_NAMES
|
||||
if(WSA_ProxyEnabled && SbieApi_QueryConfBool(NULL, L"NetworkProxyResolveHostnames", FALSE)) {
|
||||
|
||||
map_init(&DNS_LookupMap, Dll_Pool);
|
||||
|
||||
GetAddrInfoW = (P_GetAddrInfoW)GetProcAddress(module, "GetAddrInfoW");
|
||||
|
@ -1508,6 +1516,7 @@ _FX BOOLEAN WSA_Init(HMODULE module)
|
|||
SBIEDLL_HOOK(WSA_,GetAddrInfoW);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
closesocket = (P_closesocket)GetProcAddress(module, "closesocket");
|
||||
if (closesocket) {
|
||||
|
@ -1766,7 +1775,7 @@ _FX HRESULT Net_Common_ImageNamePut(
|
|||
// WSA_GetAddrInfoW
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
#ifdef PROXY_RESOLVE_HOST_NAMES
|
||||
_FX int WSA_GetAddrInfoW(
|
||||
PCWSTR pNodeName,
|
||||
PCWSTR pServiceName,
|
||||
|
@ -1796,3 +1805,4 @@ _FX int WSA_GetAddrInfoW(
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
|
@ -64,7 +64,9 @@
|
|||
extern P_recv __sys_recv;
|
||||
extern P_send __sys_send;
|
||||
extern P_inet_ntop __sys_inet_ntop;
|
||||
#ifdef PROXY_RESOLVE_HOST_NAMES
|
||||
extern HASH_MAP DNS_LookupMap;
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// socks5_handshake
|
||||
|
@ -251,6 +253,7 @@ _FX char socks5_request(SOCKET s, const SOCKADDR* addr)
|
|||
char* ptr = req + 3;
|
||||
if (addr->sa_family == AF_INET) {
|
||||
const SOCKADDR_IN* v4 = (const SOCKADDR_IN*)addr;
|
||||
#ifdef PROXY_RESOLVE_HOST_NAMES
|
||||
char* domain = (char*)map_get(&DNS_LookupMap, (void*)v4->sin_addr.s_addr);
|
||||
if (domain) {
|
||||
*ptr++ = SOCKS_DOMAINNAME;
|
||||
|
@ -259,8 +262,10 @@ _FX char socks5_request(SOCKET s, const SOCKADDR* addr)
|
|||
ptr += strlen(domain);
|
||||
*((USHORT*)ptr) = v4->sin_port;
|
||||
ptr += sizeof(USHORT);
|
||||
}
|
||||
else {
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
*ptr++ = SOCKS_IPV4;
|
||||
*((ULONG*)ptr) = v4->sin_addr.s_addr;
|
||||
ptr += sizeof(ULONG);
|
||||
|
@ -270,6 +275,7 @@ _FX char socks5_request(SOCKET s, const SOCKADDR* addr)
|
|||
}
|
||||
else if (addr->sa_family == AF_INET6) {
|
||||
const SOCKADDR_IN6_LH* v6 = (const SOCKADDR_IN6_LH*)addr;
|
||||
#ifdef PROXY_RESOLVE_HOST_NAMES
|
||||
char* domain = (char*)map_get(&DNS_LookupMap, (void*)&v6->sin6_addr.s6_addr);
|
||||
if (domain) {
|
||||
*ptr++ = SOCKS_DOMAINNAME;
|
||||
|
@ -279,7 +285,9 @@ _FX char socks5_request(SOCKET s, const SOCKADDR* addr)
|
|||
*((USHORT*)ptr) = v6->sin6_port;
|
||||
ptr += sizeof(USHORT);
|
||||
}
|
||||
else {
|
||||
else
|
||||
#endif
|
||||
{
|
||||
*ptr++ = SOCKS_IPV6;
|
||||
memcpy(ptr, &v6->sin6_addr, sizeof(v6->sin6_addr));
|
||||
ptr += sizeof(v6->sin6_addr);
|
||||
|
|
|
@ -59,6 +59,8 @@ void COptionsWindow::CreateNetwork()
|
|||
|
||||
connect(ui.chkBlockDns, SIGNAL(clicked(bool)), this, SLOT(OnBlockDns()));
|
||||
connect(ui.chkBlockSamba, SIGNAL(clicked(bool)), this, SLOT(OnBlockSamba()));
|
||||
|
||||
ui.chkProxyResolveHostnames->setVisible(false);
|
||||
}
|
||||
|
||||
void COptionsWindow::OnBlockDns()
|
||||
|
@ -942,7 +944,7 @@ void COptionsWindow::OnNetProxyItemDoubleClicked(QTreeWidgetItem* pItem, int Col
|
|||
|
||||
void COptionsWindow::LoadNetProxy()
|
||||
{
|
||||
ui.chkProxyResolveHostnames->setChecked(m_pBox->GetBool("NetworkProxyResolveHostnames", false));
|
||||
//ui.chkProxyResolveHostnames->setChecked(m_pBox->GetBool("NetworkProxyResolveHostnames", false));
|
||||
|
||||
ui.treeProxy->clear();
|
||||
foreach(const QString & Value, m_pBox->GetTextList("NetworkUseProxy", m_Template))
|
||||
|
@ -1003,7 +1005,7 @@ void COptionsWindow::ParseAndAddNetProxy(const QString& Value, bool disabled, co
|
|||
|
||||
void COptionsWindow::SaveNetProxy()
|
||||
{
|
||||
WriteAdvancedCheck(ui.chkProxyResolveHostnames, "NetworkProxyResolveHostnames", "y", "");
|
||||
//WriteAdvancedCheck(ui.chkProxyResolveHostnames, "NetworkProxyResolveHostnames", "y", "");
|
||||
|
||||
QStringList NetworkUseProxy;
|
||||
QStringList NetworkUseProxyDisabled;
|
||||
|
|
Loading…
Reference in New Issue