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