Skip to content

Commit 0a0dd1f

Browse files
author
mrpond
committed
0.36
1 parent 5ff5050 commit 0a0dd1f

File tree

4 files changed

+52
-56
lines changed

4 files changed

+52
-56
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ A clear and concise description of what the bug is.
1616

1717
**Additional context**
1818
Make sure you use [latest blockthespot](https://github.com/mrpond/BlockTheSpot/releases) before report a bug.
19-
Add any other context about the problem here. If ad blocking is not working, please include a [ListDLLs](https://docs.microsoft.com/en-us/sysinternals/downloads/listdlls) log by running `listdlls Spotify.exe` with Spotify running in the background.
19+
Add any other context about the problem here. If ad blocking is not working, please include a debug Log
20+
by edit config.ini and set Log = 1 after ads play close spotify and zip the log_*.txt.

README.md

Lines changed: 5 additions & 5 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.35 <br>
7-
<strong>Last updated:</strong> 16 November 2019 <br>
6+
<strong>Current Version:</strong> 0.36 <br>
7+
<strong>Last updated:</strong> 17 November 2019 <br>
88
<strong>Last tested version:</strong> 1.1.19.480.g7d17e3ce
99
</p>
1010
<h4 align="center">Important Notice(s)</h4>
@@ -26,17 +26,17 @@
2626
1. Browse to Spotify installation folder `%APPDATA%/Spotify`
2727
2. Backup existing `chrome_elf.dll` by renaming it (e.g. chrome_elf.bak)
2828
3. Download [chrome_elf.zip](chrome_elf.zip)
29-
4. Extract chrome_elf.dll from chrome_elf.zip to that folder.
29+
4. Extract chrome_elf.dll, config.ini from chrome_elf.zip to that folder.
3030

3131
#### Uninstall:
3232
1. Browse to Spotify installation folder `%APPDATA%/Spotify`
33-
2. Simply delete chrome_elf.dll from your Spotify installation
33+
2. Simply delete chrome_elf.dll, config.ini from your Spotify installation
3434
3. Rename your backup dll to chrome_elf.dll
3535

3636
#### Note:
3737
* Built-in AdGuard DNS lookup, paranoid people may see additional DNS traffic UDP(53)
3838
going out to Adguard DNS Server.
39-
*if you can't reach AdGuard DNS for some reason, things still working as expected.
39+
* if you can't reach AdGuard DNS for some reason, things still working as expected.
4040

4141
#### Known Issues and Caveats:
4242
* Ads Blocking may not work if you had proxy use in network.

src/hosts.cpp

Lines changed: 45 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,43 @@ bool adguard_dnsblock (const char* nodename) {
1919
PIP4_ARRAY pSrvList = NULL;
2020
bool isBlock = false;
2121

22+
if (!g_UseAdGuard) return false;
23+
2224
pSrvList = (PIP4_ARRAY)LocalAlloc (LPTR, sizeof (IP4_ARRAY));
2325

24-
while (pSrvList) {
25-
26-
if (inet_pton (AF_INET,
27-
g_DNSIP, // dns server ip
28-
&pSrvList->AddrArray[0]) != 1)
29-
break;
30-
pSrvList->AddrCount = 1;
31-
32-
dnsStatus = DnsQuery_A (nodename,
33-
DNS_TYPE_A,
34-
DNS_QUERY_WIRE_ONLY,
35-
pSrvList,
36-
&QueryResult,
37-
NULL); // Reserved
38-
39-
// DnsQuery return 0 - success
40-
if (dnsStatus) {
41-
if (g_Log) {
42-
Log_DNS << nodename << " DNS status: " << dnsStatus
43-
<< " GLE: " << GetLastError () << '\n';
44-
}
45-
break;
26+
if (pSrvList) {
27+
28+
if (0 == InetPtonA (AF_INET,
29+
"176.103.130.134", // dns server ip
30+
&pSrvList->AddrArray[0])) {
31+
// "Family protection"
32+
// adguard.com/en/adguard-dns/overview.html
33+
pSrvList->AddrCount = 1;
34+
35+
dnsStatus = DnsQuery_A (nodename,
36+
DNS_TYPE_A,
37+
DNS_QUERY_WIRE_ONLY,
38+
pSrvList,
39+
&QueryResult,
40+
NULL); // Reserved
41+
if (0 == dnsStatus) {
42+
if (QueryResult) {
43+
for (auto p = QueryResult; p; p = p->pNext) {
44+
// 0.0.0.0
45+
if (p->Data.A.IpAddress == 0)
46+
isBlock = true; // AdGuard Block
47+
}
48+
DnsRecordListFree (QueryResult, DnsFreeRecordList);
49+
} // QueryResult
50+
} // dnsStatus
51+
} // inet_pton
52+
53+
LocalFree (pSrvList);
54+
55+
if (g_Log && isBlock) {
56+
Log_DNS << nodename << " blocked" << '\n';
4657
}
47-
48-
if (!QueryResult) break;
49-
50-
for (auto p = QueryResult; p; p = p->pNext) {
51-
// 0.0.0.0
52-
if (p->Data.A.IpAddress == 0) isBlock = true; // AdGuard Block
53-
}
54-
DnsRecordListFree (QueryResult, DnsFreeRecordList);
55-
break;
56-
}
57-
58-
if (pSrvList) LocalFree (pSrvList);
58+
} // pSrvList
5959
return isBlock;
6060
}
6161

@@ -72,24 +72,23 @@ int WINAPI getaddrinfohook (DWORD RetAddr,
7272
res);
7373

7474
// GetAddrInfo return 0 on success
75-
if (result != 0) return result;
76-
77-
// Web Proxy Auto-Discovery (WPAD)
78-
if (_stricmp (nodename, "wpad") == 0)
79-
return g_Skip_wpad ? WSANO_RECOVERY : result;
75+
if (0 == result) {
76+
// Web Proxy Auto-Discovery (WPAD)
77+
if (0 == _stricmp (nodename, "wpad"))
78+
return g_Skip_wpad ? WSANO_RECOVERY : result;
8079

81-
if (strstr (nodename, "google") != NULL)
82-
return WSANO_RECOVERY;
80+
if (NULL != strstr (nodename, "google"))
81+
return WSANO_RECOVERY;
8382

84-
// AdGuard DNS
85-
if (g_UseAdGuard) {
83+
// AdGuard DNS
8684
if (adguard_dnsblock (nodename))
8785
return WSANO_RECOVERY;
88-
}
8986

90-
if (g_Log) {
91-
Log_GetAddr << nodename << '\n';
87+
if (g_Log) {
88+
Log_GetAddr << nodename << '\n';
89+
}
9290
}
91+
9392
return result;
9493
}
9594

src/hosts.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#ifndef _HOSTS_H
22
#define _HOSTS_H
33

4-
// "Family protection"
5-
// adguard.com/en/adguard-dns/overview.html
6-
static const char* g_DNSIP = "176.103.130.134";
7-
84
typedef int (__stdcall* pfngetaddrinfo)(const char* nodename,
95
const char* servname,
106
const struct addrinfo* hints,

0 commit comments

Comments
 (0)