Skip to content

Commit cbc8539

Browse files
author
mrpond
committed
0.37 WInhttp Option
1 parent 0a0dd1f commit cbc8539

File tree

4 files changed

+26
-14
lines changed

4 files changed

+26
-14
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<h4 align="center">A multi-purpose adblocker and skip bypass for the <strong>Windows</strong> Spotify Desktop Application.</h4>
44
<h5 align="center">Please support Spotify by purchasing premium</h5>
55
<p align="center">
6-
<strong>Current Version:</strong> 0.36 <br>
7-
<strong>Last updated:</strong> 17 November 2019 <br>
6+
<strong>Current Version:</strong> 0.37 <br>
7+
<strong>Last updated:</strong> 18 November 2019 <br>
88
<strong>Last tested version:</strong> 1.1.19.480.g7d17e3ce
99
</p>
1010
<h4 align="center">Important Notice(s)</h4>
@@ -41,5 +41,7 @@ going out to Adguard DNS Server.
4141
#### Known Issues and Caveats:
4242
* Ads Blocking may not work if you had proxy use in network.
4343
set Skip_wpad in config.ini to 1 may help.
44+
* Ads Blockng on system may not work e.g.(windows 7)
45+
set WinHttpReadDataFix in config.ini to 1 mayhelp
4446
* Built-in AdGuard DNS lookup, maybe cause application slowdown,
4547
set AdGuardDNS in config.ini to 0 to turn this feature off.

chrome_elf.zip

35 Bytes
Binary file not shown.

src/dllmain.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
extern bool g_UseAdGuard;
55
extern bool g_Log;
66
extern bool g_Skip_wpad;
7+
extern bool g_WinHttpReadDataFix;
78

89
extern std::ofstream Log_DNS;
910
extern std::ofstream Log_GetAddr;
@@ -18,14 +19,14 @@ BOOL APIENTRY DllMain (HMODULE hModule,
1819
{
1920
case DLL_PROCESS_ATTACH:
2021
DisableThreadLibraryCalls (hModule);
21-
if (GetPrivateProfileIntA ("Config", "AdGuardDNS", 1, "./config.ini") == 1)
22-
g_UseAdGuard = true;
23-
else
22+
if (0 == GetPrivateProfileIntA ("Config", "AdGuardDNS", 1, "./config.ini"))
2423
g_UseAdGuard = false;
25-
if (GetPrivateProfileIntA ("Config", "Log", 0, "./config.ini") == 1)
24+
if (0 < GetPrivateProfileIntA ("Config", "Log", 0, "./config.ini"))
2625
g_Log = true;
27-
if (GetPrivateProfileIntA ("Config", "Skip_wpad", 0, "./config.ini") == 1)
26+
if (0 < GetPrivateProfileIntA ("Config", "Skip_wpad", 0, "./config.ini"))
2827
g_Skip_wpad = true;
28+
if (0 < GetPrivateProfileIntA ("Config", "WinHttpReadDataFix", 0, "./config.ini"))
29+
g_WinHttpReadDataFix = true;
2930

3031
if (g_Log) {
3132
Log_DNS.open ("log_dnsquery.txt",
@@ -34,7 +35,10 @@ BOOL APIENTRY DllMain (HMODULE hModule,
3435
std::ios::out | std::ios::app);
3536
Log_WinHttp.open ("log_winhttp.txt",
3637
std::ios::out | std::ios::app);
38+
if (!g_UseAdGuard)
39+
Log_DNS << "AdGuard DNS Disable!\n";
3740
}
41+
3842
// block ads banner by hostname.
3943
InstallHookApi ("ws2_32.dll", "getaddrinfo", getaddrinfohook);
4044
// block ads by manipulate json response.

src/hosts.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
bool g_UseAdGuard = true;
44
bool g_Log = false;
55
bool g_Skip_wpad = false;
6+
bool g_WinHttpReadDataFix = false;
67

78
std::ofstream Log_DNS;
89
std::ofstream Log_GetAddr;
@@ -66,20 +67,23 @@ int WINAPI getaddrinfohook (DWORD RetAddr,
6667
const struct addrinfo* hints,
6768
struct addrinfo** res)
6869
{
70+
71+
// Web Proxy Auto-Discovery (WPAD)
72+
if (g_Skip_wpad) {
73+
if (0 == _stricmp (nodename, "wpad"))
74+
return WSANO_RECOVERY;
75+
}
76+
77+
if (NULL != strstr (nodename, "google"))
78+
return WSANO_RECOVERY;
79+
6980
auto result = fngetaddrinfo (nodename,
7081
servname,
7182
hints,
7283
res);
7384

7485
// GetAddrInfo return 0 on success
7586
if (0 == result) {
76-
// Web Proxy Auto-Discovery (WPAD)
77-
if (0 == _stricmp (nodename, "wpad"))
78-
return g_Skip_wpad ? WSANO_RECOVERY : result;
79-
80-
if (NULL != strstr (nodename, "google"))
81-
return WSANO_RECOVERY;
82-
8387
// AdGuard DNS
8488
if (adguard_dnsblock (nodename))
8589
return WSANO_RECOVERY;
@@ -121,6 +125,8 @@ int WINAPI winhttpreaddatahook (DWORD RetAddr,
121125
Log_WinHttp << "Byte count: " << dwNumberOfBytesToRead << '\n';
122126
Log_WinHttp << data << '\n';
123127
}
128+
if (g_WinHttpReadDataFix) return false;
129+
124130
SecureZeroMemory (lpBuffer, dwNumberOfBytesToRead);
125131
return true;
126132
}

0 commit comments

Comments
 (0)