diff --git a/README.md b/README.md
index 7bef53a7..33c65dbe 100644
--- a/README.md
+++ b/README.md
@@ -11,8 +11,8 @@
A multi-purpose adblocker and skip-bypass for the Windows Spotify desktop application.
Please support Spotify by purchasing premium
- Last updated: 24 March 2020
- Last tested version: 1.1.56.595.g2d2da0de
+ Last updated: 21 April 2021
+ Last tested version: 1.1.57.443.ga029a6c4(-a)
diff --git a/src/Logger.h b/src/Logger.h
index 61d43059..597af7ff 100644
--- a/src/Logger.h
+++ b/src/Logger.h
@@ -28,7 +28,7 @@ class Logger {
void Log (std::string_view log) {
if (m_active)
- m_log << log << std::endl;
+ m_log << log << '\n';
}
private:
diff --git a/src/Modify.cpp b/src/Modify.cpp
index 3d7ead79..7dac40eb 100644
--- a/src/Modify.cpp
+++ b/src/Modify.cpp
@@ -1,7 +1,7 @@
#include "Modify.h"
#include "Logger.h"
-extern Logger g_Logger;
+extern Logger *g_Logger;
// https://www.unknowncheats.me/forum/1064672-post23.html
bool DataCompare (BYTE* pData, BYTE* bSig, char* szMask)
@@ -31,17 +31,15 @@ BYTE* FindPattern (BYTE* dwAddress, DWORD dwSize, BYTE* pbSig, char* szMask)
return 0;
}
-DWORD WINAPI KillBanner (LPVOID conf)
+DWORD WINAPI KillBanner (LPVOID)
{
- auto config = static_cast(conf);
- auto* logger = new Logger (config);
HMODULE hModule = GetModuleHandle (NULL);
MODULEINFO mInfo = { 0 };
if (GetModuleInformation (GetCurrentProcess (), hModule, &mInfo, sizeof (MODULEINFO))) {
- logger->Log ("GetModuleInformation OK!");
+ g_Logger->Log ("GetModuleInformation OK!");
LPVOID skipPod = FindPattern ((uint8_t*)hModule, mInfo.SizeOfImage, (BYTE*)"\x83\xC4\x08\x84\xC0\x0F\x84\x00\x04\x00\x00", "xxxxxxxxxxx");
- if (skipPod)
+ if (skipPod) // spotify
{
DWORD oldProtect;
VirtualProtect ((char*)skipPod + 5, 1, PAGE_EXECUTE_READWRITE, &oldProtect);
@@ -51,15 +49,47 @@ DWORD WINAPI KillBanner (LPVOID conf)
VirtualProtect ((char*)skipPod + 6, 1, PAGE_EXECUTE_READWRITE, &oldProtect);
memset ((char*)skipPod + 6, 0xE9, 1);
VirtualProtect ((char*)skipPod + 6, 1, oldProtect, &oldProtect);
- logger->Log ("main process - patch success!");
+ g_Logger->Log ("main process#1 - patch success!");
}
else {
- logger->Log ("main process - patch failed!");
+ g_Logger->Log ("main process#1 - patch failed!");
}
+
+ skipPod = FindPattern ((uint8_t*)hModule, mInfo.SizeOfImage, (BYTE*)"\x83\xC4\x08\x84\xC0\x0F\x84\xE5\x03\x00\x00", "xxxxxxxxxxx");
+
+ if (skipPod) // spotify alpha
+ {
+ DWORD oldProtect;
+ VirtualProtect ((char*)skipPod + 5, 1, PAGE_EXECUTE_READWRITE, &oldProtect);
+ memset ((char*)skipPod + 5, 0x90, 1);
+ VirtualProtect ((char*)skipPod + 5, 1, oldProtect, &oldProtect);
+
+ VirtualProtect ((char*)skipPod + 6, 1, PAGE_EXECUTE_READWRITE, &oldProtect);
+ memset ((char*)skipPod + 6, 0xE9, 1);
+ VirtualProtect ((char*)skipPod + 6, 1, oldProtect, &oldProtect);
+ g_Logger->Log ("main process#2 - patch success!");
+ }
+ else {
+ g_Logger->Log ("main process#2 - patch failed!");
+ }
+
+ //skipPod = FindPattern ((uint8_t*)hModule, mInfo.SizeOfImage, (BYTE*)"\x48\x83\xF8\x03\x77", "xxxxx");
+
+ //if (skipPod)
+ //{
+ // DWORD oldProtect;
+ // VirtualProtect ((char*)skipPod + 4, 1, PAGE_EXECUTE_READWRITE, &oldProtect);
+ // memset ((char*)skipPod + 4, 0xEB, 1);
+ // VirtualProtect ((char*)skipPod + 4, 1, oldProtect, &oldProtect);
+ // g_Logger->Log ("main process#3 - patch success!");
+ //}
+ //else {
+ // g_Logger->Log ("main process#3 - patch failed!");
+ //}
}
else {
- logger->Log ("GetModuleInformation failed!");
+ g_Logger->Log ("GetModuleInformation failed!");
}
-
+ g_Logger->~Logger ();
return 0;
}
diff --git a/src/Modify.h b/src/Modify.h
index 623c2862..858cbdf5 100644
--- a/src/Modify.h
+++ b/src/Modify.h
@@ -2,4 +2,4 @@
#include "stdafx.h"
-DWORD WINAPI KillBanner (LPVOID config);
\ No newline at end of file
+DWORD WINAPI KillBanner (LPVOID);
\ No newline at end of file
diff --git a/src/dllmain.cpp b/src/dllmain.cpp
index b1ee245c..0528d772 100644
--- a/src/dllmain.cpp
+++ b/src/dllmain.cpp
@@ -7,6 +7,10 @@
extern _getaddrinfo getaddrinfo_orig;
+
+Config g_Config;
+Logger *g_Logger = new Logger (&g_Config);
+
BOOL APIENTRY DllMain (HMODULE hModule,
DWORD ul_reason_for_call, LPVOID lpReserved)
{
@@ -17,25 +21,23 @@ BOOL APIENTRY DllMain (HMODULE hModule,
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
- auto *config = new Config();
- if (std::string_view::npos == procname.find ("--type=") && false == config->getConfig("Block_BannerOnly")) {
+ if (std::string_view::npos == procname.find ("--type=") && false == g_Config.getConfig("Block_BannerOnly")) {
// block ads request - main process
- CreateThread (NULL, NULL, KillBanner, config, 0, NULL);
+ CreateThread (NULL, NULL, KillBanner, NULL, 0, NULL);
//g_Logger.setLogfile ("main_log.txt");
}
else if (std::string_view::npos != procname.find ("--type=utility")) {
// block ads banner by hostname - utility process
//g_Logger.setLogfile ("utility_log.txt");
- auto *log = new Logger (config);
getaddrinfo_orig = getaddrinfo;
if (getaddrinfo_orig) {
Mhook_SetHook ((PVOID*)&getaddrinfo_orig, getaddrinfo_hook);
- log->Log ("Mhook_SetHook - getaddrinfo success!");
+ g_Logger->Log ("Mhook_SetHook - getaddrinfo success!");
}
else {
- log->Log ("Mhook_SetHook - getaddrinfo failed!");
+ g_Logger->Log ("Mhook_SetHook - getaddrinfo failed!");
}
- log->~Logger ();
+ g_Logger->~Logger ();
}
break;
}
diff --git a/src/hosts.cpp b/src/hosts.cpp
index efe61ceb..42f29d0a 100644
--- a/src/hosts.cpp
+++ b/src/hosts.cpp
@@ -4,22 +4,16 @@
#include "Config.h"
#include "Logger.h"
-//extern Logger g_Logger;
-//extern Config g_Config;
+extern Logger *g_Logger;
+extern Config g_Config;
_getaddrinfo getaddrinfo_orig;
-auto *config = new Config ();
-auto *logger = new Logger (config);
-static constexpr std::array dnscheck = { "dns.google", "cloudflare" };
-static constexpr std::array blockList = { "google", "doubleclick", "qualaroo.com", "fbsbx.com" };
-static const bool wpad = config->getConfig ("Skip_wpad");
+static constexpr std::array blockList = { "googletag", "doubleclick", "qualaroo.com",/* "fbsbx.com", */ "dns.google", "cloudflare" };
+static const bool wpad = g_Config.getConfig ("Skip_wpad");
// check if ads hostname
bool is_blockhost (std::string_view nodename) {
- //static bool wpad = config->getConfig ("Skip_wpad");
-
-
if (0 == nodename.compare ("wpad"))
return wpad ? true : false;
for (auto &hostname : blockList) {
@@ -49,21 +43,13 @@ int WSAAPI getaddrinfo_hook (
auto ipv4 = reinterpret_cast(ptr->ai_addr);
ipv4->sin_addr.S_un.S_addr = INADDR_ANY;
}
- logger->Log ("blocked - " + nnodename);
+ g_Logger->Log ("blocked - " + nnodename);
}
else {
- logger->Log ("allowed - " + nnodename);
- }
- }
- if (true == logger->is_active() &&
- true == wpad)
- {
- for (auto &hostname : dnscheck) {
- if (std::string_view::npos != nnodename.find (hostname))
- logger->Log ("custom dns currently in use - " + nnodename +
- " turn on Skip_wpad in config.ini or switch to adguard dns");
+ g_Logger->Log ("allowed - " + nnodename);
}
}
+
return result;
}