20 |
{ |
{ |
21 |
public partial class FloatingPEViewer : DockContent, |
public partial class FloatingPEViewer : DockContent, |
22 |
IAcceptsPlugin<IConfigPlugin>, |
IAcceptsPlugin<IConfigPlugin>, |
23 |
IAcceptsProcess<Process>, |
IAcceptsProcess, |
24 |
IAcceptsProcessAndConfig, |
IAcceptsProcessAndConfig, |
25 |
IAcceptsPEData |
IAcceptsPEData |
26 |
{ |
{ |
27 |
public FloatingPEViewer() { InitializeComponent(); this.AcceptedPlugin = null; this.AcceptedProcess = null; OnPEDataUpdated = null; } |
public FloatingPEViewer() { InitializeComponent(); this.AcceptedPlugin = null; this.ProcessPID = 0; OnPEDataUpdated = null; } |
28 |
public FloatingPEViewer(IConfigPlugin config) : this() { this.AcceptedPlugin = config; } |
public FloatingPEViewer(IConfigPlugin config) : this() { this.AcceptedPlugin = config; } |
29 |
public FloatingPEViewer(IConfigPlugin config, Process process) : this() { this.AcceptedPlugin = config; this.AcceptedProcess = process; } |
public FloatingPEViewer(IConfigPlugin config, int pid) : this() { this.AcceptedPlugin = config; this.ProcessPID = pid; } |
30 |
#region IAcceptsProcess<Process> Members |
#region IAcceptsProcess<Process> Members |
31 |
private Process _AcceptedProcess; |
private int _ProcessPID; |
32 |
public Process AcceptedProcess { get { return _AcceptedProcess; } set { _AcceptedProcess = value; UpdateAcceptedProcess(value); } } |
public int ProcessPID { get { return _ProcessPID; } set { _ProcessPID = value; UpdateProcessPID(value); } } |
33 |
#endregion |
#endregion |
34 |
#region IAcceptsPlugin<IConfigPlugin> Members |
#region IAcceptsPlugin<IConfigPlugin> Members |
35 |
private IConfigPlugin _AcceptedPlugin; |
private IConfigPlugin _AcceptedPlugin; |
44 |
private void UpdateAcceptedPlugin(IConfigPlugin config) |
private void UpdateAcceptedPlugin(IConfigPlugin config) |
45 |
{ |
{ |
46 |
} |
} |
47 |
private void UpdateAcceptedProcess(Process process) |
private void UpdateProcessPID(int pid) |
48 |
{ |
{ |
49 |
#if USE_AUTOMATIC_MEMORY_SEARCH_RANGE && FORCE_USE_OF_MEMORYSIZECONSTANTS |
#if USE_AUTOMATIC_MEMORY_SEARCH_RANGE && FORCE_USE_OF_MEMORYSIZECONSTANTS |
50 |
logger.Warn.WriteLine("FloatingMemorySearcher.UpdateAcceptedProcessAndConfig(IConfigPlugin config, Process process):"); |
logger.Warn.WriteLine("FloatingMemorySearcher.UpdateAcceptedProcessAndConfig(IConfigPlugin config, Process process):"); |
58 |
#endif |
#endif |
59 |
#if USE_AUTOMATIC_MEMORY_SEARCH_RANGE && !FORCE_USE_OF_MEMORYSIZECONSTANTS |
#if USE_AUTOMATIC_MEMORY_SEARCH_RANGE && !FORCE_USE_OF_MEMORYSIZECONSTANTS |
60 |
//// code to automatically choose the best starting memory address and size |
//// code to automatically choose the best starting memory address and size |
61 |
if (process != null) |
if (ProcessPID != 0) |
62 |
{ |
{ |
63 |
string filename = process.MainModule.FileName; |
using (Process p = Process.GetProcessById(ProcessPID)) |
64 |
//string filename = @"c:\Windows\notepad.exe"; |
{ |
65 |
IPEDData peData = PEDataWrapper.GetPEData((IAcceptsProcessAndConfig)this); |
string filename = p.MainModule.FileName; |
66 |
peprops.SelectedObject = peData; |
//string filename = @"c:\Windows\notepad.exe"; |
67 |
peprops.PropertySort = PropertySort.NoSort; |
IPEDData peData = PEDataWrapper.GetPEData((IAcceptsProcessAndConfig)this); |
68 |
if (OnPEDataUpdated != null) |
peprops.SelectedObject = peData; |
69 |
if (peData != null) |
peprops.PropertySort = PropertySort.NoSort; |
70 |
OnPEDataUpdated(new PEViewerDataUpdatedEventArgs(this, peData)); |
if (OnPEDataUpdated != null) |
71 |
|
if (peData != null) |
72 |
|
OnPEDataUpdated(new PEViewerDataUpdatedEventArgs(this, peData)); |
73 |
|
} |
74 |
} |
} |
75 |
else |
else |
76 |
{ |
{ |