Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Win32Assembly assembly = ((AssemblyReference)treeView1.SelectedNode.Tag).assembly;

            if (assembly != null)
            {
                List<DataGridViewColumn> columns = new List<DataGridViewColumn>();
                DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();
                column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                column.HeaderText = "Name";
                columns.Add(column);
                column = new DataGridViewTextBoxColumn();
                column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                column.HeaderText = "RVA";
                columns.Add(column);
                List<DataGridViewRow> rows = new List<DataGridViewRow>();

                foreach (ExportMethod meth in assembly.LibraryExports)
                {
                    DataGridViewRow row = new DataGridViewRow();
                    DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell();
                    cell.Value = meth.Name;
                    row.Cells.Add(cell);
                    cell = new DataGridViewTextBoxCell();
                    cell.Value = "0x" + ((long)meth.RVA).ToString("x8").ToUpper();
                    row.Cells.Add(cell);
                    rows.Add(row);
                }

                ListDlg dlg = new ListDlg(columns.ToArray(), rows.ToArray(), "Exports of " + Path.GetFileName(assembly.Path), false);
                dlg.Show();
            }
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            Win32Assembly assembly;
            if (treeView1.SelectedNode.Parent == null)
                assembly = this.assembly;
            else
                assembly = ((AssemblyReference)treeView1.SelectedNode.Parent.Tag).assembly;

            if (assembly != null)
            {
                List<DataGridViewColumn> columns = new List<DataGridViewColumn>();
                DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();
                column = new DataGridViewTextBoxColumn();
                column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                column.HeaderText = "Name";
                columns.Add(column);
                column = new DataGridViewTextBoxColumn();
                column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                column.HeaderText = "Ordinal";
                columns.Add(column);
                column = new DataGridViewTextBoxColumn();
                column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                column.HeaderText = "RVA";
                columns.Add(column);
                column = new DataGridViewTextBoxColumn();
                column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                column.HeaderText = "Value";
                columns.Add(column);
                List<DataGridViewRow> rows = new List<DataGridViewRow>();

                foreach (LibraryReference lib in assembly.LibraryImports)
                {
                    if (lib.LibraryName == treeView1.SelectedNode.Text)
                    {
                        foreach (ImportMethod meth in lib.ImportMethods)
                        {

                            DataGridViewRow row = new DataGridViewRow();
                            DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell();
                            cell.Value = meth.Name;
                            row.Cells.Add(cell);
                            cell = new DataGridViewTextBoxCell();
                            cell.Value = "0x" + ((long)meth.Ordinal).ToString("x8").ToUpper();
                            row.Cells.Add(cell);
                            cell = new DataGridViewTextBoxCell();
                            cell.Value = "0x" + ((long)meth.RVA).ToString("x8").ToUpper();
                            row.Cells.Add(cell);
                            cell = new DataGridViewTextBoxCell();
                            cell.Value = "0x" + ((long)meth.OriginalThunkValue).ToString("x8").ToUpper();
                            row.Cells.Add(cell);

                            rows.Add(row);
                        }
                    }
                }

                ListDlg dlg = new ListDlg(columns.ToArray(), rows.ToArray(), "Methods of current dll used by " + Path.GetFileName(assembly.Path), false);
                dlg.Show();
            }
        }