├── .gitattributes
├── .github
└── ISSUE_TEMPLATE
│ └── bug_report.md
├── .gitignore
├── BlockTheSpot.bat
├── LICENSE
├── README.md
├── SpotifyNoPremium.ps1
├── config.ini
├── install.ps1
├── src
├── BlockTheSpot.cpp
├── BlockTheSpot.vcxproj
├── BlockTheSpot.vcxproj.filters
├── BlockTheSpot.vcxproj.user
├── Logger.h
├── Modify.cpp
├── Modify.h
├── chrome_elf.def
├── dllmain.cpp
├── stdafx.cpp
├── stdafx.h
└── targetver.h
└── uninstall.bat
/.gitattributes:
--------------------------------------------------------------------------------
1 | src/disasm-lib/* linguist-vendored
2 | src/mhook-lib/* linguist-vendored
3 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Make sure you have completed everything in the following checklist.
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | Make sure you have completed everything in the following checklist.
11 |
12 | - [ ] You are using the Spotify `last tested version` mentioned in the [README](https://github.com/mrpond/BlockTheSpot/blob/master/README.md).
13 | - [ ] You are using the latest [BlockTheSpot](https://www.github.com/mrpond/BlockTheSpot/releases) from github.
14 | - [ ] You uninstalled Spotify and just ran [BlockTheSpot.bat](https://raw.githack.com/mrpond/BlockTheSpot/master/BlockTheSpot.bat) and is still having issues.
15 | - [ ] You read through the [known issues](https://github.com/mrpond/BlockTheSpot/blob/master/README.md#known-issues) section in the README.
16 | - [ ] You read through the [additional notes](https://github.com/mrpond/BlockTheSpot/blob/master/README.md#additional-notes) section in the README.
17 | - [ ] You enabled logging by editing config.ini `set log = 1`.
18 |
19 | ### Describe the bug
20 | A clear and concise description of what the bug is, along with your OS [eg. Windows 10]:
21 |
22 | Zip and attach the log file.
23 |
24 |
30 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | # This .gitignore file was automatically created by Microsoft(R) Visual Studio.
3 | ################################################################################
4 |
5 | *.ipch
6 | /.vs/VSWorkspaceState.json
7 | /.vs/ProjectSettings.json
8 | /.vs/slnx.sqlite
9 | /.vs/BlockTheSpot
10 | /src/.vs/BlockTheSpot/v16
11 | /src/Release
12 | *.sln
13 | /Debug
14 | /Release
15 | *.exp
16 | *.iobj
17 | *.ipdb
18 | *.lib
19 | *.dll
20 | /src/Debug
21 | *.aps
22 | *.zip
23 |
--------------------------------------------------------------------------------
/BlockTheSpot.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | powershell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/mrpond/BlockTheSpot/master/install.ps1' | Invoke-Expression}"
3 | pause
4 | exit
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 master131
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | BlockTheSpot
3 | A multi-purpose adblocker and skip-bypass for the Windows Spotify desktop application.
4 |
5 | Last updated: 29 October 2021
6 | Last tested version: 1.1.80.699.gc3dac750
7 |
8 |
9 |
10 | #### Important checks before installing:
11 | 0. Update Windows, update Spotify and update BlockTheSpot
12 | 1. Go to "Windows Security" -> "Virus & Threat Protection"
13 | 2. Click "Allowed threats" -> "Remove all allowed threats"
14 |
15 | ### Features:
16 | * Blocks all banner/video/audio ads within the app
17 | * Retains friend, vertical video and radio functionality
18 | * Unlocks the skip function for any track
19 | * Now supports the new Alpha version (New UI)
20 |
21 | :warning: This mod is for the [**Desktop Application**](https://www.spotify.com/download/windows/) of Spotify on Windows only and **not the Microsoft Store version**.
22 |
23 | #### Installation/Update:
24 | * Just download and run [BlockTheSpot.bat](https://raw.githubusercontent.com/Daksh777/BlockTheSpot/master/BlockTheSpot.bat)
25 | * (Optional) Use [SpotifyNoPremium](https://github.com/Daksh777/SpotifyNoPremium) to declutter the Spotify UI.
26 |
27 | #### Uninstall:
28 | * Just run [uninstall.bat](https://raw.githubusercontent.com/Daksh777/BlockTheSpot/master/uninstall.bat)
29 |
30 | or
31 |
32 | * Reinstall Spotify
33 |
34 | ### Known Issues:
35 | * You may face issue [#150](https://github.com/mrpond/BlockTheSpot/issues/150). Can be fixed by using running the [`install.bat`](https://raw.githack.com/Daksh777/SpotifyNoPremium/main/install.bat) file from [SpotifyNoPremium](https://raw.githack.com/Daksh777/SpotifyNoPremium/main/install.bat)
36 |
37 | ### Additional Notes:
38 |
39 | * Installation script automatically detects if your Spotify client version is supported, or not. If the version is not supported, you will be prompted to update your Spotify client. To enforce client update, supply an optional parameter `UpdateSpotify` to the installation script.
40 | * Remove "Upgrade" Button [#83](https://github.com/mrpond/BlockTheSpot/issues/83) and Remove "Ad Placeholder" [#150](https://github.com/mrpond/BlockTheSpot/issues/150) only works when you use any of the auto installation methods and press `y` when prompted.
41 | * "chrome_elf.dll" gets replaced by the Spotify installer each time it updates, hence why you'll probably need to apply the patch again when it happens
42 | * [Spicetify](https://github.com/khanhas/spicetify-cli) users will need to reapply BlockTheSpot after applying a Spicetify patches.
43 |
--------------------------------------------------------------------------------
/SpotifyNoPremium.ps1:
--------------------------------------------------------------------------------
1 | # Ignore errors from `Stop-Process`
2 | $PSDefaultParameterValues['Stop-Process:ErrorAction'] = [System.Management.Automation.ActionPreference]::SilentlyContinue
3 | [Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
4 | function Get-File
5 | {
6 | param (
7 | [Parameter(Mandatory, ValueFromPipelineByPropertyName)]
8 | [ValidateNotNullOrEmpty()]
9 | [System.Uri]
10 | $Uri,
11 | [Parameter(Mandatory, ValueFromPipelineByPropertyName)]
12 | [ValidateNotNullOrEmpty()]
13 | [System.IO.FileInfo]
14 | $TargetFile,
15 | [Parameter(ValueFromPipelineByPropertyName)]
16 | [ValidateNotNullOrEmpty()]
17 | [Int32]
18 | $BufferSize = 1,
19 | [Parameter(ValueFromPipelineByPropertyName)]
20 | [ValidateNotNullOrEmpty()]
21 | [ValidateSet('KB, MB')]
22 | [String]
23 | $BufferUnit = 'MB',
24 | [Parameter(ValueFromPipelineByPropertyName)]
25 | [ValidateNotNullOrEmpty()]
26 | [ValidateSet('KB, MB')]
27 | [Int32]
28 | $Timeout = 10000
29 | )
30 |
31 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
32 |
33 | $useBitTransfer = $null -ne (Get-Module -Name BitsTransfer -ListAvailable) -and ($PSVersionTable.PSVersion.Major -le 5) -and ((Get-Service -Name BITS).StartType -ne [System.ServiceProcess.ServiceStartMode]::Disabled)
34 |
35 | if ($useBitTransfer)
36 | {
37 | Write-Information -MessageData 'Using a fallback BitTransfer method since you are running Windows PowerShell'
38 | Start-BitsTransfer -Source $Uri -Destination "$($TargetFile.FullName)"
39 | }
40 | else
41 | {
42 | $request = [System.Net.HttpWebRequest]::Create($Uri)
43 | $request.set_Timeout($Timeout) #15 second timeout
44 | $response = $request.GetResponse()
45 | $totalLength = [System.Math]::Floor($response.get_ContentLength() / 1024)
46 | $responseStream = $response.GetResponseStream()
47 | $targetStream = New-Object -TypeName ([System.IO.FileStream]) -ArgumentList "$($TargetFile.FullName)", Create
48 | switch ($BufferUnit)
49 | {
50 | 'KB' { $BufferSize = $BufferSize * 1024 }
51 | 'MB' { $BufferSize = $BufferSize * 1024 * 1024 }
52 | Default { $BufferSize = 1024 * 1024 }
53 | }
54 | Write-Verbose -Message "Buffer size: $BufferSize B ($($BufferSize/("1$BufferUnit")) $BufferUnit)"
55 | $buffer = New-Object byte[] $BufferSize
56 | $count = $responseStream.Read($buffer, 0, $buffer.length)
57 | $downloadedBytes = $count
58 | $downloadedFileName = $Uri -split '/' | Select-Object -Last 1
59 | while ($count -gt 0)
60 | {
61 | $targetStream.Write($buffer, 0, $count)
62 | $count = $responseStream.Read($buffer, 0, $buffer.length)
63 | $downloadedBytes = $downloadedBytes + $count
64 | Write-Progress -Activity "Downloading file '$downloadedFileName'" -Status "Downloaded ($([System.Math]::Floor($downloadedBytes/1024))K of $($totalLength)K): " -PercentComplete ((([System.Math]::Floor($downloadedBytes / 1024)) / $totalLength) * 100)
65 | }
66 |
67 | Write-Progress -Activity "Finished downloading file '$downloadedFileName'"
68 |
69 | $targetStream.Flush()
70 | $targetStream.Close()
71 | $targetStream.Dispose()
72 | $responseStream.Dispose()
73 | }
74 | }
75 |
76 | Write-Host @'
77 | *****************
78 | Authors: @Nuzair46, @KUTlime, @Daksh777
79 | *****************
80 | '@
81 |
82 | Write-Host "IF YOU ARE SEEING THIS, THIS MEANS THAT YOU ARE RUNNING AN OLD VERSION OF SPOTIFYNOPREMIUM WHICH WILL DEPRECATE SOON. `nPLEASE DOWNLOAD THE LATEST install.bat SCRIPT FROM https://github.com/Daksh777/SpotifyNoPremium/"
83 |
84 | $spotifyDirectory = Join-Path -Path $env:APPDATA -ChildPath 'Spotify'
85 | $spotifyExecutable = Join-Path -Path $spotifyDirectory -ChildPath 'Spotify.exe'
86 | $spotifyApps = Join-Path -Path $spotifyDirectory -ChildPath 'Apps'
87 |
88 | Write-Host "Stopping Spotify...`n"
89 | Stop-Process -Name Spotify
90 | Stop-Process -Name SpotifyWebHelper
91 |
92 | Push-Location -LiteralPath $env:TEMP
93 | try
94 | {
95 | # Unique directory name based on time
96 | New-Item -Type Directory -Name "BlockTheSpot-$(Get-Date -UFormat '%Y-%m-%d_%H-%M-%S')" |
97 | Convert-Path |
98 | Set-Location
99 | }
100 | catch
101 | {
102 | Write-Output $_
103 | Read-Host 'Press any key to exit...'
104 | exit
105 | }
106 |
107 | Write-Host "Downloading latest patch (chrome_elf.zip)...`n"
108 | $elfPath = Join-Path -Path $PWD -ChildPath 'chrome_elf.zip'
109 | try
110 | {
111 | $uri = 'https://github.com/mrpond/BlockTheSpot/releases/latest/download/chrome_elf.zip'
112 | Get-File -Uri $uri -TargetFile "$elfPath"
113 | }
114 | catch
115 | {
116 | Write-Output $_
117 | Start-Sleep
118 | }
119 |
120 | Expand-Archive -Force -LiteralPath "$elfPath" -DestinationPath $PWD
121 | Remove-Item -LiteralPath "$elfPath" -Force
122 |
123 | $elfDllBackFilePath = Join-Path -Path $spotifyDirectory -ChildPath 'chrome_elf_bak.dll'
124 | $elfBackFilePath = Join-Path -Path $spotifyDirectory -ChildPath 'chrome_elf.dll'
125 | if ((Test-Path $elfDllBackFilePath) -eq $false)
126 | {
127 | Move-Item -LiteralPath "$elfBackFilePath" -Destination "$elfDllBackFilePath" | Write-Verbose
128 | }
129 |
130 | Write-Host 'Patching Spotify...'
131 | $patchFiles = (Join-Path -Path $PWD -ChildPath 'chrome_elf.dll'), (Join-Path -Path $PWD -ChildPath 'config.ini')
132 |
133 | Copy-Item -LiteralPath $patchFiles -Destination "$spotifyDirectory"
134 |
135 | $tempDirectory = $PWD
136 | Pop-Location
137 |
138 | Remove-Item -LiteralPath $tempDirectory -Recurse
139 |
140 | Write-Host 'Patching Complete, starting Spotify...'
141 |
142 | Start-Process -WorkingDirectory $spotifyDirectory -FilePath $spotifyExecutable
143 | Write-Host 'Done.'
144 |
145 | exit
146 |
--------------------------------------------------------------------------------
/config.ini:
--------------------------------------------------------------------------------
1 | [Config]
2 | ;Log system
3 | Log = 0
--------------------------------------------------------------------------------
/install.ps1:
--------------------------------------------------------------------------------
1 | param (
2 | [Parameter()]
3 | [switch]
4 | $UninstallSpotifyStoreEdition = (Read-Host -Prompt 'Uninstall Spotify Windows Store edition if it exists (Y/N)') -eq 'y',
5 | [Parameter()]
6 | [switch]
7 | $UpdateSpotify,
8 | [Parameter()]
9 | [switch]
10 | $RemoveAdPlaceholder = (Read-Host -Prompt 'Optional - Remove ad placeholder and upgrade button. (Y/N)') -eq 'y'
11 | )
12 |
13 | # Ignore errors from `Stop-Process`
14 | $PSDefaultParameterValues['Stop-Process:ErrorAction'] = [System.Management.Automation.ActionPreference]::SilentlyContinue
15 |
16 | [System.Version] $minimalSupportedSpotifyVersion = '1.1.73.517'
17 |
18 | function Get-File
19 | {
20 | param (
21 | [Parameter(Mandatory, ValueFromPipelineByPropertyName)]
22 | [ValidateNotNullOrEmpty()]
23 | [System.Uri]
24 | $Uri,
25 | [Parameter(Mandatory, ValueFromPipelineByPropertyName)]
26 | [ValidateNotNullOrEmpty()]
27 | [System.IO.FileInfo]
28 | $TargetFile,
29 | [Parameter(ValueFromPipelineByPropertyName)]
30 | [ValidateNotNullOrEmpty()]
31 | [Int32]
32 | $BufferSize = 1,
33 | [Parameter(ValueFromPipelineByPropertyName)]
34 | [ValidateNotNullOrEmpty()]
35 | [ValidateSet('KB, MB')]
36 | [String]
37 | $BufferUnit = 'MB',
38 | [Parameter(ValueFromPipelineByPropertyName)]
39 | [ValidateNotNullOrEmpty()]
40 | [ValidateSet('KB, MB')]
41 | [Int32]
42 | $Timeout = 10000
43 | )
44 |
45 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
46 |
47 | $useBitTransfer = $null -ne (Get-Module -Name BitsTransfer -ListAvailable) -and ($PSVersionTable.PSVersion.Major -le 5) -and ((Get-Service -Name BITS).StartType -ne [System.ServiceProcess.ServiceStartMode]::Disabled)
48 |
49 | if ($useBitTransfer)
50 | {
51 | Write-Information -MessageData 'Using a fallback BitTransfer method since you are running Windows PowerShell'
52 | Start-BitsTransfer -Source $Uri -Destination "$($TargetFile.FullName)"
53 | }
54 | else
55 | {
56 | $request = [System.Net.HttpWebRequest]::Create($Uri)
57 | $request.set_Timeout($Timeout) #15 second timeout
58 | $response = $request.GetResponse()
59 | $totalLength = [System.Math]::Floor($response.get_ContentLength() / 1024)
60 | $responseStream = $response.GetResponseStream()
61 | $targetStream = New-Object -TypeName ([System.IO.FileStream]) -ArgumentList "$($TargetFile.FullName)", Create
62 | switch ($BufferUnit)
63 | {
64 | 'KB' { $BufferSize = $BufferSize * 1024 }
65 | 'MB' { $BufferSize = $BufferSize * 1024 * 1024 }
66 | Default { $BufferSize = 1024 * 1024 }
67 | }
68 | Write-Verbose -Message "Buffer size: $BufferSize B ($($BufferSize/("1$BufferUnit")) $BufferUnit)"
69 | $buffer = New-Object byte[] $BufferSize
70 | $count = $responseStream.Read($buffer, 0, $buffer.length)
71 | $downloadedBytes = $count
72 | $downloadedFileName = $Uri -split '/' | Select-Object -Last 1
73 | while ($count -gt 0)
74 | {
75 | $targetStream.Write($buffer, 0, $count)
76 | $count = $responseStream.Read($buffer, 0, $buffer.length)
77 | $downloadedBytes = $downloadedBytes + $count
78 | Write-Progress -Activity "Downloading file '$downloadedFileName'" -Status "Downloaded ($([System.Math]::Floor($downloadedBytes/1024))K of $($totalLength)K): " -PercentComplete ((([System.Math]::Floor($downloadedBytes / 1024)) / $totalLength) * 100)
79 | }
80 |
81 | Write-Progress -Activity "Finished downloading file '$downloadedFileName'"
82 |
83 | $targetStream.Flush()
84 | $targetStream.Close()
85 | $targetStream.Dispose()
86 | $responseStream.Dispose()
87 | }
88 | }
89 |
90 | function Test-SpotifyVersion
91 | {
92 | param (
93 | [Parameter(Mandatory, ValueFromPipelineByPropertyName)]
94 | [ValidateNotNullOrEmpty()]
95 | [System.Version]
96 | $MinimalSupportedVersion,
97 | [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
98 | [System.Version]
99 | $TestedVersion
100 | )
101 |
102 | process
103 | {
104 | return ($MinimalSupportedVersion.CompareTo($TestedVersion) -le 0)
105 | }
106 | }
107 |
108 | Write-Host @'
109 | *****************
110 | @mrpond message:
111 | #Thailand #ThaiProtest #ThailandProtest #freeYOUTH
112 | Please retweet these hashtag, help me stop dictator government!
113 | *****************
114 | '@
115 |
116 | Write-Host @'
117 | *****************
118 | Authors: @Nuzair46, @KUTlime
119 | *****************
120 | '@
121 |
122 | $spotifyDirectory = Join-Path -Path $env:APPDATA -ChildPath 'Spotify'
123 | $spotifyExecutable = Join-Path -Path $spotifyDirectory -ChildPath 'Spotify.exe'
124 | $spotifyApps = Join-Path -Path $spotifyDirectory -ChildPath 'Apps'
125 |
126 | [System.Version] $actualSpotifyClientVersion = (Get-ChildItem -LiteralPath $spotifyExecutable -ErrorAction:SilentlyContinue).VersionInfo.ProductVersionRaw
127 |
128 | Write-Host "Stopping Spotify...`n"
129 | Stop-Process -Name Spotify
130 | Stop-Process -Name SpotifyWebHelper
131 |
132 | if ($PSVersionTable.PSVersion.Major -ge 7)
133 | {
134 | Import-Module Appx -UseWindowsPowerShell -WarningAction:SilentlyContinue
135 | }
136 |
137 | if (Get-AppxPackage -Name SpotifyAB.SpotifyMusic)
138 | {
139 | Write-Host "The Microsoft Store version of Spotify has been detected which is not supported.`n"
140 |
141 | if ($UninstallSpotifyStoreEdition)
142 | {
143 | Write-Host "Uninstalling Spotify.`n"
144 | Get-AppxPackage -Name SpotifyAB.SpotifyMusic | Remove-AppxPackage
145 | }
146 | else
147 | {
148 | Read-Host "Exiting...`nPress any key to exit..."
149 | exit
150 | }
151 | }
152 |
153 | Push-Location -LiteralPath $env:TEMP
154 | try
155 | {
156 | # Unique directory name based on time
157 | New-Item -Type Directory -Name "BlockTheSpot-$(Get-Date -UFormat '%Y-%m-%d_%H-%M-%S')" |
158 | Convert-Path |
159 | Set-Location
160 | }
161 | catch
162 | {
163 | Write-Output $_
164 | Read-Host 'Press any key to exit...'
165 | exit
166 | }
167 |
168 | Write-Host "Downloading latest patch (chrome_elf.zip)...`n"
169 | $elfPath = Join-Path -Path $PWD -ChildPath 'chrome_elf.zip'
170 | try
171 | {
172 | $uri = 'https://github.com/mrpond/BlockTheSpot/releases/latest/download/chrome_elf.zip'
173 | Get-File -Uri $uri -TargetFile "$elfPath"
174 | }
175 | catch
176 | {
177 | Write-Output $_
178 | Start-Sleep
179 | }
180 |
181 | Expand-Archive -Force -LiteralPath "$elfPath" -DestinationPath $PWD
182 | Remove-Item -LiteralPath "$elfPath" -Force
183 |
184 | $spotifyInstalled = Test-Path -LiteralPath $spotifyExecutable
185 | $unsupportedClientVersion = ($actualSpotifyClientVersion | Test-SpotifyVersion -MinimalSupportedVersion $minimalSupportedSpotifyVersion) -eq $false
186 |
187 | if (-not $UpdateSpotify -and $unsupportedClientVersion)
188 | {
189 | if ((Read-Host -Prompt 'In order to install Block the Spot, your Spotify client must be updated. Do you want to continue? (Y/N)') -ne 'y')
190 | {
191 | exit
192 | }
193 | }
194 |
195 | if (-not $spotifyInstalled -or $UpdateSpotify -or $unsupportedClientVersion)
196 | {
197 | Write-Host 'Downloading the latest Spotify full setup, please wait...'
198 | $spotifySetupFilePath = Join-Path -Path $PWD -ChildPath 'SpotifyFullSetup.exe'
199 | try
200 | {
201 | $uri = 'https://download.scdn.co/SpotifyFullSetup.exe'
202 | Get-File -Uri $uri -TargetFile "$spotifySetupFilePath"
203 | }
204 | catch
205 | {
206 | Write-Output $_
207 | Read-Host 'Press any key to exit...'
208 | exit
209 | }
210 | New-Item -Path $spotifyDirectory -ItemType:Directory -Force | Write-Verbose
211 |
212 | [System.Security.Principal.WindowsPrincipal] $principal = [System.Security.Principal.WindowsIdentity]::GetCurrent()
213 | $isUserAdmin = $principal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)
214 | Write-Host 'Running installation...'
215 | if ($isUserAdmin)
216 | {
217 | Write-Host
218 | Write-Host 'Creating scheduled task...'
219 | $apppath = 'powershell.exe'
220 | $taskname = 'Spotify install'
221 | $action = New-ScheduledTaskAction -Execute $apppath -Argument "-NoLogo -NoProfile -Command & `'$spotifySetupFilePath`'"
222 | $trigger = New-ScheduledTaskTrigger -Once -At (Get-Date)
223 | $settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -WakeToRun
224 | Register-ScheduledTask -Action $action -Trigger $trigger -TaskName $taskname -Settings $settings -Force | Write-Verbose
225 | Write-Host 'The install task has been scheduled. Starting the task...'
226 | Start-ScheduledTask -TaskName $taskname
227 | Start-Sleep -Seconds 2
228 | Write-Host 'Unregistering the task...'
229 | Unregister-ScheduledTask -TaskName $taskname -Confirm:$false
230 | Start-Sleep -Seconds 2
231 | }
232 | else
233 | {
234 | Start-Process -FilePath "$spotifySetupFilePath"
235 | }
236 |
237 | while ($null -eq (Get-Process -Name Spotify -ErrorAction SilentlyContinue))
238 | {
239 | # Waiting until installation complete
240 | Start-Sleep -Milliseconds 100
241 | }
242 |
243 | # Create a Shortcut to Spotify in %APPDATA%\Microsoft\Windows\Start Menu\Programs and Desktop
244 | # (allows the program to be launched from search and desktop)
245 | $wshShell = New-Object -ComObject WScript.Shell
246 |
247 | $desktopShortcutPath = "$env:USERPROFILE\Desktop\Spotify.lnk"
248 | if ((Test-Path $desktopShortcutPath) -eq $false)
249 | {
250 | $desktopShortcut = $wshShell.CreateShortcut($desktopShortcutPath)
251 | $desktopShortcut.TargetPath = "$env:APPDATA\Spotify\Spotify.exe"
252 | $desktopShortcut.Save()
253 | }
254 |
255 | $startMenuShortcutPath = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Spotify.lnk"
256 | if ((Test-Path $startMenuShortcutPath) -eq $false)
257 | {
258 | $startMenuShortcut = $wshShell.CreateShortcut($startMenuShortcutPath)
259 | $startMenuShortcut.TargetPath = "$env:APPDATA\Spotify\Spotify.exe"
260 | $startMenuShortcut.Save()
261 | }
262 |
263 |
264 | Write-Host 'Stopping Spotify...Again'
265 |
266 | Stop-Process -Name Spotify
267 | Stop-Process -Name SpotifyWebHelper
268 | Stop-Process -Name SpotifyFullSetup
269 | }
270 | $elfDllBackFilePath = Join-Path -Path $spotifyDirectory -ChildPath 'chrome_elf_bak.dll'
271 | $elfBackFilePath = Join-Path -Path $spotifyDirectory -ChildPath 'chrome_elf.dll'
272 | if ((Test-Path $elfDllBackFilePath) -eq $false)
273 | {
274 | Move-Item -LiteralPath "$elfBackFilePath" -Destination "$elfDllBackFilePath" | Write-Verbose
275 | }
276 |
277 | Write-Host 'Patching Spotify...'
278 | $patchFiles = (Join-Path -Path $PWD -ChildPath 'chrome_elf.dll'), (Join-Path -Path $PWD -ChildPath 'config.ini')
279 |
280 | Copy-Item -LiteralPath $patchFiles -Destination "$spotifyDirectory"
281 |
282 | if ($RemoveAdPlaceholder)
283 | {
284 | $xpuiBundlePath = Join-Path -Path $spotifyApps -ChildPath 'xpui.spa'
285 | $xpuiUnpackedPath = Join-Path -Path (Join-Path -Path $spotifyApps -ChildPath 'xpui') -ChildPath 'xpui.js'
286 | $fromZip = $false
287 |
288 | # Try to read xpui.js from xpui.spa for normal Spotify installations, or
289 | # directly from Apps/xpui/xpui.js in case Spicetify is installed.
290 | if (Test-Path $xpuiBundlePath)
291 | {
292 | Add-Type -Assembly 'System.IO.Compression.FileSystem'
293 | Copy-Item -Path $xpuiBundlePath -Destination "$xpuiBundlePath.bak"
294 |
295 | $zip = [System.IO.Compression.ZipFile]::Open($xpuiBundlePath, 'update')
296 | $entry = $zip.GetEntry('xpui.js')
297 |
298 | # Extract xpui.js from zip to memory
299 | $reader = New-Object System.IO.StreamReader($entry.Open())
300 | $xpuiContents = $reader.ReadToEnd()
301 | $reader.Close()
302 |
303 | $fromZip = $true
304 | }
305 | elseif (Test-Path $xpuiUnpackedPath)
306 | {
307 | Copy-Item -LiteralPath $xpuiUnpackedPath -Destination "$xpuiUnpackedPath.bak"
308 | $xpuiContents = Get-Content -LiteralPath $xpuiUnpackedPath -Raw
309 |
310 | Write-Host 'Spicetify detected - You may need to reinstall BTS after running "spicetify apply".';
311 | }
312 | else
313 | {
314 | Write-Host 'Could not find xpui.js, please open an issue on the BlockTheSpot repository.'
315 | }
316 |
317 | if ($xpuiContents)
318 | {
319 | # Replace ".ads.leaderboard.isEnabled" + separator - '}' or ')'
320 | # With ".ads.leaderboard.isEnabled&&false" + separator
321 | $xpuiContents = $xpuiContents -replace '(\.ads\.leaderboard\.isEnabled)(}|\))', '$1&&false$2'
322 |
323 | # Delete ".createElement(XX,{(spec:X),?onClick:X,className:XX.X.UpgradeButton}),X()"
324 | $xpuiContents = $xpuiContents -replace '\.createElement\([^.,{]+,{(?:spec:[^.,]+,)?onClick:[^.,]+,className:[^.]+\.[^.]+\.UpgradeButton}\),[^.(]+\(\)', ''
325 |
326 | # Disable Premium NavLink button
327 | $xpuiContents = $xpuiContents -replace '(const|var) .=.\?(`.*?`|"".concat\(.\).concat\(.\)):.;return .\(\)\.createElement\(".",.\(\)\(\{\},.,\{ref:.,href:.,target:"_blank",rel:"noopener nofollow"\}\),.\)', ''
328 |
329 | if ($fromZip)
330 | {
331 | # Rewrite it to the zip
332 | $writer = New-Object System.IO.StreamWriter($entry.Open())
333 | $writer.BaseStream.SetLength(0)
334 | $writer.Write($xpuiContents)
335 | $writer.Close()
336 |
337 | $zip.Dispose()
338 | }
339 | else
340 | {
341 | Set-Content -LiteralPath $xpuiUnpackedPath -Value $xpuiContents
342 | }
343 | }
344 | }
345 | else
346 | {
347 | Write-Host "Won't remove ad placeholder and upgrade button.`n"
348 | }
349 |
350 | $tempDirectory = $PWD
351 | Pop-Location
352 |
353 | Remove-Item -LiteralPath $tempDirectory -Recurse
354 |
355 | Write-Host 'Patching Complete, starting Spotify...'
356 |
357 | Start-Process -WorkingDirectory $spotifyDirectory -FilePath $spotifyExecutable
358 | Write-Host 'Done.'
359 |
360 | Write-Host @'
361 | *****************
362 | @mrpond message:
363 | #Thailand #ThaiProtest #ThailandProtest #freeYOUTH
364 | Please retweet these hashtag, help me stop dictator government!
365 | *****************
366 | '@
367 |
--------------------------------------------------------------------------------
/src/BlockTheSpot.cpp:
--------------------------------------------------------------------------------
1 | // BlockTheSpot.cpp : Defines the exported functions for the DLL application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 | void __stdcall LoadAPI (LPVOID* destination, LPCSTR apiName)
7 | {
8 | if (*destination)
9 | return;
10 |
11 | char path[MAX_PATH];
12 | //wchar_t windows[MAX_PATH];
13 | //GetSystemDirectoryW(windows, MAX_PATH);
14 | //wsprintf(path, L"%s\\netutils.dll", windows);
15 | wsprintf (path, ".\\chrome_elf_bak.dll");
16 | HMODULE hModule = GetModuleHandle (path);
17 | if (!hModule && !(hModule = LoadLibrary (path)))
18 | return;
19 | *destination = GetProcAddress (hModule, apiName);
20 | }
21 |
22 | #define API_EXPORT_ORIG(N) \
23 | static LPVOID _##N = NULL; \
24 | char S_##N[] = "" # N; \
25 | extern "C" __declspec(dllexport) __declspec(naked) void N ## () \
26 | { \
27 | __asm pushad \
28 | __asm push offset S_##N \
29 | __asm push offset _##N \
30 | __asm call LoadAPI \
31 | __asm popad \
32 | __asm jmp [_##N] \
33 | } \
34 |
35 |
36 | API_EXPORT_ORIG (ClearReportsBetween_ExportThunk)
37 | API_EXPORT_ORIG (CrashForException_ExportThunk)
38 | API_EXPORT_ORIG (DisableHook)
39 | API_EXPORT_ORIG (DrainLog)
40 | API_EXPORT_ORIG (DumpHungProcessWithPtype_ExportThunk)
41 | API_EXPORT_ORIG (DumpProcessWithoutCrash)
42 | API_EXPORT_ORIG (GetApplyHookResult)
43 | API_EXPORT_ORIG (GetBlockedModulesCount)
44 | API_EXPORT_ORIG (GetCrashReports_ExportThunk)
45 | API_EXPORT_ORIG (GetCrashpadDatabasePath_ExportThunk)
46 | API_EXPORT_ORIG (GetHandleVerifier)
47 | API_EXPORT_ORIG (GetInstallDetailsPayload)
48 | API_EXPORT_ORIG (GetUniqueBlockedModulesCount)
49 | API_EXPORT_ORIG (GetUserDataDirectoryThunk)
50 | API_EXPORT_ORIG (InjectDumpForHungInput_ExportThunk)
51 | API_EXPORT_ORIG (IsBrowserProcess)
52 | API_EXPORT_ORIG (IsCrashReportingEnabledImpl)
53 | API_EXPORT_ORIG (IsThirdPartyInitialized)
54 | API_EXPORT_ORIG (RegisterLogNotification)
55 | API_EXPORT_ORIG (RequestSingleCrashUpload_ExportThunk)
56 | API_EXPORT_ORIG (SetCrashKeyValueImpl)
57 | API_EXPORT_ORIG (SetMetricsClientId)
58 | API_EXPORT_ORIG (SetUploadConsent_ExportThunk)
59 | API_EXPORT_ORIG (SignalChromeElf)
60 | API_EXPORT_ORIG (SignalInitializeCrashReporting)
61 |
62 | #define API_COPY(M, N) \
63 | _##N = GetProcAddress(M, #N);
64 |
65 |
66 | /*
67 | //bool AddDllToBlacklist (const wchar_t* dll_name) { return true; }
68 | void ClearReportsBetween_ExportThunk (time_t begin, time_t end) {}
69 |
70 | int CrashForException_ExportThunk (EXCEPTION_POINTERS* info) {
71 | return UnhandledExceptionFilter (info);
72 | }
73 |
74 |
75 | void DisableHook () {}
76 |
77 | uint32_t DrainLog (uint8_t* buffer,
78 | uint32_t buffer_size,
79 | uint32_t* log_remaining) {
80 | return 0;
81 |
82 | }
83 |
84 | bool DumpHungProcessWithPtype_ExportThunk (HANDLE process_handle,
85 | const char* ptype) {
86 | return false;
87 | }
88 |
89 | void DumpProcessWithoutCrash (void* task_port) {}
90 |
91 | int32_t GetApplyHookResult () { return 0; }
92 |
93 | uint32_t GetBlockedModulesCount () { return 0; }
94 |
95 | size_t GetCrashReports_ExportThunk (void* reports,
96 | size_t reports_size) {
97 | return 0;
98 | }
99 |
100 | const wchar_t* GetCrashpadDatabasePath_ExportThunk () {
101 | return nullptr;
102 | }
103 |
104 | void* GetHandleVerifier () { return NULL; };
105 |
106 | const void* GetInstallDetailsPayload () {
107 | return nullptr;
108 | }
109 |
110 | uint32_t GetUniqueBlockedModulesCount () {
111 | return 0;
112 | }
113 |
114 | bool GetUserDataDirectoryThunk (wchar_t* user_data_dir,
115 | size_t user_data_dir_length,
116 | wchar_t* invalid_user_data_dir,
117 | size_t invalid_user_data_dir_length) {
118 | return true;
119 | }
120 |
121 | HANDLE InjectDumpForHungInput_ExportThunk (HANDLE process) {
122 | return nullptr;
123 | }
124 |
125 | bool IsBrowserProcess () {
126 | return true;
127 | }
128 |
129 | bool IsCrashReportingEnabledImpl (const void* local_state) {
130 | return false;
131 | }
132 | bool IsThirdPartyInitialized () {
133 | return false;
134 | }
135 |
136 | bool RegisterLogNotification (HANDLE event_handle) {
137 | return false;
138 | }
139 | void RequestSingleCrashUpload_ExportThunk (const char* local_id) {}
140 | void SetCrashKeyValueImpl (const char*, const char*) {}
141 | void SetMetricsClientId (const char* client_id) {}
142 |
143 | void SetUploadConsent_ExportThunk (bool consent) {}
144 | void SignalChromeElf () {}
145 | void SignalInitializeCrashReporting () {}
146 | //void SuccessfullyBlocked (const wchar_t** blocked_dlls, int* size) {}
147 |
148 | */
--------------------------------------------------------------------------------
/src/BlockTheSpot.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {82F7E20E-D166-4474-8EB1-81160355B5B2}
15 | Win32Proj
16 | SpotifyAdBlock
17 | 10.0
18 | BlockTheSpot
19 |
20 |
21 |
22 | DynamicLibrary
23 | true
24 | v142
25 | MultiByte
26 |
27 |
28 | DynamicLibrary
29 | false
30 | v142
31 | true
32 | MultiByte
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | true
47 | chrome_elf
48 | $(ProjectDir)..\
49 |
50 |
51 | chrome_elf
52 | $(ProjectDir)..\
53 | $(ACE_ROOT);$(IncludePath)
54 | $(ACE_ROOT)\lib;$(LibraryPath)
55 |
56 |
57 |
58 |
59 |
60 | Level3
61 | Disabled
62 | WIN32;_DEBUG;_WINDOWS;_USRDLL;BLOCKTHESPOT_EXPORTS;%(PreprocessorDefinitions)
63 | true
64 | stdcpp17
65 |
66 |
67 | Windows
68 | true
69 | chrome_elf.def
70 | %(AdditionalDependencies)
71 |
72 |
73 |
74 |
75 | Level3
76 |
77 |
78 | MaxSpeed
79 | true
80 | WIN32;NDEBUG;_WINDOWS;_USRDLL;BLOCKTHESPOT_EXPORTS;%(PreprocessorDefinitions)
81 | MultiThreaded
82 | None
83 | Speed
84 | AnySuitable
85 | Sync
86 | true
87 | stdcpp17
88 |
89 |
90 | Windows
91 | true
92 | true
93 | false
94 | chrome_elf.def
95 |
96 |
97 | UseLinkTimeCodeGeneration
98 | true
99 | false
100 | %(AdditionalDependencies)
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 | false
112 |
113 |
114 | false
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/src/BlockTheSpot.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/BlockTheSpot.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/Logger.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "stdafx.h"
3 |
4 | class Logger {
5 | private:
6 | auto current_datetime ()
7 | {
8 | static struct tm newtime;
9 | static __time64_t long_time;
10 | _time64 (&long_time);
11 | localtime_s (&newtime, &long_time);
12 | return std::put_time (&newtime, "%d-%b-%Y %H:%M:%S");
13 | }
14 |
15 | std::ofstream log_stream;
16 | const bool read (std::string_view app, std::string_view key, int def_value = 0) {
17 | if (1 == GetPrivateProfileInt (app.data (), key.data (), def_value, "./config.ini")) {
18 | return true;
19 | }
20 | return false;
21 | }
22 |
23 |
24 | public:
25 | Logger () {
26 | if (read ("Config", "Log")) {
27 | log_stream.open ("blockthespot_log.txt", std::ios::out | std::ios::app);
28 | //m_log << "BlockTheSpot - Build date: " << __TIMESTAMP__ << std::endl;
29 | }
30 | }
31 |
32 | ~Logger () {
33 | if (log_stream.is_open()) {
34 | log_stream.flush ();
35 | log_stream.close ();
36 | }
37 | }
38 |
39 | void Log (std::string_view log) {
40 | if (log_stream.is_open ()) {
41 | std::stringstream message;
42 | message << "LOG | " << current_datetime () << " - " << log;
43 | log_stream << message.str() << std::endl;
44 | }
45 |
46 | }
47 |
48 |
49 | };
50 |
--------------------------------------------------------------------------------
/src/Modify.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "Modify.h"
3 | #include "Logger.h"
4 |
5 | //#include
6 |
7 |
8 |
9 | /*
10 | *
11 | * Black banner still show even libcef hooked.
12 | *
13 | */
14 |
15 | /*
16 | using _cef_urlrequest_create = cef_urlrequest_t * (*)(struct _cef_request_t* request,
17 | struct _cef_urlrequest_client_t* client,
18 | struct _cef_request_context_t* request_context);
19 |
20 | static _cef_urlrequest_create cef_urlrequest_create_orig;
21 |
22 | static constexpr std::array block_list = { "/ads/", "/ad-logic/", "/gabo-receiver-service/" };
23 |
24 | cef_urlrequest_t* cef_urlrequest_create_hook (struct _cef_request_t* request,
25 | struct _cef_urlrequest_client_t* client,
26 | struct _cef_request_context_t* request_context)
27 | {
28 |
29 | cef_string_userfree_utf16_t url_utf16 = request->get_url (request);
30 |
31 | char* c_url = new char[url_utf16->length + 1];
32 | c_url[url_utf16->length] = '\0';
33 |
34 | for (size_t i = 0; i < url_utf16->length; i++) {
35 | c_url[i] = *reinterpret_cast(url_utf16->str + i);
36 | }
37 |
38 | std::string url (c_url);
39 |
40 | delete[] c_url;
41 | cef_string_userfree_utf16_free (url_utf16);
42 |
43 | for (const auto& blockurl : block_list) {
44 | if (std::string::npos != url.find (blockurl)) {
45 | g_Logger.Log ("blocked - " + url);
46 | return nullptr;
47 | }
48 | }
49 | g_Logger.Log ("allow - " + url);
50 | return cef_urlrequest_create_orig (request, client, request_context);
51 | }
52 | */
53 |
54 | // https://www.unknowncheats.me/forum/1064672-post23.html
55 | bool DataCompare (BYTE* pData, BYTE* bSig, char* szMask)
56 | {
57 | for (; *szMask; ++szMask, ++pData, ++bSig)
58 | {
59 | if (*szMask == 'x' && *pData != *bSig)
60 | return false;
61 | }
62 | return (*szMask) == NULL;
63 | }
64 |
65 | BYTE* FindPattern (BYTE* dwAddress, const DWORD dwSize, BYTE* pbSig, char* szMask)
66 | {
67 | DWORD length = strlen (szMask);
68 | for (DWORD i = NULL; i < dwSize - length; i++)
69 | {
70 | __try
71 | {
72 | if (DataCompare (dwAddress + i, pbSig, szMask))
73 | return dwAddress + i;
74 | }
75 | __except (EXCEPTION_EXECUTE_HANDLER) {
76 | return nullptr;
77 | }
78 | }
79 | return 0;
80 | }
81 |
82 |
83 | DWORD WINAPI KillBanner (LPVOID)
84 | {
85 | Logger g_Logger;
86 | HMODULE hModule = GetModuleHandle (NULL);
87 | MODULEINFO mInfo = { 0 };
88 | if (GetModuleInformation (GetCurrentProcess (), hModule, &mInfo, sizeof (MODULEINFO))) {
89 | g_Logger.Log ("GetModuleInformation OK!");
90 | //auto skipPod = FindPattern ((uint8_t*)hModule, mInfo.SizeOfImage, (BYTE*)"\x83\xC4\x08\x84\xC0\x0F\x84\xE5\x03\x00\x00", "xxxxxxxxxxx");
91 | auto skipPod = FindPattern ((uint8_t*)hModule, mInfo.SizeOfImage, (BYTE*)"\x6C\xFF\xFF\xFF\x07\x0F\x85\xB7\x02\x00\x00", "xxxxxxxxxxx");
92 | //Spotify for Windows 1.1.69.612.gb7409abc
93 | if (skipPod)
94 | {
95 | DWORD oldProtect;
96 | VirtualProtect ((char*)skipPod + 5, 1, PAGE_EXECUTE_READWRITE, &oldProtect);
97 | memset ((char*)skipPod + 5, 0x90, 1);
98 | VirtualProtect ((char*)skipPod + 5, 1, oldProtect, &oldProtect);
99 |
100 | VirtualProtect ((char*)skipPod + 6, 1, PAGE_EXECUTE_READWRITE, &oldProtect);
101 | memset ((char*)skipPod + 6, 0xE9, 1);
102 | VirtualProtect ((char*)skipPod + 6, 1, oldProtect, &oldProtect);
103 | g_Logger.Log ("main process - patch success!");
104 | }
105 | else {
106 | g_Logger.Log ("main process - patch failed!");
107 |
108 | skipPod = FindPattern ((uint8_t*)hModule, mInfo.SizeOfImage, (BYTE*)"\x83\xC4\x08\x84\xC0\x0F\x84\xED\x03\x00\x00", "xxxxxxxxxxx");
109 | if (skipPod)
110 | {
111 | DWORD oldProtect;
112 | VirtualProtect ((char*)skipPod + 5, 1, PAGE_EXECUTE_READWRITE, &oldProtect);
113 | memset ((char*)skipPod + 5, 0x90, 1);
114 | VirtualProtect ((char*)skipPod + 5, 1, oldProtect, &oldProtect);
115 |
116 | VirtualProtect ((char*)skipPod + 6, 1, PAGE_EXECUTE_READWRITE, &oldProtect);
117 | memset ((char*)skipPod + 6, 0xE9, 1);
118 | VirtualProtect ((char*)skipPod + 6, 1, oldProtect, &oldProtect);
119 | g_Logger.Log ("main process 1.1.66.578.gc54d0f69-a - patch success!");
120 | }
121 | else {
122 | g_Logger.Log ("main process 1.1.66.578.gc54d0f69-a - patch failed!");
123 | }
124 | }
125 |
126 | }
127 | else {
128 | g_Logger.Log ("GetModuleInformation failed!");
129 | }
130 |
131 | /*
132 | hModule = GetModuleHandle ("libcef.dll");
133 | if (!hModule)
134 | hModule = LoadLibrary ("libcef.dll");
135 |
136 | if (hModule)
137 | {
138 | cef_urlrequest_create_orig = cef_urlrequest_create;//(_cef_urlrequest_create)GetProcAddress (hModule, "cef_urlrequest_create");
139 |
140 | if (cef_urlrequest_create_orig) {
141 | Mhook_SetHook ((PVOID*)&cef_urlrequest_create_orig, cef_urlrequest_create_hook);
142 | }
143 | }
144 | */
145 |
146 |
147 | return 0;
148 | }
149 |
--------------------------------------------------------------------------------
/src/Modify.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "stdafx.h"
3 |
4 | DWORD WINAPI KillBanner (LPVOID);
--------------------------------------------------------------------------------
/src/chrome_elf.def:
--------------------------------------------------------------------------------
1 | LIBRARY "chrome_elf"
2 |
3 | EXPORTS
4 | ClearReportsBetween_ExportThunk
5 | CrashForException_ExportThunk
6 | DisableHook
7 | DrainLog
8 | DumpHungProcessWithPtype_ExportThunk
9 | DumpProcessWithoutCrash
10 | GetApplyHookResult
11 | GetBlockedModulesCount
12 | GetCrashReports_ExportThunk
13 | GetCrashpadDatabasePath_ExportThunk
14 | GetHandleVerifier
15 | GetInstallDetailsPayload
16 | GetUniqueBlockedModulesCount
17 | GetUserDataDirectoryThunk
18 | InjectDumpForHungInput_ExportThunk
19 | IsBrowserProcess
20 | IsCrashReportingEnabledImpl
21 | IsThirdPartyInitialized
22 | RegisterLogNotification
23 | RequestSingleCrashUpload_ExportThunk
24 | SetCrashKeyValueImpl
25 | SetMetricsClientId
26 | SetUploadConsent_ExportThunk
27 | SignalChromeElf
28 | SignalInitializeCrashReporting
--------------------------------------------------------------------------------
/src/dllmain.cpp:
--------------------------------------------------------------------------------
1 | // dllmain.cpp : Defines the entry point for the DLL application.
2 | #include "stdafx.h"
3 | #include "Modify.h"
4 |
5 | BOOL APIENTRY DllMain (HMODULE hModule,
6 | DWORD ul_reason_for_call, LPVOID lpReserved)
7 | {
8 | DisableThreadLibraryCalls (hModule);
9 | std::string_view procname = GetCommandLine ();
10 | // only Spotify process - this help avoid false positive
11 | if (std::string_view::npos != procname.find ("Spotify.exe")) {
12 | switch (ul_reason_for_call)
13 | {
14 | case DLL_PROCESS_ATTACH:
15 | if (std::string_view::npos == procname.find ("--type=")) {
16 | // block ads request - main process
17 | CreateThread (NULL, NULL, KillBanner, NULL, 0, NULL);
18 | }
19 |
20 | break;
21 | }
22 | }
23 | return TRUE;
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/src/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // SpotifyAdBlock.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/src/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #include "targetver.h"
9 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
10 | // Windows Header Files:
11 | #include
12 | #include
13 |
14 |
15 | // TODO: reference additional headers your program requires here
16 | #include
17 | #include
18 | #include
19 | #include
20 |
--------------------------------------------------------------------------------
/src/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // Including SDKDDKVer.h defines the highest available Windows platform.
4 |
5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/uninstall.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | echo *****************
3 | echo Author: @rednek46
4 | echo Edited by: @Daksh777
5 | echo *****************
6 | echo Removing Patch
7 | if exist "%APPDATA%\Spotify\chrome_elf_bak.dll" (
8 | del /s /q "%APPDATA%\Spotify\chrome_elf.dll" > NUL 2>&1
9 | move "%APPDATA%\Spotify\chrome_elf_bak.dll" "%APPDATA%\Spotify\chrome_elf.dll" > NUL 2>&1
10 | ) else (
11 | echo done
12 | )
13 | pause
14 |
--------------------------------------------------------------------------------