Skip to content

Commit

Permalink
1.1.14.475.g566c8beb release as zip instead of dll
Browse files Browse the repository at this point in the history
  • Loading branch information
mrpond committed Sep 13, 2019
1 parent e0d8e11 commit af34e90
Show file tree
Hide file tree
Showing 9 changed files with 495 additions and 627 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ Please do support Spotify by using premium!!!!

## Video, audio & banner adblock/skip for Spotify

**Current Version:** 0.20
**Current Version:** 0.21

**Last updated:** 22 August 2019
**Last updated:** 13 September 2019

**Last tested version:** 1.1.12.451.gdb77255f
**Last tested version:** 1.1.14.475.g566c8beb

### Important Notice

Not tested on 1.1.15.448.g00fba0e3 yet,

since it not public release in my region yet

This dll is virus free,

You can check and recompile it from source.
Expand All @@ -31,12 +35,12 @@ You can check and recompile it from source.

The default Spotify installation location is: %APPDATA%/Spotify (copy and paste into Explorer address bar)

[Download](chrome_elf.dll)
[Download](chrome_elf.zip)

#### Installation/Update:
1. Browse to Spotify installation folder (where Spotify.exe there)
2. backup existing chrome_elf.dll by rename it (e.g. chrome_elf.bak)
3. and drop chrome_elf.dll.
3. and extract chrome_elf.dll from chrome_elf.zip to that folder.

#### Uninstall:
1. Browse to Spotify installation folder (where Spotify.exe there)
Expand Down
Binary file removed chrome_elf.dll
Binary file not shown.
Binary file added chrome_elf.zip
Binary file not shown.
14 changes: 7 additions & 7 deletions src/BlockTheSpot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ int CrashForException_ExportThunk (EXCEPTION_POINTERS* info) {
}
void DisableHook () {}

uint32_t DrainLog (uint8_t* buffer,
uint32_t buffer_size,
uint32_t* log_remaining) {
UINT32 DrainLog (UINT8* buffer,
UINT32 buffer_size,
UINT32* log_remaining) {

return 0;
}
Expand All @@ -25,8 +25,8 @@ bool DumpHungProcessWithPtype_ExportThunk (HANDLE process_handle,

void DumpProcessWithoutCrash (void* task_port) {}

int32_t GetApplyHookResult () { return 0; }
uint32_t GetBlockedModulesCount () { return 0; }
INT32 GetApplyHookResult () { return 0; }
UINT32 GetBlockedModulesCount () { return 0; }

size_t GetCrashReports_ExportThunk (void* reports,
size_t reports_size) {
Expand All @@ -39,8 +39,8 @@ const wchar_t* GetCrashpadDatabasePath_ExportThunk () {
void* GetHandleVerifier () {
return NULL;
}
uint32_t GetInstallDetailsPayload () { return 0; }
uint32_t GetUniqueBlockedModulesCount () { return 0; }
UINT32 GetInstallDetailsPayload () { return 0; }
UINT32 GetUniqueBlockedModulesCount () { return 0; }
bool GetUserDataDirectoryThunk (wchar_t* user_data_dir,
size_t user_data_dir_length,
wchar_t* invalid_user_data_dir,
Expand Down
5 changes: 3 additions & 2 deletions src/BlockTheSpot.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>false</FunctionLevelLinking>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;BLOCKTHESPOT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<DebugInformationFormat>None</DebugInformationFormat>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
94 changes: 0 additions & 94 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
@@ -1,90 +1,6 @@
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"

LPVOID Search (char* pPattern, size_t patternSize, uint8_t* scanStart, size_t scanSize)
{
__try
{
auto res = std::search (
scanStart, scanStart + scanSize, pPattern, pPattern + patternSize,
[](uint8_t val1, uint8_t val2) { return (val1 == val2); }
);

return (res >= scanStart + scanSize) ? nullptr : res;
}
__except (EXCEPTION_EXECUTE_HANDLER) {
return nullptr;
}
}

LPVOID FindFunction (char* hModule, DWORD hModuleSize, char* midFuncPtn, int lenMidFuncPtn, int seekBackCount, char* startFuncPtn, int lenStartFuncPtn)
{
LPVOID pfnAddr = Search (midFuncPtn, lenMidFuncPtn, (uint8_t*)hModule, hModuleSize);
if (!pfnAddr) return NULL;
char* pfnStart = NULL;
char* pfnCurrent = (char*)pfnAddr - seekBackCount;
while ((pfnCurrent = (char*)Search (startFuncPtn, lenStartFuncPtn, (uint8_t*)pfnCurrent, hModule + hModuleSize - pfnCurrent)) &&
pfnCurrent < pfnAddr)
{
pfnStart = pfnCurrent;
pfnCurrent++;
}

return pfnStart;
}

// https://www.unknowncheats.me/forum/1064672-post23.html
bool DataCompare (BYTE* pData, BYTE* bSig, char* szMask)
{
for (; *szMask; ++szMask, ++pData, ++bSig)
{
if (*szMask == 'x' && *pData != *bSig)
return false;
}
return (*szMask) == NULL;
}

BYTE* FindPattern (BYTE* dwAddress, DWORD dwSize, BYTE* pbSig, char* szMask)
{
DWORD length = strlen (szMask);
for (DWORD i = NULL; i < dwSize - length; i++)
{
__try
{
if (DataCompare (dwAddress + i, pbSig, szMask))
return dwAddress + i;
}
__except (EXCEPTION_EXECUTE_HANDLER) {
return nullptr;
}
}
return 0;
}

DWORD WINAPI MainThread (LPVOID)
{
HMODULE hModule = GetModuleHandle (NULL);
MODULEINFO mInfo = { 0 };
if (GetModuleInformation (GetCurrentProcess (), hModule, &mInfo, sizeof (MODULEINFO))) {

LPVOID skipPod = FindPattern ((uint8_t*)hModule, mInfo.SizeOfImage, (BYTE*) "\xFF\x07\x0F\x85\x00\x00\x00\x00\xE8", "xxxx????x");

if (skipPod)
{
DWORD oldProtect;
VirtualProtect ((char*)skipPod + 2, 1, PAGE_EXECUTE_READWRITE, &oldProtect);
memset ((char*)skipPod + 2, 0x90, 1);
VirtualProtect ((char*)skipPod + 2, 1, oldProtect, &oldProtect);

VirtualProtect ((char*)skipPod + 3, 1, PAGE_EXECUTE_READWRITE, &oldProtect);
memset ((char*)skipPod + 3, 0xE9, 1);
VirtualProtect ((char*)skipPod + 3, 1, oldProtect, &oldProtect);
}

}
return 0;
}

BOOL APIENTRY DllMain (HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
Expand All @@ -94,20 +10,10 @@ BOOL APIENTRY DllMain (HMODULE hModule,
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls (hModule);
// Only patch the main process and none of the other
if (!wcsstr (GetCommandLine (), L"--type=")) {
//skip processing ads but ads still downloaded
CreateThread (NULL, NULL, MainThread, NULL, 0, NULL);
}
if (wcsstr (GetCommandLine (), L"--url=")) {
exit (0);
}
// block the ads banner by hostname
InstallHookApi ("ws2_32.dll", "getaddrinfo", getaddrinfohook);
// real ads block
InstallHookApi ("Winhttp.dll", "WinHttpOpenRequest", winhttpopenrequesthook);
// for future
//InstallHookApi ("ws2_32.dll", "connect", connecthook);
break;
}
return TRUE;
Expand Down
47 changes: 10 additions & 37 deletions src/hosts.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "stdafx.h"
#include "hosts.h"

//HINTERNET
int WINAPI winhttpopenrequesthook (DWORD RetAddr,
pfnwinhttpopenrequest fnwinhttpopenrequest,
HINTERNET hConnect,
Expand All @@ -11,44 +11,17 @@ int WINAPI winhttpopenrequesthook (DWORD RetAddr,
LPCWSTR* ppwszAcceptTypes,
DWORD dwFlags)
{
//wcscmp (pwszVerb, L"POST") == 0
if (wcscmp (pwszObjectName, L"/ad-logic/flashpoint") == 0)
return NULL;
if (wcscmp (pwszObjectName, L"/ads") == 0)
return NULL;
//if (wcscmp (pwszObjectName, L"/ads/v1/ads/leaderboard") == 0)
return NULL;
//if ((wcscmp (pwszVerb, L"GET") == 0) || (wcscmp (pwszVerb, L"POST") == 0))
//return NULL;

return fnwinhttpopenrequest (hConnect,
pwszVerb,
pwszObjectName,
pwszVersion,
pwszReferrer,
ppwszAcceptTypes,
dwFlags);
}

int WINAPI connecthook (DWORD RetAddr,
pfnconnect fnconnect,
SOCKET s,
const struct sockaddr* name,
int namelen)
{
return fnconnect (s, name, namelen);

//for future whitelist or blacklist ip
//struct sockaddr_in* sa = (struct sockaddr_in*)name;
//if (sa->sin_family != AF_INET) // check only IPv4
//return fnconnect (s, name, namelen);


//char* allowip = "151.101.8.246"; // Image
//char ipstr[INET_ADDRSTRLEN];
//inet_ntop (sa->sin_family, &(sa->sin_addr), ipstr, INET_ADDRSTRLEN);
//if (_stricmp (ipstr, allowip) == 0) {
//return SOCKET_ERROR;
//}

//return fnwinhttpopenrequest (hConnect,
// pwszVerb,
// pwszObjectName,
// pwszVersion,
// pwszReferrer,
// ppwszAcceptTypes,
// dwFlags);
}

int WINAPI getaddrinfohook (DWORD RetAddr,
Expand Down
Loading

0 comments on commit af34e90

Please sign in to comment.