diff --git a/PointerSearcher/Form1.Designer.cs b/PointerSearcher/Form1.Designer.cs index 58589c6..28b5739 100644 --- a/PointerSearcher/Form1.Designer.cs +++ b/PointerSearcher/Form1.Designer.cs @@ -29,10 +29,9 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); this.buttonRead = new System.Windows.Forms.Button(); this.txtPointerSearchResults = new System.Windows.Forms.TextBox(); this.dgvDumpTargets = new System.Windows.Forms.DataGridView(); @@ -44,7 +43,9 @@ private void InitializeComponent() this.ColumnTargetAddress1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ColumnTargetAddress2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ColumnTargetAddress3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ColumnFileRow = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnFileRow = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.buttonSearch = new System.Windows.Forms.Button(); this.textBoxDepth = new System.Windows.Forms.TextBox(); this.textBoxOffsetNum = new System.Windows.Forms.TextBox(); @@ -219,6 +220,8 @@ private void InitializeComponent() this.button10 = new System.Windows.Forms.Button(); this.button11 = new System.Windows.Forms.Button(); this.button12 = new System.Windows.Forms.Button(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.button13 = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.dgvDumpTargets)).BeginInit(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); @@ -279,19 +282,22 @@ private void InitializeComponent() this.ColumnTargetAddress1, this.ColumnTargetAddress2, this.ColumnTargetAddress3, - this.ColumnFileRow}); + this.ColumnFileRow, + this.Column1, + this.Column2}); this.dgvDumpTargets.Location = new System.Drawing.Point(6, 6); this.dgvDumpTargets.MultiSelect = false; this.dgvDumpTargets.Name = "dgvDumpTargets"; this.dgvDumpTargets.RowHeadersVisible = false; this.dgvDumpTargets.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - dataGridViewCellStyle2.NullValue = null; - this.dgvDumpTargets.RowsDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle1.NullValue = null; + this.dgvDumpTargets.RowsDefaultCellStyle = dataGridViewCellStyle1; this.dgvDumpTargets.RowTemplate.Height = 21; this.dgvDumpTargets.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect; this.dgvDumpTargets.Size = new System.Drawing.Size(1088, 163); this.dgvDumpTargets.TabIndex = 2; this.dgvDumpTargets.CellBeginEdit += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.dataGridView1_CellBeginEdit); + this.dgvDumpTargets.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEndEdit); this.dgvDumpTargets.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEnter); // // ColumnPath @@ -352,15 +358,25 @@ private void InitializeComponent() // ColumnFileRow // this.ColumnFileRow.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - this.ColumnFileRow.DefaultCellStyle = dataGridViewCellStyle1; - this.ColumnFileRow.HeaderText = "File"; - this.ColumnFileRow.MinimumWidth = 25; + this.ColumnFileRow.FalseValue = "0"; + this.ColumnFileRow.HeaderText = ""; + this.ColumnFileRow.MinimumWidth = 20; this.ColumnFileRow.Name = "ColumnFileRow"; - this.ColumnFileRow.ReadOnly = true; this.ColumnFileRow.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.ColumnFileRow.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - this.ColumnFileRow.Width = 25; + this.ColumnFileRow.TrueValue = "1"; + this.ColumnFileRow.Width = 20; + // + // Column1 + // + this.Column1.HeaderText = ""; + this.Column1.Name = "Column1"; + this.Column1.ReadOnly = true; + this.Column1.Width = 15; + // + // Column2 + // + this.Column2.HeaderText = "Label"; + this.Column2.Name = "Column2"; // // buttonSearch // @@ -1012,7 +1028,6 @@ private void InitializeComponent() // // resumebutton // - this.resumebutton.Enabled = false; this.resumebutton.Location = new System.Drawing.Point(188, 55); this.resumebutton.Name = "resumebutton"; this.resumebutton.Size = new System.Drawing.Size(85, 23); @@ -1023,7 +1038,6 @@ private void InitializeComponent() // // pausebutton // - this.pausebutton.Enabled = false; this.pausebutton.Location = new System.Drawing.Point(97, 55); this.pausebutton.Name = "pausebutton"; this.pausebutton.Size = new System.Drawing.Size(85, 23); @@ -1110,17 +1124,17 @@ private void InitializeComponent() // fromDataGridViewTextBoxColumn // this.fromDataGridViewTextBoxColumn.DataPropertyName = "From"; - dataGridViewCellStyle3.Format = "X10"; - dataGridViewCellStyle3.NullValue = null; - this.fromDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle2.Format = "X10"; + dataGridViewCellStyle2.NullValue = null; + this.fromDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle2; this.fromDataGridViewTextBoxColumn.HeaderText = "From"; this.fromDataGridViewTextBoxColumn.Name = "fromDataGridViewTextBoxColumn"; // // toDataGridViewTextBoxColumn // this.toDataGridViewTextBoxColumn.DataPropertyName = "To"; - dataGridViewCellStyle4.Format = "X10"; - this.toDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle3.Format = "X10"; + this.toDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle3; this.toDataGridViewTextBoxColumn.HeaderText = "To"; this.toDataGridViewTextBoxColumn.Name = "toDataGridViewTextBoxColumn"; // @@ -1954,11 +1968,31 @@ private void InitializeComponent() this.button12.UseVisualStyleBackColor = true; this.button12.Click += new System.EventHandler(this.button12_Click); // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(619, 486); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(100, 40); + this.textBox1.TabIndex = 104; + // + // button13 + // + this.button13.Location = new System.Drawing.Point(725, 496); + this.button13.Name = "button13"; + this.button13.Size = new System.Drawing.Size(116, 23); + this.button13.TabIndex = 105; + this.button13.Text = "Reverse byte order"; + this.button13.UseVisualStyleBackColor = true; + this.button13.Click += new System.EventHandler(this.button13_Click_1); + // // 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.button13); + this.Controls.Add(this.textBox1); this.Controls.Add(this.button12); this.Controls.Add(this.button11); this.Controls.Add(this.button10); @@ -2005,7 +2039,7 @@ private void InitializeComponent() this.Controls.Add(this.pictureBox2); this.Controls.Add(this.groupBox4); this.Name = "Form1"; - this.Text = "PointerSearcher SE 0.5.10"; + this.Text = "PointerSearcher SE 0.5.11"; this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this.dgvDumpTargets)).EndInit(); this.tabControl1.ResumeLayout(false); @@ -2204,15 +2238,6 @@ private void InitializeComponent() private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.GroupBox groupBox4; private System.Windows.Forms.Button button10; - private System.Windows.Forms.DataGridViewTextBoxColumn ColumnPath; - private System.Windows.Forms.DataGridViewTextBoxColumn ColumnMainStart; - private System.Windows.Forms.DataGridViewTextBoxColumn ColumnMainEnd; - private System.Windows.Forms.DataGridViewTextBoxColumn ColumnHeapStart; - private System.Windows.Forms.DataGridViewTextBoxColumn ColumnHeapEnd; - private System.Windows.Forms.DataGridViewTextBoxColumn ColumnTargetAddress1; - private System.Windows.Forms.DataGridViewTextBoxColumn ColumnTargetAddress2; - private System.Windows.Forms.DataGridViewTextBoxColumn ColumnTargetAddress3; - private System.Windows.Forms.DataGridViewTextBoxColumn ColumnFileRow; private System.Windows.Forms.DataGridViewTextBoxColumn lblRow; private System.Windows.Forms.DataGridViewTextBoxColumn Address1; private System.Windows.Forms.DataGridViewTextBoxColumn Label; @@ -2224,6 +2249,19 @@ private void InitializeComponent() private System.Windows.Forms.RadioButton radioButton16; private System.Windows.Forms.RadioButton radioButton17; private System.Windows.Forms.Button buttonNarrowDownMinus; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button button13; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnPath; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnMainStart; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnMainEnd; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnHeapStart; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnHeapEnd; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnTargetAddress1; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnTargetAddress2; + private System.Windows.Forms.DataGridViewTextBoxColumn ColumnTargetAddress3; + private System.Windows.Forms.DataGridViewCheckBoxColumn ColumnFileRow; + private System.Windows.Forms.DataGridViewTextBoxColumn Column1; + private System.Windows.Forms.DataGridViewTextBoxColumn Column2; } } diff --git a/PointerSearcher/Form1.cs b/PointerSearcher/Form1.cs index c9bcb98..2c3afac 100644 --- a/PointerSearcher/Form1.cs +++ b/PointerSearcher/Form1.cs @@ -118,16 +118,26 @@ private void Form1_Load( object sender, EventArgs e ) { pictureBox1.BringToFront(); dgvDumpTargets.Rows.Add( 10 ); - dgvDumpTargets[8, 0].Value = 1; - dgvDumpTargets[8, 1].Value = 2; - dgvDumpTargets[8, 2].Value = 3; - dgvDumpTargets[8, 3].Value = 4; - dgvDumpTargets[8, 4].Value = 5; - dgvDumpTargets[8, 5].Value = 6; - dgvDumpTargets[8, 6].Value = 7; - dgvDumpTargets[8, 7].Value = 8; - dgvDumpTargets[8, 8].Value = 9; - dgvDumpTargets[8, 9].Value = 10; + dgvDumpTargets[8, 0].Value = 0; + dgvDumpTargets[8, 1].Value = 0; + dgvDumpTargets[8, 2].Value = 0; + dgvDumpTargets[8, 3].Value = 0; + dgvDumpTargets[8, 4].Value = 0; + dgvDumpTargets[8, 5].Value = 0; + dgvDumpTargets[8, 6].Value = 0; + dgvDumpTargets[8, 7].Value = 0; + dgvDumpTargets[8, 8].Value = 0; + dgvDumpTargets[8, 9].Value = 0; + dgvDumpTargets[9, 0].Value = 1; + dgvDumpTargets[9, 1].Value = 2; + dgvDumpTargets[9, 2].Value = 3; + dgvDumpTargets[9, 3].Value = 4; + dgvDumpTargets[9, 4].Value = 5; + dgvDumpTargets[9, 5].Value = 6; + dgvDumpTargets[9, 6].Value = 7; + dgvDumpTargets[9, 7].Value = 8; + dgvDumpTargets[9, 8].Value = 9; + dgvDumpTargets[9, 9].Value = 10; s = new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp ); s.Close(); @@ -444,8 +454,13 @@ private void dataGridView1_CellBeginEdit( object sender, DataGridViewCellCancelE dgvDumpTargets.Rows[e.RowIndex].Cells[3].Value = "0x" + Convert.ToString( reader.heapStartAddress(), 16 ); dgvDumpTargets.Rows[e.RowIndex].Cells[4].Value = "0x" + Convert.ToString( reader.heapEndAddress(), 16 ); dgvDumpTargets.Rows[e.RowIndex].Cells[5].Value = "0x" + Convert.ToString( reader.TargetAddress(), 16 ); + if (reader.extra_data()) { + dgvDumpTargets.Rows[e.RowIndex].Cells[6].Value = "0x" + Convert.ToString( reader.TargetAddress2(), 16 ); + dgvDumpTargets.Rows[e.RowIndex].Cells[7].Value = "0x" + Convert.ToString( reader.TargetAddress3(), 16 ); + dgvDumpTargets.Rows[e.RowIndex].Cells[10].Value = reader.label(); + } // BM1 - + reader.delete(); } } } @@ -532,6 +547,10 @@ private async void buttonNarrowDown_Click( object sender, EventArgs e ) private bool IsBlankRow( DataGridViewRow row ) { + if ( row.Cells[8].Value.ToString() == "0" ) + { + return true; + } for ( int i = 0; i <= 5; i++ ) { if ( row.Cells[i].Value == null ) @@ -662,6 +681,40 @@ private void dataGridView1_CellEnter( object sender, DataGridViewCellEventArgs e // dataGridView1.BeginEdit(true); } + private void dataGridView1_CellEndEdit( object sender, DataGridViewCellEventArgs e ) + { + if (( e.ColumnIndex >= 5 && e.ColumnIndex <= 7 || e.ColumnIndex == 10 ) && dgvDumpTargets.Rows[e.RowIndex].Cells[0].Value !=null) + { + // string filename = dgvDumpTargets.Rows[e.RowIndex].Cells[0].Value.ToString(); + BinaryWriter fileStream = new BinaryWriter( new FileStream( dgvDumpTargets.Rows[e.RowIndex].Cells[0].Value.ToString(), FileMode.Open, FileAccess.Write ) ); + // } + if ( fileStream != null ) + { + fileStream.BaseStream.Seek( 0, SeekOrigin.Begin ); + int magic = 0x4E5A4446; + byte[] buffer = BitConverter.GetBytes( magic ); + fileStream.BaseStream.Write( buffer, 0, 4 ); + buffer = BitConverter.GetBytes( ( dgvDumpTargets.Rows[e.RowIndex].Cells[6].Value != null ) ? Convert.ToInt64( dgvDumpTargets.Rows[e.RowIndex].Cells[6].Value.ToString(), 16 ) : 0 ); + fileStream.BaseStream.Write( buffer, 0, 8 ); + buffer = BitConverter.GetBytes( ( dgvDumpTargets.Rows[e.RowIndex].Cells[7].Value != null ) ? Convert.ToInt64( dgvDumpTargets.Rows[e.RowIndex].Cells[7].Value.ToString(), 16 ) : 0 ); + fileStream.BaseStream.Write( buffer, 0, 8 ); + fileStream.BaseStream.Write( System.Text.Encoding.UTF8.GetBytes( dgvDumpTargets.Rows[e.RowIndex].Cells[10].Value.ToString() ), 0, dgvDumpTargets.Rows[e.RowIndex].Cells[10].Value.ToString().Length); + for (int i = 0; i < 100- dgvDumpTargets.Rows[e.RowIndex].Cells[10].Value.ToString().Length; i++ ) + fileStream.BaseStream.WriteByte( 0 ); + fileStream.BaseStream.Seek( 135 + 32, SeekOrigin.Begin ); + buffer = BitConverter.GetBytes( ( dgvDumpTargets.Rows[e.RowIndex].Cells[5].Value != null ) ? Convert.ToInt64( dgvDumpTargets.Rows[e.RowIndex].Cells[5].Value.ToString(), 16 ) : 0 ); + fileStream.BaseStream.Write( buffer, 0, 8 ); + fileStream.Close(); + } + } + // WIP update extra data + // IDumpDataReader reader = CreateDumpDataReader( dgvDumpTargets.Rows[e.RowIndex], false ); + // if ( reader == null ) + // { + // throw new Exception( "Invalid input" + Environment.NewLine + "Check highlighted cell" ); + // } + // dataGridView1.BeginEdit(true); + } private void SetProgressBar( int percent ) { progressBar1.Value = percent; @@ -1246,9 +1299,15 @@ private void button3_Click( object sender, EventArgs e ) BinaryWriter fileStream2 = new BinaryWriter( new FileStream( "DirectTransfer.tmp" + Convert.ToString( fileselect ), FileMode.Create, FileAccess.Write ) ); fileStream2.BaseStream.Seek( 0, SeekOrigin.Begin ); fileStream.BaseStream.Seek( 0, SeekOrigin.Begin ); - int magic = 0x4E5A4445; + int magic = 0x4E5A4446; byte[] buffer = BitConverter.GetBytes( magic ); fileStream.BaseStream.Write( buffer, 0, 4 ); + buffer = BitConverter.GetBytes( ( dgvDumpTargets.Rows[fileselect].Cells[6].Value != null ) ? Convert.ToInt64( dgvDumpTargets.Rows[fileselect].Cells[6].Value.ToString(), 16 ) : 0 ); + fileStream.BaseStream.Write( buffer, 0, 8 ); + buffer = BitConverter.GetBytes( ( dgvDumpTargets.Rows[fileselect].Cells[7].Value != null ) ? Convert.ToInt64( dgvDumpTargets.Rows[fileselect].Cells[7].Value.ToString(), 16 ) : 0 ); + fileStream.BaseStream.Write( buffer, 0, 8 ); + if ( dgvDumpTargets.Rows[fileselect].Cells[10].Value !=null ) + fileStream.BaseStream.Write( System.Text.Encoding.UTF8.GetBytes( dgvDumpTargets.Rows[fileselect].Cells[10].Value.ToString()), 0, dgvDumpTargets.Rows[fileselect].Cells[10].Value.ToString().Length ); fileStream.BaseStream.Seek( 135, SeekOrigin.Begin ); buffer = BitConverter.GetBytes( address1 ); fileStream.BaseStream.Write( buffer, 0, 8 ); @@ -2243,5 +2302,18 @@ private async void button13_Click( Object sender, EventArgs e ) buttonCancel.Enabled = false; } } + + private void button13_Click_1( Object sender, EventArgs e ) + { + char[] array = textBox1.Text.Replace(" ","").Replace( "\\x", "" ).ToCharArray(); + int len = array.Length / 2; + char[] reverse = new char[len * 2]; + for ( int i = 0; i < len; i++ ) + { + reverse[i*2] = array[( len - 1 - i ) * 2]; + reverse[i*2 + 1] = array[( len - 1 - i ) * 2 + 1]; + }; + textBox1.Text = new string( reverse ); + } } } diff --git a/PointerSearcher/Form1.resx b/PointerSearcher/Form1.resx index bf35bdd..e5a6832 100644 --- a/PointerSearcher/Form1.resx +++ b/PointerSearcher/Form1.resx @@ -144,6 +144,12 @@ True + + True + + + True + True diff --git a/PointerSearcher/IDumpDataReader.cs b/PointerSearcher/IDumpDataReader.cs index 76e9d53..2946ba6 100644 --- a/PointerSearcher/IDumpDataReader.cs +++ b/PointerSearcher/IDumpDataReader.cs @@ -15,6 +15,11 @@ internal interface IDumpDataReader long heapStartAddress(); long heapEndAddress(); long TargetAddress(); + long TargetAddress2(); + long TargetAddress3(); + void delete(); + string label(); + bool extra_data(); void readsetup(); uint LZ_Compress(byte[] inbuf, byte[] outbuf, int insize); uint LZ_Uncompress(byte[] inbuf, byte[] outbuf, int insize); diff --git a/PointerSearcher/NoexsDumpDataReader.cs b/PointerSearcher/NoexsDumpDataReader.cs index f6d9bce..b84b2aa 100644 --- a/PointerSearcher/NoexsDumpDataReader.cs +++ b/PointerSearcher/NoexsDumpDataReader.cs @@ -63,6 +63,9 @@ class NoexsDumpDataReader : IDumpDataReader private long heapStartAddress; private long heapEndAddress; private long TargetAddress; + private long TargetAddress2; + private long TargetAddress3; + private byte[] label = new byte[100]; private byte[] buffer = new byte[8]; private byte[] buffN = null; private long length = 0; @@ -71,6 +74,7 @@ class NoexsDumpDataReader : IDumpDataReader //private List infos; private Dictionary readData; //key:address,value:data private bool m_compress = false; + private bool m_extra_data = false; public NoexsDumpDataReader(String path, long mainStart, long mainEnd, long heapStart, long heapEnd) { fileStream = new BinaryReader(new FileStream(path, FileMode.Open, FileAccess.Read));//System.Security.AccessControl.FileSystemRights.Read, FileShare.Read, 1024, FileOptions.SequentialScan)); @@ -79,6 +83,7 @@ public NoexsDumpDataReader(String path, long mainStart, long mainEnd, long heapS heapStartAddress = heapStart; heapEndAddress = heapEnd; buffer = new byte[8]; + label = new byte[100]; indices = null; //infos = new List(); readData = new Dictionary(); @@ -180,6 +185,13 @@ private void ReadIndicate() { m_compress = true; } + else if (magic == 0x4E5A4446) + { + m_extra_data = true; + TargetAddress2 = fileStream.ReadInt64(); + TargetAddress3 = fileStream.ReadInt64(); + fileStream.Read(label,0,100); + } else if (magic != 0x4E5A4445) //edizon's version { fileStream.Close(); @@ -420,6 +432,30 @@ long IDumpDataReader.TargetAddress() { return TargetAddress; } + long IDumpDataReader.TargetAddress2() + { + return TargetAddress2; + } + long IDumpDataReader.TargetAddress3() + { + return TargetAddress3; + } + string IDumpDataReader.label() + { + string s = System.Text.Encoding.UTF8.GetString(label, 0, label.Length); + return s; + } + bool IDumpDataReader.extra_data() + { + return m_extra_data; + } + void IDumpDataReader.delete() + { + if ( fileStream != null ) + { + fileStream.Close(); + } + } long IDumpDataReader.TryToParseAbs(List path) { ReadIndicate();