1 |
#region Logging Defines |
2 |
// include this any class or method that required logging, and comment-out what is not needed |
3 |
|
4 |
#region Enabled logging levels |
5 |
#define LOGGING_ENABLE_INFO |
6 |
#define LOGGING_ENABLE_WARN |
7 |
#define LOGGING_ENABLE_DEBUG |
8 |
#define LOGGING_ENABLE_VERBOSEDEBUG |
9 |
#define LOGGING_ENABLE_ERROR |
10 |
#define LOGGING_ENABLE_VERBOSEERROR |
11 |
#define LOGGING_ENABLE_PROFILER |
12 |
#endregion |
13 |
#endregion |
14 |
#define FORCE_ALL_LOGGING_FLAGS // when defined will force logging flags to ALL |
15 |
#define SHOW_DEBUG_MENU // when defined will show the debug menu or else it will be hidden |
16 |
using System; |
17 |
using System.Collections.Generic; |
18 |
using System.ComponentModel; |
19 |
using System.Data; |
20 |
using System.Drawing; |
21 |
using System.Linq; |
22 |
using System.Text; |
23 |
using System.Windows.Forms; |
24 |
using RomCheater.Logging; |
25 |
using RomCheater.Properties; |
26 |
using RomCheater.UserSettingsSupport; |
27 |
using RomCheater.PluginFramework.Core; |
28 |
using System.Diagnostics; |
29 |
using RomCheater.PluginFramework.Interfaces; |
30 |
using WeifenLuo.WinFormsUI.Docking; |
31 |
using RomCheater.Docking; |
32 |
using System.IO; |
33 |
using Sojaner.MemoryScanner; |
34 |
using RomCheater.PluginFramework.Events; |
35 |
|
36 |
namespace RomCheater |
37 |
{ |
38 |
public partial class Main : Form |
39 |
{ |
40 |
private bool m_bSaveLayout = true; |
41 |
private Process SelectedProcess = null; |
42 |
private DeserializeDockContent m_deserializeDockContent; |
43 |
private FloatingLogWindow m_LogWindow = new FloatingLogWindow(); |
44 |
private FloatingAboutBox m_AboutBox = new FloatingAboutBox(); |
45 |
private FloatingRamDumperDialog m_RamDump = new FloatingRamDumperDialog(); |
46 |
private FloatingPIDSelector m_PIDSelector = new FloatingPIDSelector(); |
47 |
private FloatingMemoryView m_memoryview = new FloatingMemoryView(); |
48 |
private FloatingDataTypeConverter m_typeconverter = new FloatingDataTypeConverter(); |
49 |
private FloatingMemorySearcher m_memsearcher = new FloatingMemorySearcher(); |
50 |
private FloatingPEViewer m_peviewer = new FloatingPEViewer(); |
51 |
private FloatingRVACalculator m_rvacalc = new FloatingRVACalculator(); |
52 |
|
53 |
private FloatingUserControlDock m_ucd = new FloatingUserControlDock(); |
54 |
|
55 |
//private bool log_window_expanded = false; |
56 |
//private double log_window_splitter_default_position = 1.4045; |
57 |
PluginLoader loader = null; |
58 |
IConfigPlugin ConfigPlugin = null; |
59 |
IInputPlugin InputPlugin = null; |
60 |
IWindowPlugin WindowPlugin = null; |
61 |
List<IUserControlPlugin> UserControlPlugins = null; |
62 |
static Main() { SettingSubscriber.AddSubscriber(new Main(), Settings.Default); } |
63 |
//private const string t = "RomCheater"; |
64 |
#region LogWriterSupport |
65 |
static LogWriter _LoggerInstance; |
66 |
static LogWriter LoggerInstance |
67 |
{ |
68 |
get { return _LoggerInstance; } |
69 |
set { _LoggerInstance = value; } |
70 |
} |
71 |
#endregion |
72 |
|
73 |
|
74 |
private void OnProcessChanged(ProcessChangedEventArgs e) |
75 |
{ |
76 |
if (m_memsearcher.SearchInProgess) |
77 |
{ |
78 |
DialogResult result = MessageBox.Show("Do you want to start a new search with the selected process?", "A memory search is currently in progress", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3); |
79 |
if (result != DialogResult.Yes || result != DialogResult.OK) { return; } |
80 |
m_memsearcher = null; //free memory used by the memory searcher |
81 |
m_memsearcher = new FloatingMemorySearcher(); |
82 |
} |
83 |
SelectedProcess = Process.GetProcessById(e.ProcessID); |
84 |
m_RamDump.AcceptedPlugin = this.ConfigPlugin; |
85 |
m_RamDump.AcceptedProcess = SelectedProcess; |
86 |
|
87 |
m_peviewer.AcceptedPlugin = this.ConfigPlugin; |
88 |
m_peviewer.AcceptedProcess = SelectedProcess; |
89 |
m_peviewer.OnPEDataUpdated += new BaseEventHandler<PEViewerDataUpdatedEventArgs>(OnPEDataUpdated); |
90 |
|
91 |
m_memoryview.AcceptedPlugin = this.ConfigPlugin; |
92 |
m_memoryview.AcceptedProcess = SelectedProcess; |
93 |
|
94 |
m_memsearcher.AcceptedPlugin = this.ConfigPlugin; |
95 |
m_memsearcher.AcceptedProcess = SelectedProcess; |
96 |
m_memsearcher.OnBrowseMemoryRegion += new BaseEventHandler<BrowseMemoryRegionEvent>(OnBrowseMemoryRegion); |
97 |
|
98 |
} |
99 |
|
100 |
void OnPEDataUpdated(PEViewerDataUpdatedEventArgs e) |
101 |
{ |
102 |
m_memoryview.SetPEViewerData(e.peData); |
103 |
m_rvacalc.SetPEViewerData(e.peData); |
104 |
} |
105 |
private void OnBrowseMemoryRegion(BrowseMemoryRegionEvent e) |
106 |
{ |
107 |
m_memoryview.BrowseMemoryRegion(e.MemoryRegion); |
108 |
} |
109 |
|
110 |
#region Dock Support |
111 |
void AddDockToWindowList(object sender, EventArgs e) |
112 |
{ |
113 |
DockContent dc; |
114 |
TypeBinder.Bind(sender, out dc); |
115 |
ToolStripMenuItem tsmi = new ToolStripMenuItem(dc.Text); |
116 |
tsmi.Name = dc.Name; |
117 |
tsmi.Tag = dc; |
118 |
tsmi.Click += new EventHandler(tsmi_Click); |
119 |
mnuWindows.DropDownItems.Add(tsmi); |
120 |
} |
121 |
void tsmi_Click(object sender, EventArgs e) |
122 |
{ |
123 |
ToolStripMenuItem tsmi; |
124 |
TypeBinder.Bind(sender, out tsmi); |
125 |
DockContent dc; |
126 |
TypeBinder.Bind(tsmi.Tag, out dc); |
127 |
dc.Activate(); |
128 |
} |
129 |
void RemoveDockFromWindowList(object sender, FormClosedEventArgs e) |
130 |
{ |
131 |
DockContent dc; |
132 |
TypeBinder.Bind(sender, out dc); |
133 |
mnuWindows.DropDownItems.RemoveByKey(dc.Name); |
134 |
} |
135 |
private IDockContent GetContentFromPersistString(string persistString) |
136 |
{ |
137 |
if (persistString == typeof(FloatingLogWindow).ToString()) { return m_LogWindow; } |
138 |
if (persistString == typeof(FloatingRamDumperDialog).ToString()) { return m_RamDump; } |
139 |
if (persistString == typeof(FloatingPIDSelector).ToString()) { return m_PIDSelector; } |
140 |
if (persistString == typeof(FloatingMemoryView).ToString()) { return m_memoryview; } |
141 |
if (persistString == typeof(FloatingDataTypeConverter).ToString()) { return m_typeconverter; } |
142 |
if (persistString == typeof(FloatingMemorySearcher).ToString()) { return m_memsearcher; } |
143 |
if (persistString == typeof(FloatingPEViewer).ToString()) { return m_peviewer; } |
144 |
if (persistString == typeof(FloatingRVACalculator).ToString()) { return m_rvacalc; } |
145 |
if (persistString == typeof(FloatingUserControlDock).ToString()) { return m_ucd; } |
146 |
else { return null; } |
147 |
} |
148 |
public void SetupDocks() |
149 |
{ |
150 |
m_LogWindow = new FloatingLogWindow(); |
151 |
m_AboutBox = new FloatingAboutBox(); |
152 |
m_RamDump = new FloatingRamDumperDialog(); |
153 |
m_PIDSelector = new FloatingPIDSelector(); |
154 |
m_PIDSelector.OnSelectedProcessChanged += new BaseEventHandler<ProcessChangedEventArgs>(OnProcessChanged); |
155 |
m_memoryview = new FloatingMemoryView(); |
156 |
m_typeconverter = new FloatingDataTypeConverter(); |
157 |
m_memsearcher = new FloatingMemorySearcher(); |
158 |
m_memsearcher.OnBrowseMemoryRegion += new BaseEventHandler<BrowseMemoryRegionEvent>(OnBrowseMemoryRegion); |
159 |
m_peviewer = new FloatingPEViewer(); |
160 |
m_peviewer.OnPEDataUpdated += new BaseEventHandler<PEViewerDataUpdatedEventArgs>(OnPEDataUpdated); |
161 |
m_rvacalc = new FloatingRVACalculator(); |
162 |
m_ucd = new FloatingUserControlDock(); |
163 |
m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString); |
164 |
} |
165 |
#region SetupDockWindowHandler support |
166 |
public void SetupDockWindowHandler() |
167 |
{ |
168 |
SetupLogWindowHandler(); |
169 |
SetupRamDumpWindowHandler(); |
170 |
SetupMemoryViewWindowHandler(); |
171 |
SetupPIDSelectorWindowHandler(); |
172 |
SetupDataTypeConverterWindowHandler(); |
173 |
SetupMemorySearchWindowHandler(); |
174 |
SetupPEViewerWindowHandler(); |
175 |
SetupRVACalculatorWindowHandler(); |
176 |
SetupUserControlDockWindowHandler(); |
177 |
} |
178 |
private void SetupLogWindowHandler() |
179 |
{ |
180 |
if (m_LogWindow == null) return; |
181 |
m_LogWindow.Shown += new EventHandler(AddDockToWindowList); |
182 |
m_LogWindow.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList); |
183 |
m_LogWindow.Activate(); |
184 |
} |
185 |
private void SetupRamDumpWindowHandler() |
186 |
{ |
187 |
if (m_RamDump == null) return; |
188 |
m_RamDump.Shown += new EventHandler(AddDockToWindowList); |
189 |
m_RamDump.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList); |
190 |
m_RamDump.AcceptedPlugin = ConfigPlugin; |
191 |
m_RamDump.Activate(); |
192 |
} |
193 |
private void SetupMemoryViewWindowHandler() |
194 |
{ |
195 |
if (m_memoryview == null) return; |
196 |
m_memoryview.Shown += new EventHandler(AddDockToWindowList); |
197 |
m_memoryview.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList); |
198 |
m_memoryview.AcceptedPlugin = ConfigPlugin; |
199 |
m_memoryview.Activate(); |
200 |
} |
201 |
private void SetupPIDSelectorWindowHandler() |
202 |
{ |
203 |
if (m_PIDSelector == null) return; |
204 |
m_PIDSelector.Shown += new EventHandler(AddDockToWindowList); |
205 |
m_PIDSelector.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList); |
206 |
m_PIDSelector.AcceptedPlugin = ConfigPlugin; |
207 |
m_PIDSelector.Activate(); |
208 |
} |
209 |
private void SetupDataTypeConverterWindowHandler() |
210 |
{ |
211 |
if (m_typeconverter == null) return; |
212 |
m_typeconverter.Shown += new EventHandler(AddDockToWindowList); |
213 |
m_typeconverter.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList); |
214 |
m_typeconverter.Activate(); |
215 |
} |
216 |
private void SetupMemorySearchWindowHandler() |
217 |
{ |
218 |
if (m_memsearcher == null) return; |
219 |
m_memsearcher.Shown += new EventHandler(AddDockToWindowList); |
220 |
m_memsearcher.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList); |
221 |
m_memsearcher.Activate(); |
222 |
} |
223 |
private void SetupPEViewerWindowHandler() |
224 |
{ |
225 |
if (m_peviewer == null) return; |
226 |
m_peviewer.Shown += new EventHandler(AddDockToWindowList); |
227 |
m_peviewer.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList); |
228 |
m_PIDSelector.AcceptedPlugin = ConfigPlugin; |
229 |
m_peviewer.Activate(); |
230 |
} |
231 |
private void SetupRVACalculatorWindowHandler() |
232 |
{ |
233 |
if (m_rvacalc == null) return; |
234 |
m_rvacalc.Shown += new EventHandler(AddDockToWindowList); |
235 |
m_rvacalc.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList); |
236 |
m_rvacalc.AcceptedPlugin = ConfigPlugin; |
237 |
m_rvacalc.Activate(); |
238 |
} |
239 |
private void SetupUserControlDockWindowHandler() |
240 |
{ |
241 |
if (m_ucd == null) return; |
242 |
m_ucd.Shown += new EventHandler(AddDockToWindowList); |
243 |
m_ucd.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList); |
244 |
m_ucd.Activate(); |
245 |
} |
246 |
#endregion |
247 |
public void ShowDocks() |
248 |
{ |
249 |
ShowLogWindow(); |
250 |
SetupLogWindowHandler(); |
251 |
//ShowAboutBox(); |
252 |
ShowRamDump(); |
253 |
SetupRamDumpWindowHandler(); |
254 |
ShowMemoryView(); |
255 |
SetupMemoryViewWindowHandler(); |
256 |
ShowPidSelector(); |
257 |
SetupPIDSelectorWindowHandler(); |
258 |
ShowDataTypeConverter(); |
259 |
SetupDataTypeConverterWindowHandler(); |
260 |
|
261 |
ShowRVACalculator(); |
262 |
SetupRVACalculatorWindowHandler(); |
263 |
|
264 |
ShowUserControlDock(); |
265 |
SetupUserControlDockWindowHandler(); |
266 |
|
267 |
|
268 |
ShowMemorySearch(); |
269 |
SetupMemorySearchWindowHandler(); |
270 |
ShowPEViewer(); |
271 |
SetupPEViewerWindowHandler(); |
272 |
|
273 |
|
274 |
} |
275 |
public void ShowLogWindow() |
276 |
{ |
277 |
if (m_LogWindow == null || m_LogWindow.IsDisposed) { m_LogWindow = new FloatingLogWindow(); } |
278 |
LoggerInstance = m_LogWindow.Logwriter; |
279 |
LoggerInstance.CreateNewLog(false); |
280 |
m_LogWindow.Show(dockPanel, DockState.DockBottom); |
281 |
} |
282 |
public void ShowAboutBox() |
283 |
{ |
284 |
if (m_AboutBox == null || m_AboutBox.IsDisposed) { m_AboutBox = new FloatingAboutBox(); } |
285 |
m_AboutBox.ShowDialog(); |
286 |
} |
287 |
public void ShowRamDump() |
288 |
{ |
289 |
load_plugins_silent(); |
290 |
m_RamDump = new FloatingRamDumperDialog(ConfigPlugin); |
291 |
m_RamDump.AcceptedProcess = SelectedProcess; |
292 |
m_RamDump.Show(dockPanel); |
293 |
} |
294 |
public void ShowMemoryView() |
295 |
{ |
296 |
load_plugins_silent(); |
297 |
m_memoryview = new FloatingMemoryView(ConfigPlugin); |
298 |
m_memoryview.AcceptedProcess = SelectedProcess; |
299 |
m_memoryview.Show(dockPanel); |
300 |
} |
301 |
public void ShowPidSelector() |
302 |
{ |
303 |
load_plugins_silent(); |
304 |
//List<Process> procs = ConfigPlugin.ValidProcessesForPlugin; |
305 |
m_PIDSelector = new FloatingPIDSelector(ConfigPlugin); |
306 |
m_PIDSelector.OnSelectedProcessChanged += new BaseEventHandler<ProcessChangedEventArgs>(OnProcessChanged); |
307 |
m_PIDSelector.Show(dockPanel); |
308 |
} |
309 |
public void ShowDataTypeConverter() |
310 |
{ |
311 |
if (m_typeconverter == null || m_typeconverter.IsDisposed) { m_typeconverter = new FloatingDataTypeConverter(); } |
312 |
m_typeconverter.Show(dockPanel, DockState.DockRightAutoHide); |
313 |
} |
314 |
public void ShowMemorySearch() |
315 |
{ |
316 |
load_plugins_silent(); |
317 |
m_memsearcher = new FloatingMemorySearcher(ConfigPlugin); |
318 |
m_memsearcher.AcceptedProcess = SelectedProcess; |
319 |
m_memsearcher.OnBrowseMemoryRegion += new BaseEventHandler<BrowseMemoryRegionEvent>(OnBrowseMemoryRegion); |
320 |
m_memsearcher.Show(dockPanel); |
321 |
} |
322 |
public void ShowPEViewer() |
323 |
{ |
324 |
load_plugins_silent(); |
325 |
m_peviewer = new FloatingPEViewer(ConfigPlugin); |
326 |
m_peviewer.AcceptedProcess = SelectedProcess; |
327 |
m_peviewer.OnPEDataUpdated += new BaseEventHandler<PEViewerDataUpdatedEventArgs>(OnPEDataUpdated); |
328 |
m_peviewer.Show(dockPanel); |
329 |
} |
330 |
public void ShowRVACalculator() |
331 |
{ |
332 |
load_plugins_silent(); |
333 |
m_rvacalc = new FloatingRVACalculator(ConfigPlugin); |
334 |
m_rvacalc.AcceptedProcess = SelectedProcess; |
335 |
m_rvacalc.Show(dockPanel, DockState.DockRightAutoHide); |
336 |
} |
337 |
public void ShowUserControlDock() |
338 |
{ |
339 |
load_plugins_silent(); |
340 |
m_ucd = new FloatingUserControlDock(UserControlPlugins); |
341 |
m_ucd.Show(dockPanel, DockState.DockRightAutoHide); |
342 |
} |
343 |
#endregion |
344 |
|
345 |
|
346 |
public Main() : this(false) { } |
347 |
public Main(bool no_console_redirect) |
348 |
{ |
349 |
InitializeComponent(); |
350 |
#if SHOW_DEBUG_MENU |
351 |
mnuDebug.Visible = true; |
352 |
#else |
353 |
mnuDebug.Visible = false; |
354 |
#endif |
355 |
load_loggerflags(); |
356 |
SetupDocks(); |
357 |
LoggerInstance = m_LogWindow.Logwriter; |
358 |
LoggerInstance.CreateNewLog(false); |
359 |
logger.ForceLog.Info.WriteLine("LoggingFlags = 0x{0:x4} ({1})", logger.GetLoggingFlags().Value, logger.GetLoggingFlags().Name); |
360 |
load_plugins(); |
361 |
if (no_console_redirect) |
362 |
LoggerInstance.RedirectConsoleOutput = false; |
363 |
|
364 |
|
365 |
|
366 |
} |
367 |
private void load_loggerflags() |
368 |
{ |
369 |
logger.SetLoggingFlags(Logging.Properties.Settings.Default.LoggingFlags); |
370 |
#if FORCE_ALL_LOGGING_FLAGS |
371 |
logger.SetLoggingFlags(loggerflags.ALL); |
372 |
#endif |
373 |
} |
374 |
private void load_plugins() { load_plugins(false); } |
375 |
private void load_plugins_silent() { load_plugins(true); } |
376 |
private void load_plugins(bool silent) |
377 |
{ |
378 |
loader = new PluginLoader(); |
379 |
loader.LoadPlugins(silent); |
380 |
|
381 |
ConfigPlugin = loader.GetConfigPlugin(RomCheater.Properties.Settings.Default.LastConfigPlugin); |
382 |
if (ConfigPlugin != null && !silent) |
383 |
logger.Info.WriteLine("Loaded Config Plugin: {0}", ConfigPlugin.ToString()); |
384 |
InputPlugin = loader.GetInputPlugin(RomCheater.Properties.Settings.Default.LastInputPlugin); |
385 |
if (InputPlugin != null && !silent) |
386 |
logger.Info.WriteLine("Loaded Input Plugin: {0}", InputPlugin.ToString()); |
387 |
WindowPlugin = loader.GetWindowPlugin(RomCheater.Properties.Settings.Default.LastWindowPlugin); |
388 |
if (WindowPlugin != null && !silent) |
389 |
logger.Info.WriteLine("Loaded Window Plugin: {0}", WindowPlugin.ToString()); |
390 |
|
391 |
|
392 |
UserControlPlugins = new List<IUserControlPlugin>(loader.LoadedUserControlPlugins); |
393 |
if (UserControlPlugins != null && !silent && UserControlPlugins.Count > 0) |
394 |
{ |
395 |
foreach (var t in UserControlPlugins) |
396 |
{ |
397 |
logger.Info.WriteLine("Loaded UserControl Plugin: {0}", t.ToString()); |
398 |
} |
399 |
} |
400 |
|
401 |
|
402 |
|
403 |
m_PIDSelector.AcceptedPlugin = ConfigPlugin; |
404 |
m_RamDump.AcceptedPlugin = ConfigPlugin; |
405 |
m_memoryview.AcceptedPlugin = ConfigPlugin; |
406 |
m_memsearcher.AcceptedPlugin = ConfigPlugin; |
407 |
m_PIDSelector.AcceptedPlugin = ConfigPlugin; |
408 |
if (this.SelectedProcess != null) |
409 |
{ |
410 |
m_RamDump.AcceptedProcess = SelectedProcess; |
411 |
m_memoryview.AcceptedProcess = SelectedProcess; |
412 |
m_memsearcher.AcceptedProcess = SelectedProcess; |
413 |
} |
414 |
|
415 |
} |
416 |
|
417 |
private void mnuItemExit_Click(object sender, EventArgs e) |
418 |
{ |
419 |
this.Close(); |
420 |
} |
421 |
|
422 |
|
423 |
private void Main_Load(object sender, EventArgs e) |
424 |
{ |
425 |
|
426 |
} |
427 |
|
428 |
private void mnuItemConfig_Click(object sender, EventArgs e) |
429 |
{ |
430 |
RomCheaterConfigDialog dlg = new RomCheaterConfigDialog(loader); |
431 |
dlg.ShowDialog(); |
432 |
logger.ForceLog.Info.WriteLine("LoggingFlags = 0x{0:x4} ({1})", logger.GetLoggingFlags().Value, logger.GetLoggingFlags().Name); |
433 |
// reload plugins |
434 |
load_plugins(true); |
435 |
} |
436 |
|
437 |
private void mnuItemOpenProcess_Click(object sender, EventArgs e) |
438 |
{ |
439 |
////List<Process> procs = ConfigPlugin.ValidProcessesForPlugin; |
440 |
//PIDSelector selector = new PIDSelector(ConfigPlugin); |
441 |
//selector.ShowDialog(); |
442 |
} |
443 |
|
444 |
private void Main_Shown(object sender, EventArgs e) |
445 |
{ |
446 |
//dockPanel.SuspendLayout(true); |
447 |
//ShowDocks(); |
448 |
string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config"); |
449 |
if (File.Exists(configFile)) |
450 |
{ |
451 |
try |
452 |
{ |
453 |
dockPanel.LoadFromXml(configFile, m_deserializeDockContent); |
454 |
SetupDockWindowHandler(); |
455 |
} |
456 |
catch (Exception) |
457 |
{ |
458 |
this.Controls.Remove(dockPanel); |
459 |
dockPanel = new DockPanel(); |
460 |
dockPanel.Dock = DockStyle.Fill; |
461 |
dockPanel.DocumentStyle = DocumentStyle.DockingWindow; |
462 |
this.Controls.Add(dockPanel); |
463 |
ShowDocks(); |
464 |
} |
465 |
} |
466 |
else |
467 |
{ |
468 |
ShowDocks(); |
469 |
} |
470 |
|
471 |
//dockPanel.ResumeLayout(true, true); |
472 |
} |
473 |
|
474 |
private void mnuItemShowLogWindow_Click(object sender, EventArgs e) |
475 |
{ |
476 |
ShowLogWindow(); |
477 |
} |
478 |
|
479 |
private void mnuItemHelpAbout_Click(object sender, EventArgs e) |
480 |
{ |
481 |
ShowAboutBox(); |
482 |
} |
483 |
|
484 |
private void mnuItemShowRamDumpDialog_Click(object sender, EventArgs e) |
485 |
{ |
486 |
ShowRamDump(); |
487 |
} |
488 |
|
489 |
private void mnuItemShowPIDSelector_Click(object sender, EventArgs e) |
490 |
{ |
491 |
ShowPidSelector(); |
492 |
} |
493 |
private void mnuItemShowMemoryView_Click(object sender, EventArgs e) |
494 |
{ |
495 |
ShowMemoryView(); |
496 |
} |
497 |
private void Main_FormClosing(object sender, FormClosingEventArgs e) |
498 |
{ |
499 |
string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DockPanel.config"); |
500 |
if (m_bSaveLayout) |
501 |
dockPanel.SaveAsXml(configFile); |
502 |
else if (File.Exists(configFile)) |
503 |
File.Delete(configFile); |
504 |
} |
505 |
|
506 |
private void mnuTestExeParse_Click(object sender, EventArgs e) |
507 |
{ |
508 |
IPEDData peData = PEDataWrapper.GetPEData((IAcceptsProcessAndConfig)this); |
509 |
} |
510 |
|
511 |
private void mnuItemFindMaxNonNegativeHexValue_Click(object sender, EventArgs e) |
512 |
{ |
513 |
|
514 |
//uint start = 0xf0000000; |
515 |
uint end = uint.MaxValue; |
516 |
//for (uint i = start; i < end; i++) |
517 |
//{ |
518 |
ulong value = Convert.ToUInt64(end.ToString(), 16); |
519 |
//} |
520 |
} |
521 |
|
522 |
private void mnuItemShowDataTypeConverter_Click(object sender, EventArgs e) |
523 |
{ |
524 |
ShowDataTypeConverter(); |
525 |
} |
526 |
|
527 |
private void mnuItemShowMemorySearch_Click(object sender, EventArgs e) |
528 |
{ |
529 |
ShowMemorySearch(); |
530 |
} |
531 |
|
532 |
private void mnuItemDateShift_Click(object sender, EventArgs e) |
533 |
{ |
534 |
DateTime t = DateTime.Now; |
535 |
int year = Convert.ToInt32(t.ToString("yy")); |
536 |
int y = year << 9; |
537 |
int m = t.Month << 5; |
538 |
int d = t.Day; |
539 |
|
540 |
ushort v1 = (ushort)(y | m | d); |
541 |
|
542 |
t = t.AddDays(1); |
543 |
year = Convert.ToInt32(t.ToString("yy")); |
544 |
y = year << 9; |
545 |
m = t.Month << 5; |
546 |
d = t.Day; |
547 |
ushort v2 = (ushort)(y | m | d); |
548 |
|
549 |
t = t.AddDays(1); |
550 |
year = Convert.ToInt32(t.ToString("yy")); |
551 |
y = year << 9; |
552 |
m = t.Month << 5; |
553 |
d = t.Day; |
554 |
ushort v3 = (ushort)(y | m | d); |
555 |
|
556 |
t = new DateTime(9999,12,31); |
557 |
year = Convert.ToInt32(t.ToString("yy")); |
558 |
y = year << 9; |
559 |
m = t.Month << 5; |
560 |
d = t.Day; |
561 |
ushort v4 = (ushort)(y | m | d); |
562 |
} |
563 |
|
564 |
private void mnuItemShowPEViewer_Click(object sender, EventArgs e) |
565 |
{ |
566 |
ShowPEViewer(); |
567 |
} |
568 |
|
569 |
private void mnuItemShowRVACalculator_Click(object sender, EventArgs e) |
570 |
{ |
571 |
ShowRVACalculator(); |
572 |
} |
573 |
|
574 |
private void mnuItemShowUserControlDock_Click(object sender, EventArgs e) |
575 |
{ |
576 |
ShowUserControlDock(); |
577 |
} |
578 |
} |
579 |
} |