diff --git a/README.md b/README.md index 22cf17c..3e8e836 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ Please do support Spotify by using premium!!!! ## Video, audio & banner adblock/skip for Spotify -**Current Version:** 0.22 +**Current Version:** 0.23 -**Last updated:** 14 September 2019 +**Last updated:** 16 September 2019 **Last tested version:** 1.1.15.448.g00fba0e3 diff --git a/chrome_elf.zip b/chrome_elf.zip index 208cf18..2fc0873 100644 Binary files a/chrome_elf.zip and b/chrome_elf.zip differ diff --git a/src/BlockTheSpot.vcxproj b/src/BlockTheSpot.vcxproj index b06b411..ce08700 100644 --- a/src/BlockTheSpot.vcxproj +++ b/src/BlockTheSpot.vcxproj @@ -50,6 +50,8 @@ chrome_elf $(ProjectDir)..\ + $(ACE_ROOT);$(IncludePath) + $(ACE_ROOT)\lib;$(LibraryPath) diff --git a/src/dllmain.cpp b/src/dllmain.cpp index 84a1448..6d68275 100644 --- a/src/dllmain.cpp +++ b/src/dllmain.cpp @@ -10,10 +10,21 @@ BOOL APIENTRY DllMain (HMODULE hModule, { case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls (hModule); - // block the ads banner by hostname - InstallHookApi ("ws2_32.dll", "getaddrinfo", getaddrinfohook); - // real ads block - InstallHookApi ("Winhttp.dll", "WinHttpOpenRequest", winhttpopenrequesthook); + // block the ads banner by hostname. + // but I like new song ad. + //InstallHookApi ("ws2_32.dll", "getaddrinfo", getaddrinfohook); + + // real ads block, no data out + InstallHookApi ("Winhttp.dll", "WinHttpSendRequest", winhttpsendrequesthook); + InstallHookApi ("Winhttp.dll", "WinHttpSetStatusCallback", winhttpsetstatuscallbackhook); + // we don't need it, for future only. + //InstallHookApi ("Winhttp.dll", "WinHttpWriteData", winhttpwritedatahook); + //InstallHookApi ("Winhttp.dll", "WinHttpReceiveResponse", winhttpreceiveresponsehook); + //InstallHookApi ("Winhttp.dll", "WinHttpQueryDataAvailable", winhttpquerydataavailablehook); + + // archive + // sent only clicked playlist data back to Spotify. + //InstallHookApi ("Winhttp.dll", "WinHttpOpenRequest", winhttpopenrequesthook); break; } return TRUE; diff --git a/src/hosts.cpp b/src/hosts.cpp index db3e0a8..81afe71 100644 --- a/src/hosts.cpp +++ b/src/hosts.cpp @@ -14,11 +14,16 @@ int WINAPI winhttpopenrequesthook (DWORD RetAddr, //"spclient.wg.spotify.com" //POST //L"/ad-logic/state/config" - //L"/playlist-publish/v1/subscription/playlist/xxxxx" - //GET + //L"/ad-logic/flashpoint" /* this is ad between song/popup */ + //L"/playlist-publish/v1/subscription/playlist/xxxxx" /* sent when change playlist */ + //GET /* payload are base64 */ //L"/ads/v2/config?payload=xxxxx" + //L"/ads/v1/ads/hpto?payload=xxxxx" //L"/ads/v1/ads/leaderboard?payload=xxxxx - //HEADER + //L"/pagead/conversion/?ai=xxxxx" + //L"/monitoring?pload=xxxxx" + //L"/pcs/view?xai=xxxxx" + //HEADER /* add into every request */ //L"User-Agent: Spotify/111500448 Win32/0 (PC laptop)" //L"Authorization: Bearer xxxxx" @@ -31,10 +36,12 @@ int WINAPI winhttpopenrequesthook (DWORD RetAddr, ppwszAcceptTypes, dwFlags); } - return NULL; + else { + // the failed will retry.. not good. + return 0; + } } - int WINAPI getaddrinfohook (DWORD RetAddr, pfngetaddrinfo fngetaddrinfo, const char* nodename, @@ -49,3 +56,54 @@ int WINAPI getaddrinfohook (DWORD RetAddr, } return fngetaddrinfo (nodename, servname, hints, res); } + +int WINAPI winhttpsendrequesthook (DWORD RetAddr, + pfnwinhttpsendrequest fnwinhttpsendrequest, + HINTERNET hRequest, + LPCWSTR pwszHeaders, + DWORD dwHeadersLength, + LPVOID lpOptional, + DWORD dwOptionalLength, + DWORD dwTotalLength, + DWORD_PTR dwContext) +{ + return 1; // return success but nothing sent +} + +int WINAPI winhttpwritedatahook (DWORD RetAddr, + pfnwinhttpwritedata fnwinhttpwritedata, + HINTERNET hRequest, + LPCVOID lpBuffer, + DWORD dwNumberOfBytesToWrite, + LPDWORD lpdwNumberOfBytesWritten) +{ + return 1; // return success but nothing write +} + +int WINAPI winhttpreceiveresponsehook (DWORD RetAddr, + pfnwinhttpreceiveresponse fnwinhttpreceiveresponse, + HINTERNET hRequest, + LPVOID lpReserved) +{ + return 1; // return success but nothing receive +} + +int WINAPI winhttpquerydataavailablehook (DWORD RetAddr, + pfnwinhttpquerydataavailable fnwinhttpquerydataavailable, + HINTERNET hRequest, + LPDWORD lpdwNumberOfBytesAvailable) +{ + //lpdwNumberOfBytesAvailable = 0; + return 1; // return success with 0 byte to read +} + +int WINAPI winhttpsetstatuscallbackhook (DWORD RetAddr, + pfnwinhttpsetstatuscallback fnwinhttpsetstatuscallback, + HINTERNET hInternet, + WINHTTP_STATUS_CALLBACK lpfnInternetCallback, + DWORD dwNotificationFlags, + DWORD_PTR dwReserved) +{ + // lpfnInternetCallback - Set this to NULL to remove the existing callback function. + return fnwinhttpsetstatuscallback (hInternet, NULL, dwNotificationFlags, NULL); +} diff --git a/src/hosts.h b/src/hosts.h index 6fe4e67..ce5ac5c 100644 --- a/src/hosts.h +++ b/src/hosts.h @@ -14,6 +14,30 @@ typedef int (__stdcall* pfnwinhttpopenrequest)(HINTERNET hConnect, LPCWSTR* ppwszAcceptTypes, DWORD dwFlags); +typedef int (__stdcall* pfnwinhttpquerydataavailable)(HINTERNET hRequest, + LPDWORD lpdwNumberOfBytesAvailable); + +typedef int (__stdcall* pfnwinhttpsendrequest)(HINTERNET hRequest, + LPCWSTR pwszHeaders, + DWORD dwHeadersLength, + LPVOID lpOptional, + DWORD dwOptionalLength, + DWORD dwTotalLength, + DWORD_PTR dwContext); + +typedef int (__stdcall* pfnwinhttpwritedata) (HINTERNET hRequest, + LPCVOID lpBuffer, + DWORD dwNumberOfBytesToWrite, + LPDWORD lpdwNumberOfBytesWritten); + +typedef int (__stdcall* pfnwinhttpreceiveresponse) (HINTERNET hRequest, + LPVOID lpReserved); + +typedef int (__stdcall* pfnwinhttpsetstatuscallback) (HINTERNET hInternet, + WINHTTP_STATUS_CALLBACK lpfnInternetCallback, + DWORD dwNotificationFlags, + DWORD_PTR dwReserved); + int WINAPI winhttpopenrequesthook (DWORD RetAddr, pfnwinhttpopenrequest fnwinhttpopenrequest, HINTERNET hConnect, @@ -32,6 +56,40 @@ int WINAPI getaddrinfohook (DWORD RetAddr, const struct addrinfo* hints, struct addrinfo** res); +int WINAPI winhttpquerydataavailablehook (DWORD RetAddr, + pfnwinhttpquerydataavailable fnwinhttpquerydataavailable, + HINTERNET hRequest, + LPDWORD lpdwNumberOfBytesAvailable); + +int WINAPI winhttpsendrequesthook (DWORD RetAddr, + pfnwinhttpsendrequest fnwinhttpsendrequest, + HINTERNET hRequest, + LPCWSTR pwszHeaders, + DWORD dwHeadersLength, + LPVOID lpOptional, + DWORD dwOptionalLength, + DWORD dwTotalLength, + DWORD_PTR dwContext); + +int WINAPI winhttpwritedatahook (DWORD RetAddr, + pfnwinhttpwritedata fnwinhttpwritedata, + HINTERNET hRequest, + LPCVOID lpBuffer, + DWORD dwNumberOfBytesToWrite, + LPDWORD lpdwNumberOfBytesWritten); + +int WINAPI winhttpreceiveresponsehook (DWORD RetAddr, + pfnwinhttpreceiveresponse fnwinhttpreceiveresponse, + HINTERNET hRequest, + LPVOID lpReserved); + +int WINAPI winhttpsetstatuscallbackhook (DWORD RetAddr, + pfnwinhttpsetstatuscallback fnwinhttpsetstatuscallback, + HINTERNET hInternet, + WINHTTP_STATUS_CALLBACK lpfnInternetCallback, + DWORD dwNotificationFlags, + DWORD_PTR dwReserved); + static const char* blockhost[] = { // fork this if you found more... I'll check if had time. "google.ac", @@ -487,6 +545,7 @@ static const char* blockhost[] = { "beacons5.gvt3.com", "clients2.google.com", "crashdump.spotify.com", + "invitemedia.com", "adeventtracker.spotify.com", /* ad tracker */ "dealer.spotify.com" /* unknown */ //"cache.spotify.com" /* not working */