From 236bc377c916ab5becad483248f153377b384181 Mon Sep 17 00:00:00 2001
From: tomvita <68505331+tomvita@users.noreply.github.com>
Date: Thu, 9 Sep 2021 14:14:55 +0800
Subject: [PATCH] Change error code display
---
PointerSearcher/Form1.Designer.cs | 39 ++++++++-
PointerSearcher/Form1.cs | 115 ++++++++++++++++++++++++-
PointerSearcher/PointerSearcher.csproj | 27 ++++++
3 files changed, 179 insertions(+), 2 deletions(-)
diff --git a/PointerSearcher/Form1.Designer.cs b/PointerSearcher/Form1.Designer.cs
index 28b5739..d774fd6 100644
--- a/PointerSearcher/Form1.Designer.cs
+++ b/PointerSearcher/Form1.Designer.cs
@@ -222,6 +222,9 @@ private void InitializeComponent()
this.button12 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button13 = new System.Windows.Forms.Button();
+ this.WatchPointAddress_textBox11 = new System.Windows.Forms.TextBox();
+ this.SetWatchPoint_button = new System.Windows.Forms.Button();
+ this.button14 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dgvDumpTargets)).BeginInit();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
@@ -1986,11 +1989,42 @@ private void InitializeComponent()
this.button13.UseVisualStyleBackColor = true;
this.button13.Click += new System.EventHandler(this.button13_Click_1);
//
+ // WatchPointAddress_textBox11
+ //
+ this.WatchPointAddress_textBox11.Location = new System.Drawing.Point(847, 496);
+ this.WatchPointAddress_textBox11.Name = "WatchPointAddress_textBox11";
+ this.WatchPointAddress_textBox11.Size = new System.Drawing.Size(126, 20);
+ this.WatchPointAddress_textBox11.TabIndex = 106;
+ this.WatchPointAddress_textBox11.TextChanged += new System.EventHandler(this.WatchPointAddress_textBox11_TextChanged);
+ //
+ // SetWatchPoint_button
+ //
+ this.SetWatchPoint_button.Location = new System.Drawing.Point(982, 495);
+ this.SetWatchPoint_button.Name = "SetWatchPoint_button";
+ this.SetWatchPoint_button.Size = new System.Drawing.Size(116, 23);
+ this.SetWatchPoint_button.TabIndex = 107;
+ this.SetWatchPoint_button.Text = "Set HWB Point";
+ this.SetWatchPoint_button.UseVisualStyleBackColor = true;
+ this.SetWatchPoint_button.Click += new System.EventHandler(this.SetWatchPoint_button_Click);
+ //
+ // button14
+ //
+ this.button14.Location = new System.Drawing.Point(982, 471);
+ this.button14.Name = "button14";
+ this.button14.Size = new System.Drawing.Size(116, 23);
+ this.button14.TabIndex = 108;
+ this.button14.Text = "Set Watch Point";
+ this.button14.UseVisualStyleBackColor = true;
+ this.button14.Click += new System.EventHandler(this.button14_Click);
+ //
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1113, 659);
+ this.Controls.Add(this.button14);
+ this.Controls.Add(this.SetWatchPoint_button);
+ this.Controls.Add(this.WatchPointAddress_textBox11);
this.Controls.Add(this.button13);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button12);
@@ -2039,7 +2073,7 @@ private void InitializeComponent()
this.Controls.Add(this.pictureBox2);
this.Controls.Add(this.groupBox4);
this.Name = "Form1";
- this.Text = "PointerSearcher SE 0.5.11";
+ this.Text = "PointerSearcher SE 0.5.13";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.dgvDumpTargets)).EndInit();
this.tabControl1.ResumeLayout(false);
@@ -2262,6 +2296,9 @@ private void InitializeComponent()
private System.Windows.Forms.DataGridViewCheckBoxColumn ColumnFileRow;
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
+ private System.Windows.Forms.TextBox WatchPointAddress_textBox11;
+ private System.Windows.Forms.Button SetWatchPoint_button;
+ private System.Windows.Forms.Button button14;
}
}
diff --git a/PointerSearcher/Form1.cs b/PointerSearcher/Form1.cs
index ecd24cd..1ce81a7 100644
--- a/PointerSearcher/Form1.cs
+++ b/PointerSearcher/Form1.cs
@@ -888,7 +888,10 @@ private bool is_attached()
private bool showerror( byte[] b )
{
- errorBox.Text = Convert.ToString( b[0] ) + " . " + Convert.ToString( b[1] ) + " . " + Convert.ToString( b[2] ) + " . " + Convert.ToString( b[3] );
+ int rc = BitConverter.ToInt32( b, 0 );
+ int module = rc & 0x1FF;
+ int res = ( ( rc ) >> 9 ) & 0x1FFF;
+ errorBox.Text = Convert.ToString( module ) + "." + Convert.ToString( res );//Convert.ToString( b[0] ) + " . " + Convert.ToString( b[1] ) + " . " + Convert.ToString( b[2] ) + " . " + Convert.ToString( b[3] );
if ( b[0] == 15 && b[1] == 8 )
{
errorBox.Text += " pminfo not valid";
@@ -909,6 +912,16 @@ private bool showerror( byte[] b )
{
errorBox.Text += " file not accessible";
}
+ if (module == 1)
+ {
+ errorBox.Text += " Kernel ";
+ if ( res == 114 )
+ errorBox.Text += "InvalidHandle";
+ if ( res == 116 )
+ errorBox.Text += "InvalidCombination";
+ if ( res == 127 )
+ errorBox.Text += "InvalidHwBreakpoint";
+ }
user_abort = false;
user_abort2 = false;
command_inprogress = false;
@@ -2316,5 +2329,105 @@ private void button13_Click_1( Object sender, EventArgs e )
};
textBox1.Text = new string( reverse );
}
+
+ private void SetWatchPoint_button_Click( Object sender, EventArgs e )
+ {
+ if ( !command_available() )
+ {
+ return;
+ }
+
+ WatchPointAddress_textBox11.BackColor = System.Drawing.Color.White;
+
+ int a = SendMessage( NoexsCommands.SetBreakpoint );
+ // setup HWBP context
+ // send id = 5
+ byte[] id = new byte[4];
+ id = BitConverter.GetBytes( Convert.ToInt32(textBox8.Text) );
+ a = SendData( id );
+ // send addr = 0
+ byte[] k = new byte[8];
+ // long k1 = Convert.ToInt64( WatchPointAddress_textBox11.Text ); //get address
+ //long k1 = 0;
+ long k1 = Convert.ToInt64( WatchPointAddress_textBox11.Text, 16 ); //get address long heapStart = Convert.ToInt64( dgvDumpTargets.Rows[fileselect].Cells[3].Value.ToString(), 16 );
+ k = BitConverter.GetBytes( k1 );
+ a = SendData( k );
+ // send flag
+ long res = 1; //enabled
+ res |= 0xF << 5; // Match the A64 or A32 instruction at DBGBVR, or context match.n
+ res |= 6 << 16; // does this matter?
+ res |= 3 << 20; // LINKED_CONTEXT_IDR_MATCH(0b0011)
+ long dbgbcr = ( 0x3 << 20 ) | ( 0x0 << 16 ) | ( 0xF << 5 ) | 1;
+ k = BitConverter.GetBytes( (long)dbgbcr );
+ a = SendData( k );
+
+
+ while ( s.Available < 4 )
+ {
+ ;
+ }
+
+
+ byte[] b = new byte[s.Available];
+ s.Receive( b );
+ if ( !showerror( b ) )
+ {
+ WatchPointAddress_textBox11.BackColor = System.Drawing.Color.LightGreen;
+ pausebutton.Enabled = true;
+ resumebutton.Enabled = false;
+ }
+ }
+
+ private void WatchPointAddress_textBox11_TextChanged( Object sender, EventArgs e )
+ {
+ WatchPointAddress_textBox11.BackColor = System.Drawing.Color.White;
+ }
+
+ private void button14_Click( Object sender, EventArgs e )
+ {
+
+ if ( !command_available() )
+ {
+ return;
+ }
+
+ WatchPointAddress_textBox11.BackColor = System.Drawing.Color.White;
+
+ int a = SendMessage( NoexsCommands.SetBreakpoint );
+ // set up watch point
+ // send id = 0x10
+ byte[] id = new byte[4];
+ id = BitConverter.GetBytes( (int)0x10 );
+ a = SendData( id );
+ // send addr = 0
+ byte[] k = new byte[8];
+ long k1 = Convert.ToInt64( WatchPointAddress_textBox11.Text,16 ); //get address long heapStart = Convert.ToInt64( dgvDumpTargets.Rows[fileselect].Cells[3].Value.ToString(), 16 );
+ k = BitConverter.GetBytes( k1 );
+ a = SendData( k );
+ // send flag
+ long res = 1; //enabled
+ res |= 2 << 3; //1 = read, 2 = write, 3 = RW
+ res |= 0xFF << 5; // byte select all 8 bytes
+ res |= 4 << 16; // link BP number
+ res |= 5 << 24; // not using mask == 0
+ k = BitConverter.GetBytes( res );
+ a = SendData( k );
+
+
+ while ( s.Available < 4 )
+ {
+ ;
+ }
+
+
+ byte[] b = new byte[s.Available];
+ s.Receive( b );
+ if ( !showerror( b ) )
+ {
+ WatchPointAddress_textBox11.BackColor = System.Drawing.Color.LightGreen;
+ pausebutton.Enabled = true;
+ resumebutton.Enabled = false;
+ }
+ }
}
}
diff --git a/PointerSearcher/PointerSearcher.csproj b/PointerSearcher/PointerSearcher.csproj
index 95ea40f..dbe008f 100644
--- a/PointerSearcher/PointerSearcher.csproj
+++ b/PointerSearcher/PointerSearcher.csproj
@@ -12,6 +12,21 @@
512
true
true
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
AnyCPU
@@ -169,5 +184,17 @@
+
+
+ False
+ Microsoft .NET Framework 4.7.2 %28x86 and x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
\ No newline at end of file