Skip to content

Commit

Permalink
Any parameter passed to the compiled exe, it will crash without promp…
Browse files Browse the repository at this point in the history
…ting
  • Loading branch information
guyrleech committed Jan 9, 2019
1 parent 3e739b3 commit 54ec5e4
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions wcrasher.cs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Create an exe that will crash so that memory dump capture can be tested
Based on code at http://stekodyne.com/?p=11
@guyrleech 2018
Modification History:
09/01/2019 GRL If any parameter passed to the compiled exe, it will crash without prompting
#>

[CmdletBinding()]
Expand Down Expand Up @@ -69,14 +73,18 @@ $csharp = @'
{
static class Program
{
static void Main()
static void Main( string[] args )
{
DialogResult result = MessageBox.Show( "Click OK to crash the application",
"Wcrasher", MessageBoxButtons.OKCancel );
DialogResult result = 0 ;
if( args.Length == 0 )
{
result = MessageBox.Show( "Click OK to crash the application",
"Wcrasher", MessageBoxButtons.OKCancel );
}
unsafe
{
int *badptr = (int *)0 ;
if( DialogResult.OK == result )
if( args.Length > 0 || DialogResult.OK == result )
{
*badptr = 0xbad ;
}
Expand Down

0 comments on commit 54ec5e4

Please sign in to comment.