Skip to content

Commit

Permalink
direct transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvita committed Sep 15, 2020
1 parent 3786b90 commit 424833a
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 47 deletions.
62 changes: 31 additions & 31 deletions PointerSearcher/Form1.Designer.cs

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

51 changes: 40 additions & 11 deletions PointerSearcher/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ private async void buttonRead_Click(object sender, EventArgs e)
reader.readsetup();
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[2].Value = "0x" + Convert.ToString(reader.mainEndAddress(), 16);
dataGridView1.Rows[0].Cells[3].Value = "0x" + Convert.ToString(reader.heapStartAddress(), 16);
dataGridView1.Rows[0].Cells[4].Value = "0x" + Convert.ToString(reader.heapEndAddress(), 16);
// dataGridView1.Rows[0].Cells[5].Value = "0x" + Convert.ToString(reader.TargetAddress(), 16);
Expand Down Expand Up @@ -682,12 +681,12 @@ private int receivedata(ref byte[] dataset)
dataset = new byte[2048*32];
while (s.Available < size) ;
int dc = s.Receive(datasetc);
size = LZ_Uncompress(datasetc,ref dataset, size);
size = LZ_Uncompress(datasetc, ref dataset, size);
}
//else dataset = null;
return size;
}
private long[][] pointer_candidate;
private long[,] pointer_candidate;
private void button3_Click(object sender, EventArgs e)
{
RecSizeBox.BackColor = System.Drawing.Color.White;
Expand All @@ -710,8 +709,14 @@ private void button3_Click(object sender, EventArgs e)
MainEndBox.Text = "0x" + Convert.ToString(address2, 16);
HeapStartBox.Text = "0x" + Convert.ToString(address3, 16);
HeapEndBox.Text = "0x" + Convert.ToString(address4, 16);


dataGridView1.Rows[0].Cells[0].Value = "DirectTransfer.dmp1";
dataGridView1.Rows[0].Cells[1].Value = "0x" + Convert.ToString(address1, 16);
dataGridView1.Rows[0].Cells[2].Value = "0x" + Convert.ToString(address2, 16);
dataGridView1.Rows[0].Cells[3].Value = "0x" + Convert.ToString(address3, 16);
dataGridView1.Rows[0].Cells[4].Value = "0x" + Convert.ToString(address4, 16);

//pointer_candidate = new long[30000000, 2];
info = new PointerInfo();
new Thread(() =>
{
Stopwatch sw = Stopwatch.StartNew();
Expand All @@ -721,32 +726,56 @@ private void button3_Click(object sender, EventArgs e)
do
{
c1 = receivedata(ref dataset);
totaldata += c1;
this.RecSizeBox.Invoke((MethodInvoker)delegate
{
RecSizeBox.Text = Convert.ToString(totaldata);
progressBar2.Value =(int)(100*(BitConverter.ToInt64(dataset,0)- address1) /(address2-address1));
for (int i = 0; i < c1; i +=16)
{
//pointer_candidate[(totaldata+i)/16, 0] = BitConverter.ToInt64(dataset, i);
//pointer_candidate[(totaldata+i)/16, 1] = BitConverter.ToInt64(dataset, i + 8);
Address from = new Address(MemoryType.MAIN, BitConverter.ToInt64(dataset, i ) - address1);
Address to = new Address(MemoryType.HEAP, BitConverter.ToInt64(dataset, i + 8) - address3);
info.AddPointer(from, to);
}
RecSizeBox.Text = Convert.ToString(totaldata+c1);
progressBar2.Value = (int)(100 * (BitConverter.ToInt64(dataset, 0) - address1) / (address2 - address1));
progressBar1.Value = progressBar2.Value;
timeusedBox.Text = Convert.ToString(sw.ElapsedMilliseconds);
});
totaldata += c1;
} while (c1 > 0);
do
{
c1 = receivedata(ref dataset);
totaldata += c1;
this.RecSizeBox.Invoke((MethodInvoker)delegate
{
RecSizeBox.Text = Convert.ToString(totaldata);
progressBar2.Value = (int)(100*(BitConverter.ToInt64(dataset, 0)- address3) / (address4-address3));
for (int i = 0; i < c1 ; i+=16)
{
//pointer_candidate[(totaldata+i)/16, 0] = BitConverter.ToInt64(dataset, i);
//pointer_candidate[(totaldata+i)/16, 1] = BitConverter.ToInt64(dataset, i + 8);
Address from = new Address(MemoryType.HEAP, BitConverter.ToInt64(dataset, i ) - address3);
Address to = new Address(MemoryType.HEAP, BitConverter.ToInt64(dataset, i + 8) - address3);
info.AddPointer(from, to);
}
RecSizeBox.Text = Convert.ToString(totaldata+c1);
progressBar2.Value = (int)(100 * (BitConverter.ToInt64(dataset, 0) - address3) / (address4 - address3));
progressBar1.Value = progressBar2.Value;
timeusedBox.Text = Convert.ToString(sw.ElapsedMilliseconds);
});
totaldata += c1;
} while (c1 > 0);
info.MakeList();
this.RecSizeBox.Invoke((MethodInvoker)delegate
{
buttonSearch.Enabled = true;
});
while (s.Available < 4) ;
b = new byte[s.Available];
s.Receive(b);
this.RecSizeBox.Invoke((MethodInvoker)delegate
{
showerror(b);
progressBar2.Value = 100;
progressBar1.Value = progressBar2.Value;
RecSizeBox.BackColor = System.Drawing.Color.LightGreen;
timeusedBox.Text = Convert.ToString(sw.ElapsedMilliseconds);
});
Expand Down
10 changes: 5 additions & 5 deletions PointerSearcher/Form1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,19 @@
<metadata name="LastValue.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="From.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="Address.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="To.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="Value.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Address.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="LastValue.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Value.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="From.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="LastValue.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="To.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="From.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
Expand Down

0 comments on commit 424833a

Please sign in to comment.