private async void ProcessInfoForm_Load(object sender, EventArgs e) { if (!process.IsValid) { return; } var sections = new DataTable(); sections.Columns.Add("address", typeof(string)); sections.Columns.Add("size", typeof(string)); sections.Columns.Add("name", typeof(string)); sections.Columns.Add("protection", typeof(string)); sections.Columns.Add("type", typeof(string)); sections.Columns.Add("module", typeof(string)); sections.Columns.Add("section", typeof(Section)); var modules = new DataTable(); modules.Columns.Add("icon", typeof(Icon)); modules.Columns.Add("name", typeof(string)); modules.Columns.Add("address", typeof(string)); modules.Columns.Add("size", typeof(string)); modules.Columns.Add("path", typeof(string)); modules.Columns.Add("module", typeof(Module)); await Task.Run(() => { process.EnumerateRemoteSectionsAndModules( delegate(Section section) { var row = sections.NewRow(); row["address"] = section.Start.ToString(Constants.AddressHexFormat); row["size"] = section.Size.ToString(Constants.AddressHexFormat); row["name"] = section.Name; row["protection"] = section.Protection.ToString(); row["type"] = section.Type.ToString(); row["module"] = section.ModuleName; row["section"] = section; sections.Rows.Add(row); }, delegate(Module module) { var row = modules.NewRow(); row["icon"] = NativeMethods.GetIconForFile(module.Path); row["name"] = module.Name; row["address"] = module.Start.ToString(Constants.AddressHexFormat); row["size"] = module.Size.ToString(Constants.AddressHexFormat); row["path"] = module.Path; row["module"] = module; modules.Rows.Add(row); } ); }); sectionsDataGridView.DataSource = sections; modulesDataGridView.DataSource = modules; }
public ProcessInfoForm(RemoteProcess process, ClassNodeView classesView) { Contract.Requires(process != null); Contract.Requires(classesView != null); this.process = process; this.classesView = classesView; InitializeComponent(); tabControl.ImageList = new ImageList(); tabControl.ImageList.Images.Add(Properties.Resources.B16x16_Category); tabControl.ImageList.Images.Add(Properties.Resources.B16x16_Page_White_Stack); modulesTabPage.ImageIndex = 0; sectionsTabPage.ImageIndex = 1; modulesDataGridView.AutoGenerateColumns = false; sectionsDataGridView.AutoGenerateColumns = false; // TODO: Workaround, Mono can't display a DataGridViewImageColumn. if (NativeMethods.IsUnix()) { moduleIconDataGridViewImageColumn.Visible = false; } if (process.IsValid) { var sections = new DataTable(); sections.Columns.Add("address", typeof(string)); sections.Columns.Add("size", typeof(string)); sections.Columns.Add("name", typeof(string)); sections.Columns.Add("protection", typeof(string)); sections.Columns.Add("type", typeof(string)); sections.Columns.Add("module", typeof(string)); sections.Columns.Add("section", typeof(Section)); var modules = new DataTable(); modules.Columns.Add("icon", typeof(Icon)); modules.Columns.Add("name", typeof(string)); modules.Columns.Add("address", typeof(string)); modules.Columns.Add("size", typeof(string)); modules.Columns.Add("path", typeof(string)); modules.Columns.Add("module", typeof(Module)); process.EnumerateRemoteSectionsAndModules( delegate(Section section) { var row = sections.NewRow(); row["address"] = section.Start.ToString(Constants.StringHexFormat); row["size"] = section.Size.ToString(Constants.StringHexFormat); row["name"] = section.Name; row["protection"] = section.Protection.ToString(); row["type"] = section.Type.ToString(); row["module"] = section.ModuleName; row["section"] = section; sections.Rows.Add(row); }, delegate(Module module) { var row = modules.NewRow(); row["icon"] = NativeMethods.GetIconForFile(module.Path); row["name"] = module.Name; row["address"] = module.Start.ToString(Constants.StringHexFormat); row["size"] = module.Size.ToString(Constants.StringHexFormat); row["path"] = module.Path; row["module"] = module; modules.Rows.Add(row); } ); sectionsDataGridView.DataSource = sections; modulesDataGridView.DataSource = modules; } }