private Forms::TreeNode CreateModuleNode(Module module) { Forms::TreeNode node = new Forms::TreeNode(module.ClrModule.ModuleName); node.Tag = module; node.Nodes.Add(BEFORE_EXPAND); return(node); }
/// <summary> /// 観察の対象のプロセスをコントロール上に追加します。 /// </summary> /// <param name="mem">観察対象のプロセスのメモリ空間を示す ProcessMemory インスタンスを指定します。</param> public void SetProcess(ProcessMemory mem) { if (!mem.Available) { return; } Forms::TreeNode processNode = new Forms::TreeNode(mem.Process.ProcessName); foreach (Diag::ProcessModule mod in mem.Process.Modules) { Module module = new Module(mem, mod); processNode.Nodes.Add(this.CreateModuleNode(module)); } processNode.Expand(); treeView1.Nodes.Add(processNode); }
private void treeView1_BeforeExpand(object sender, Forms::TreeViewCancelEventArgs e) { Module module = e.Node.Tag as Module; if (module != null) { if (e.Node.Nodes.Count > 0 && e.Node.Nodes[0].Text != BEFORE_EXPAND) { return; } e.Node.Nodes.Clear(); ImageImportDirectory itable = (ImageImportDirectory)module.Directories[mwg.Win32.IMAGE.DIRECTORY_ENTRY.IMPORT]; Forms::TreeNode node = new Forms::TreeNode("ImportTable"); node.Tag = itable; node.Nodes.Add(BEFORE_EXPAND); e.Node.Nodes.Add(node); return; } ImageImportDirectory import = e.Node.Tag as ImageImportDirectory; if (import != null) { if (e.Node.Nodes.Count > 0 && e.Node.Nodes[0].Text != BEFORE_EXPAND) { return; } e.Node.Nodes.Clear(); foreach (ImageImportDirectory.ImportModule imod in import) { Forms::TreeNode child = new Forms::TreeNode(imod.Name); child.Tag = imod; e.Node.Nodes.Add(child); } return; } }