Skip to content

Commit a1cb7db

Browse files
committed
Added an idiot filter to Watch-BlueScreen
1 parent 2a17b8f commit a1cb7db

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

CodeExecution/Watch-BlueScreen.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
http://blog.cmpxchg8b.com/2013/02/the-other-integer-overflow.html
2424
https://twitter.com/NTarakanov/status/334031968465453057
2525
#>
26+
[CmdletBinding( ConfirmImpact = 'High')] Param ()
2627

2728
try { $Gdi32 = [Gdi32] } catch [Management.Automation.RuntimeException]
2829
{
@@ -68,7 +69,10 @@
6869

6970
$LAYOUT_RTL = 1
7071

71-
$DC = $Gdi32::CreateCompatibleDC([IntPtr]::Zero)
72-
$Gdi32::SetLayout($DC, $LAYOUT_RTL) | Out-Null
73-
$Gdi32::ScaleWindowExtEx($DC, [Int32]::MinValue, -1, 1, 1, [IntPtr]::Zero) | Out-Null
72+
if ($psCmdlet.ShouldContinue( 'Do you want to continue?', 'You may want to save your work before continuing.' ))
73+
{
74+
$DC = $Gdi32::CreateCompatibleDC([IntPtr]::Zero)
75+
$Gdi32::SetLayout($DC, $LAYOUT_RTL) | Out-Null
76+
$Gdi32::ScaleWindowExtEx($DC, [Int32]::MinValue, -1, 1, 1, [IntPtr]::Zero) | Out-Null
77+
}
7478
}

0 commit comments

Comments
 (0)