Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Commit

Permalink
Updated for 1.1.1.348.g9064793a.
Browse files Browse the repository at this point in the history
  • Loading branch information
master131 committed Mar 5, 2019
1 parent 3f99dd7 commit 8a7e086
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

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

**Current Version:** 0.12
**Current Version:** 0.13

**Last updated:** 8th January 2019
**Last updated:** 5th March 2019

**Last tested version:** 1.1.0.237.g378f6f25
**Last tested version:** 1.1.1.348.g9064793a

This mod is designed to work with any version update. Please create an issue if it breaks.

### Features:
* Windows only
* Set and forget
* Blocks all banner/video/audio ads within the app
* Retains friend and vertical video functionality
* Retains friend, vertical video and radio functionality
* Unlocks the skip function for any track

:warning: This mod is for the [**Desktop release**](https://www.spotify.com/download/windows/) of Spotify on Windows and **not the Microsoft Store version**.
Expand Down
Binary file modified install.bat
Binary file not shown.
Binary file modified netutils.dll
Binary file not shown.
64 changes: 60 additions & 4 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#pragma comment(lib, "Ws2_32.lib")
#pragma comment(lib, "Psapi.lib")
#pragma comment(lib, "Version.lib")

typedef int (WSAAPI* _getaddrinfo)(
_In_opt_ PCSTR pNodeName,
Expand Down Expand Up @@ -452,6 +453,56 @@ void WriteAll(HMODULE hModule, MODULEINFO mInfo)
}
}

typedef struct
{
DWORD dwMajor;
DWORD dwMinor;
DWORD dwBuild;
DWORD dwRevision;
} version_t;

typedef struct {
WORD wLength;
WORD wValueLength;
WORD wType;
WCHAR szKey[16];
WORD Padding1;
VS_FIXEDFILEINFO Value;
WORD Padding2;
WORD Children;
} VS_VERSIONINFO;

BOOL GetFileVersionInfo(version_t* v)
{
BOOL ok = FALSE;
WCHAR moduleFilePath[MAX_PATH];
DWORD verHandle;
GetModuleFileName(GetModuleHandle(NULL), moduleFilePath, MAX_PATH);
DWORD verSize = GetFileVersionInfoSize(moduleFilePath, &verHandle);
if (verSize)
{
LPVOID verBuffer;
UINT size;
LPVOID verData = new char[verSize];
if (GetFileVersionInfo(moduleFilePath, verHandle, verSize, verData) &&
VerQueryValueA(verData, "\\", &verBuffer, &size) &&
size)
{
VS_VERSIONINFO *verInfo = (VS_VERSIONINFO *) verData;
if (verInfo->Value.dwSignature == 0xfeef04bd)
{
v->dwMajor = verInfo->Value.dwFileVersionMS >> 16 & 0xffff;
v->dwMinor = verInfo->Value.dwFileVersionMS & 0xffff;
v->dwBuild = verInfo->Value.dwFileVersionLS >> 16 & 0xffff;
v->dwRevision = verInfo->Value.dwFileVersionLS & 0xffff;
ok = TRUE;
}
}
delete (char*) verData;
}
return ok;
}

DWORD WINAPI MainThread(LPVOID)
{
// Block known ad hosts via function hooks
Expand All @@ -474,11 +525,16 @@ DWORD WINAPI MainThread(LPVOID)
}

// Perform fallback patches (just in-case the main method fails)
__try {
Patch(hModule, mInfo);
}
__except (EXCEPTION_EXECUTE_HANDLER)
// Only allow for version 1.1.0.xx and below
version_t v;
if (GetFileVersionInfo(&v) && v.dwMajor <= 1 && v.dwMinor <= 1 && v.dwBuild <= 0)
{
__try {
Patch(hModule, mInfo);
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
}
}

// Perform main ad patch
Expand Down

0 comments on commit 8a7e086

Please sign in to comment.