From 9f33cb1b82cfbbea1bfa954c5948367993a1eb3a Mon Sep 17 00:00:00 2001 From: MyDrift Date: Wed, 31 Jul 2024 03:50:50 +0200 Subject: [PATCH] add "Disable detailed BSoD Preference" (#2451) --- config/tweaks.json | 8 +++++ functions/private/Get-WinUtilToggleStatus.ps1 | 9 +++++ .../private/Invoke-WinUtilDetailedBSoD.ps1 | 34 +++++++++++++++++++ functions/public/Invoke-WPFToggle.ps1 | 1 + 4 files changed, 52 insertions(+) create mode 100644 functions/private/Invoke-WinUtilDetailedBSoD.ps1 diff --git a/config/tweaks.json b/config/tweaks.json index 1010071f..8916e1ef 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -3152,6 +3152,14 @@ "Order": "a204_", "Type": "Toggle" }, + "WPFToggleDetailedBSoD": { + "Content": "Detailed BSoD", + "Description": "If Enabled then you will see a detailed Blue Screen of Death (BSOD) with more information.", + "category": "Customize Preferences", + "panel": "2", + "Order": "a205_", + "Type": "Toggle" + }, "WPFOOSUbutton": { "Content": "Run OO Shutup 10", "category": "z__Advanced Tweaks - CAUTION", diff --git a/functions/private/Get-WinUtilToggleStatus.ps1 b/functions/private/Get-WinUtilToggleStatus.ps1 index 76245f9b..56d8d14d 100644 --- a/functions/private/Get-WinUtilToggleStatus.ps1 +++ b/functions/private/Get-WinUtilToggleStatus.ps1 @@ -154,4 +154,13 @@ Function Get-WinUtilToggleStatus { return $true } } + if ($ToggleSwitch -eq "WPFToggleDetailedBSoD") { + $DetailedBSoD = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisplayParameters + if($DetailedBSoD -eq 0) { + return $false + } + else{ + return $true + } + } } diff --git a/functions/private/Invoke-WinUtilDetailedBSoD.ps1 b/functions/private/Invoke-WinUtilDetailedBSoD.ps1 new file mode 100644 index 00000000..ad871558 --- /dev/null +++ b/functions/private/Invoke-WinUtilDetailedBSoD.ps1 @@ -0,0 +1,34 @@ +Function Invoke-WinUtilDetailedBSoD { + <# + + .SYNOPSIS + Enables/Disables Detailed BSoD + (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl' -Name 'DisplayParameters').DisplayParameters + + + #> + Param($Enabled) + Try{ + if ($Enabled -eq $false){ + Write-Host "Enabling Detailed BSoD" + $value = 1 + } + else { + Write-Host "Disabling Detailed BSoD" + $value =0 + } + + $Path = "HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl" + Set-ItemProperty -Path $Path -Name DisplayParameters -Value $value + } + Catch [System.Security.SecurityException] { + Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception" + } + Catch [System.Management.Automation.ItemNotFoundException] { + Write-Warning $psitem.Exception.ErrorRecord + } + Catch{ + Write-Warning "Unable to set $Name due to unhandled exception" + Write-Warning $psitem.Exception.StackTrace + } +} \ No newline at end of file diff --git a/functions/public/Invoke-WPFToggle.ps1 b/functions/public/Invoke-WPFToggle.ps1 index 539878c7..fa1868f2 100644 --- a/functions/public/Invoke-WPFToggle.ps1 +++ b/functions/public/Invoke-WPFToggle.ps1 @@ -32,5 +32,6 @@ function Invoke-WPFToggle { "WPFToggleTaskView" {Invoke-WinUtilTaskView $(Get-WinUtilToggleStatus WPFToggleTaskView)} "WPFToggleHiddenFiles" {Invoke-WinUtilHiddenFiles $(Get-WinUtilToggleStatus WPFToggleHiddenFiles)} "WPFToggleTaskbarAlignment" {Invoke-WinUtilTaskbarAlignment $(Get-WinUtilToggleStatus WPFToggleTaskbarAlignment)} + "WPFToggleDetailedBSoD" {Invoke-WinUtilDetailedBSoD $(Get-WinUtilToggleStatus WPFToggleDetailedBSoD)} } }