Skip to content

Commit

Permalink
can modify the main and heap values
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvita committed Oct 1, 2020
1 parent 447db8b commit ad7bca0
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 13 deletions.
22 changes: 11 additions & 11 deletions PointerSearcher/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 77 additions & 1 deletion PointerSearcher/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private async void buttonRead_Click(object sender, EventArgs e)
{
throw new Exception("Invalid input" + Environment.NewLine + "Check highlighted cell");
}
reader.readsetup();
//reader.readsetup(); // not reading again so the change won't be overwritten by what is in the file
dataGridView1.Rows[0].Cells[1].Value = "0x" + Convert.ToString(reader.mainStartAddress(), 16);
dataGridView1.Rows[0].Cells[2].Value = "0x" + Convert.ToString(reader.mainEndAddress(), 16);
dataGridView1.Rows[0].Cells[3].Value = "0x" + Convert.ToString(reader.heapStartAddress(), 16);
Expand Down Expand Up @@ -390,6 +390,7 @@ private IDumpDataReader CreateDumpDataReader(DataGridViewRow row, bool allowUnkn
long mainEnd = -1;
long heapStart = -1;
long heapEnd = -1;
long target = -1;

if (row.Cells[0].Value != null)
{
Expand All @@ -399,7 +400,82 @@ private IDumpDataReader CreateDumpDataReader(DataGridViewRow row, bool allowUnkn
{
row.Cells[0].Style.BackColor = Color.Red;
canCreate = false;
return null;
}
if (row.Cells[1].Value == null)
return new NoexsDumpDataReader(path, mainStart, mainEnd, heapStart, heapEnd);

try
{
mainStart = Convert.ToInt64(row.Cells[1].Value.ToString(), 16);
}
catch
{
row.Cells[1].Style.BackColor = Color.Red;
canCreate = false;
}
try
{
mainEnd = Convert.ToInt64(row.Cells[2].Value.ToString(), 16);
}
catch
{
row.Cells[2].Style.BackColor = Color.Red;
canCreate = false;
}
try
{
heapStart = Convert.ToInt64(row.Cells[3].Value.ToString(), 16);
}
catch
{
row.Cells[3].Style.BackColor = Color.Red;
canCreate = false;
}
try
{
heapEnd = Convert.ToInt64(row.Cells[4].Value.ToString(), 16);
}
catch
{
row.Cells[4].Style.BackColor = Color.Red;
canCreate = false;
}
try
{
target = Convert.ToInt64(row.Cells[5].Value.ToString(), 16);
}
catch
{
row.Cells[5].Style.BackColor = Color.Red;
canCreate = false;
}
if (!canCreate)
{
return null;
}
//if (mainEnd <= mainStart)
//{
// row.Cells[1].Style.BackColor = Color.Red;
// row.Cells[2].Style.BackColor = Color.Red;
// canCreate = false;
//}
//if (heapEnd <= heapStart)
//{
// row.Cells[3].Style.BackColor = Color.Red;
// row.Cells[4].Style.BackColor = Color.Red;
// canCreate = false;
//}
//if (allowUnknownTarget && (target == 0))
//{
// //if target address is set to 0,it means unknown address.
//}
//else if ((target < heapStart) || (heapEnd <= target))
//{
// //if not unknown,target should be located at heap region
// row.Cells[5].Style.BackColor = Color.Red;
// canCreate = false;
//}
if (!canCreate)
{
return null;
Expand Down
3 changes: 3 additions & 0 deletions PointerSearcher/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@
<metadata name="Search.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>116, 17</value>
</metadata>
<metadata name="Search.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>116, 17</value>
</metadata>
<metadata name="pointers_candidates.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>204, 17</value>
</metadata>
Expand Down
9 changes: 8 additions & 1 deletion PointerSearcher/NoexsDumpDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,14 @@ PointerInfo IDumpDataReader.Read(CancellationToken token, IProgress<int> prog)
sw.Start();
PointerInfo pointerInfo = new PointerInfo();

ReadIndicate();
//ReadIndicate();
fileStream.BaseStream.Seek(0, SeekOrigin.Begin);
int magic = fileStream.ReadInt32();
if (magic == 0x4E5A4665)
{
m_compress = true;
}

long start = 134 + 8 * 5; // Edizon start of data dump
long length = (fileStream.BaseStream.Length - start) / 16;// from Address+ to address
fileStream.BaseStream.Seek(start, SeekOrigin.Begin);
Expand Down

0 comments on commit ad7bca0

Please sign in to comment.