Skip to content

Commit

Permalink
Added Razer Block
Browse files Browse the repository at this point in the history
Added the razer block by chris titus under the Fixes Section
  • Loading branch information
xicor22 committed Sep 11, 2024
1 parent 19a3c70 commit 3d8bf2b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
9 changes: 9 additions & 0 deletions config/feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,15 @@
"ButtonWidth": "300",
"link": "https://christitustech.github.io/winutil/dev/features/Fixes/RunAdobeCCCleanerTool"
},
"WPFRazerBlock": {
"Content": "Block Razer",
"category": "Fixes",
"panel": "1",
"Order": "a046_",
"Type": "Button",
"ButtonWidth": "300",
"link": "https://christitustech.github.io/winutil/dev/features/Fixes/razer"
},
"WPFPanelnetwork": {
"Content": "Network Connections",
"category": "Legacy Windows Panels",
Expand Down
1 change: 1 addition & 0 deletions functions/public/Invoke-WPFButton.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function Invoke-WPFButton {
"WPFFixesUpdate" {Invoke-WPFFixesUpdate}
"WPFFixesWinget" {Invoke-WPFFixesWinget}
"WPFRunAdobeCCCleanerTool" {Invoke-WPFRunAdobeCCCleanerTool}
"WPFRazerBlock" {Invoke-WPFRazerBlock}
"WPFFixesNetwork" {Invoke-WPFFixesNetwork}
"WPFUpdatesdisable" {Invoke-WPFUpdatesdisable}
"WPFUpdatessecurity" {Invoke-WPFUpdatessecurity}
Expand Down
22 changes: 22 additions & 0 deletions functions/public/Invoke-WPFRazerBlock.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function Invoke-WPFRazerBlock {
<#
.SYNOPSIS
Blocks razer software automatic install.
.DESCRIPTION
It disables the automatic driver installation and denies write permission to razer installation to prevent the autoinstall.
#>
$RazerPath = "C:\Windows\Installer\Razer"

# Disable driver auto-install via registry
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching" -Name "SearchOrderConfig" -Type DWord -Value 0
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Device Installer" -Name "DisableCoInstallers" -Type DWord -Value 1

# Remove and lock install directory
Remove-Item $RazerPath -Recurse -Force
New-Item -Path "C:\Windows\Installer\" -Name "Razer" -ItemType "directory"
$Acl = Get-Acl $RazerPath
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule("NT AUTHORITY\SYSTEM", "Write", "ContainerInherit,ObjectInherit", "None", "Deny")

$Acl.SetAccessRule($Ar)
Set-Acl $RazerPath $Acl
}

0 comments on commit 3d8bf2b

Please sign in to comment.