/[RomCheater]/trunk/RomCheater/Docking/FloatingPEViewer.cs
ViewVC logotype

Diff of /trunk/RomCheater/Docking/FloatingPEViewer.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 318 by william, Tue Jun 5 17:57:37 2012 UTC revision 587 by william, Thu Jun 6 09:12:35 2013 UTC
# Line 14  using WeifenLuo.WinFormsUI.Docking; Line 14  using WeifenLuo.WinFormsUI.Docking;
14  using RomCheater.PluginFramework.Interfaces;  using RomCheater.PluginFramework.Interfaces;
15  using System.Diagnostics;  using System.Diagnostics;
16  using Sojaner.MemoryScanner;  using Sojaner.MemoryScanner;
17    using RomCheater.PluginFramework.Events;
18    
19  namespace RomCheater.Docking  namespace RomCheater.Docking
20  {  {
21      public partial class FloatingPEViewer : DockContent,      public partial class FloatingPEViewer : DockContent,
22          IAcceptsPlugin<IConfigPlugin>,          IAcceptsPlugin<IConfigPlugin>,
23          IAcceptsProcess<Process>,          IAcceptsProcess<Process>,
24          IAcceptsProcessAndConfig          IAcceptsProcessAndConfig,
25            IAcceptPEData,
26            IAcceptsPEData
27      {      {
28          public FloatingPEViewer() { InitializeComponent(); this.AcceptedPlugin = null; this.AcceptedProcess = null; }          public FloatingPEViewer() { InitializeComponent(); this.AcceptedPlugin = null; this.AcceptedProcess = null; OnPEDataUpdated = null; }
29          public FloatingPEViewer(IConfigPlugin config) : this() { this.AcceptedPlugin = config; }          public FloatingPEViewer(IConfigPlugin config) : this() { this.AcceptedPlugin = config; }
30          public FloatingPEViewer(IConfigPlugin config, Process process) : this() { this.AcceptedPlugin = config; this.AcceptedProcess = process; }          public FloatingPEViewer(IConfigPlugin config, Process process) : this() { this.AcceptedPlugin = config; this.AcceptedProcess = process; }
31          #region IAcceptsProcess<Process> Members          #region IAcceptsProcess<Process> Members
# Line 33  namespace RomCheater.Docking Line 36  namespace RomCheater.Docking
36          private IConfigPlugin _AcceptedPlugin;          private IConfigPlugin _AcceptedPlugin;
37          public IConfigPlugin AcceptedPlugin { get { return _AcceptedPlugin; } set { _AcceptedPlugin = value; UpdateAcceptedPlugin(value); } }          public IConfigPlugin AcceptedPlugin { get { return _AcceptedPlugin; } set { _AcceptedPlugin = value; UpdateAcceptedPlugin(value); } }
38          #endregion          #endregion
39            #region IAcceptsPEData Members
40          int MemoryRangeStart { get; set; }          public event BaseEventHandler<PEViewerDataUpdatedEventArgs> OnPEDataUpdated;
41          uint MemoryRangeSize { get; set; }          #endregion
42            ulong MemoryRangeStart { get; set; }
43            ulong MemoryRangeSize { get; set; }
44    
45          private void UpdateAcceptedPlugin(IConfigPlugin config)          private void UpdateAcceptedPlugin(IConfigPlugin config)
46          {          {
# Line 50  namespace RomCheater.Docking Line 55  namespace RomCheater.Docking
55  #if FORCE_USE_OF_MEMORYSIZECONSTANTS  #if FORCE_USE_OF_MEMORYSIZECONSTANTS
56              // force use of MemorySizeConstants              // force use of MemorySizeConstants
57              MemoryRangeStart = MemorySizeConstants.MinimumAddress;              MemoryRangeStart = MemorySizeConstants.MinimumAddress;
58             MemoryRangeSizee = (MemorySizeConstants.MinimumAddress > 0) ? (uint)(MemorySizeConstants.MaximumAddress - MemorySizeConstants.MinimumAddress) : MemorySizeConstants.MaximumAddress;              MemoryRangeSize = MemoryRangeStart + MemorySizeConstants.MaximumAddressSize;
59  #endif  #endif
60  #if USE_AUTOMATIC_MEMORY_SEARCH_RANGE && !FORCE_USE_OF_MEMORYSIZECONSTANTS  #if USE_AUTOMATIC_MEMORY_SEARCH_RANGE && !FORCE_USE_OF_MEMORYSIZECONSTANTS
61              //// code to automatically choose the best starting memory address and size              //// code to automatically choose the best starting memory address and size
62              if (process != null)              if (process != null)
63              {              {
64                  string filename = process.MainModule.FileName;                  string filename = process.MainModule.FileName;
65                  //string filename = @"c:\Windows\notepad.exe";                  //string filename = @"c:\Windows\notepad.exe";                
66                  PEReader peReader = new PEReader(filename);                  IPEDData peData = PEDataWrapper.GetPEData((IAcceptsProcessAndConfig)this);
67                  peprops.SelectedObject = peReader.GetData;                  peprops.SelectedObject = peData;
68                  peprops.PropertySort = PropertySort.NoSort;                  peprops.PropertySort = PropertySort.NoSort;
69                    if (OnPEDataUpdated != null)
70                        if (peData != null)
71                            OnPEDataUpdated(new PEViewerDataUpdatedEventArgs(this, peData));
72              }              }
73              else              else
74              {              {
75                  MemoryRangeStart = MemorySizeConstants.MinimumAddress;                  MemoryRangeStart = MemorySizeConstants.MinimumAddress;
76                  MemoryRangeSize = (MemorySizeConstants.MinimumAddress > 0) ? (uint)(MemorySizeConstants.MaximumAddress - MemorySizeConstants.MinimumAddress) : MemorySizeConstants.MaximumAddress;                  MemoryRangeSize = MemorySizeConstants.MaximumAddressSize;
77              }              }
78  #endif  #endif
79    

Legend:
Removed from v.318  
changed lines
  Added in v.587

  ViewVC Help
Powered by ViewVC 1.1.22