Skip to content

Commit de54c06

Browse files
committed
Removed method overload.
1 parent 164a582 commit de54c06

2 files changed

Lines changed: 32 additions & 38 deletions

File tree

ReClass.NET/Forms/ProcessInfoForm.cs

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -66,54 +66,55 @@ private async void ProcessInfoForm_Load(object sender, EventArgs e)
6666
return;
6767
}
6868

69-
var sections = new DataTable();
70-
sections.Columns.Add("address", typeof(string));
71-
sections.Columns.Add("size", typeof(string));
72-
sections.Columns.Add("name", typeof(string));
73-
sections.Columns.Add("protection", typeof(string));
74-
sections.Columns.Add("type", typeof(string));
75-
sections.Columns.Add("module", typeof(string));
76-
sections.Columns.Add("section", typeof(Section));
77-
78-
var modules = new DataTable();
79-
modules.Columns.Add("icon", typeof(Icon));
80-
modules.Columns.Add("name", typeof(string));
81-
modules.Columns.Add("address", typeof(string));
82-
modules.Columns.Add("size", typeof(string));
83-
modules.Columns.Add("path", typeof(string));
84-
modules.Columns.Add("module", typeof(Module));
69+
var sectionsTable = new DataTable();
70+
sectionsTable.Columns.Add("address", typeof(string));
71+
sectionsTable.Columns.Add("size", typeof(string));
72+
sectionsTable.Columns.Add("name", typeof(string));
73+
sectionsTable.Columns.Add("protection", typeof(string));
74+
sectionsTable.Columns.Add("type", typeof(string));
75+
sectionsTable.Columns.Add("module", typeof(string));
76+
sectionsTable.Columns.Add("section", typeof(Section));
77+
78+
var modulesTable = new DataTable();
79+
modulesTable.Columns.Add("icon", typeof(Icon));
80+
modulesTable.Columns.Add("name", typeof(string));
81+
modulesTable.Columns.Add("address", typeof(string));
82+
modulesTable.Columns.Add("size", typeof(string));
83+
modulesTable.Columns.Add("path", typeof(string));
84+
modulesTable.Columns.Add("module", typeof(Module));
8585

8686
await Task.Run(() =>
8787
{
88-
process.EnumerateRemoteSectionsAndModules(
89-
delegate (Section section)
88+
if (process.EnumerateRemoteSectionsAndModules(out var sections, out var modules))
89+
{
90+
foreach (var section in sections)
9091
{
91-
var row = sections.NewRow();
92+
var row = sectionsTable.NewRow();
9293
row["address"] = section.Start.ToString(Constants.AddressHexFormat);
9394
row["size"] = section.Size.ToString(Constants.AddressHexFormat);
9495
row["name"] = section.Name;
9596
row["protection"] = section.Protection.ToString();
9697
row["type"] = section.Type.ToString();
9798
row["module"] = section.ModuleName;
9899
row["section"] = section;
99-
sections.Rows.Add(row);
100-
},
101-
delegate (Module module)
100+
sectionsTable.Rows.Add(row);
101+
}
102+
foreach (var module in modules)
102103
{
103-
var row = modules.NewRow();
104+
var row = modulesTable.NewRow();
104105
row["icon"] = NativeMethods.GetIconForFile(module.Path);
105106
row["name"] = module.Name;
106107
row["address"] = module.Start.ToString(Constants.AddressHexFormat);
107108
row["size"] = module.Size.ToString(Constants.AddressHexFormat);
108109
row["path"] = module.Path;
109110
row["module"] = module;
110-
modules.Rows.Add(row);
111+
modulesTable.Rows.Add(row);
111112
}
112-
);
113+
}
113114
});
114115

115-
sectionsDataGridView.DataSource = sections;
116-
modulesDataGridView.DataSource = modules;
116+
sectionsDataGridView.DataSource = sectionsTable;
117+
modulesDataGridView.DataSource = modulesTable;
117118
}
118119

119120
private void SelectRow_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)

ReClass.NET/Memory/RemoteProcess.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -566,16 +566,6 @@ public string GetNamedAddress(IntPtr address)
566566
return null;
567567
}
568568

569-
public void EnumerateRemoteSectionsAndModules(Action<Section> callbackSection, Action<Module> callbackModule)
570-
{
571-
if (!IsValid)
572-
{
573-
return;
574-
}
575-
576-
coreFunctions.EnumerateRemoteSectionsAndModules(handle, callbackSection, callbackModule);
577-
}
578-
579569
public bool EnumerateRemoteSectionsAndModules(out List<Section> sections, out List<Module> modules)
580570
{
581571
if (!IsValid)
@@ -586,7 +576,10 @@ public bool EnumerateRemoteSectionsAndModules(out List<Section> sections, out Li
586576
return false;
587577
}
588578

589-
coreFunctions.EnumerateRemoteSectionsAndModules(handle, out sections, out modules);
579+
sections = new List<Section>();
580+
modules = new List<Module>();
581+
582+
coreFunctions.EnumerateRemoteSectionsAndModules(handle, sections.Add, modules.Add);
590583

591584
return true;
592585
}

0 commit comments

Comments
 (0)