Esempio n. 1
0
        private void mnuDumpModule_Click(object sender, EventArgs e)
        {
            if (lvwModules.SelectedIndices.Count == 0)
            {
                return;
            }

            string filePath = EnsureValidFileName(lvwModules.GetFirstSelectedSubItem(chModuleName.Index).Text);

            if (filePath.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) && filePath.EndsWith(".exe", StringComparison.OrdinalIgnoreCase))
            {
                filePath = PathInsertPostfix(filePath, ".dump");
            }
            else
            {
                filePath += ".dump.dll";
            }
            sfdlgDumped.FileName         = filePath;
            sfdlgDumped.InitialDirectory = Path.GetDirectoryName(_process.GetMainModule().ImagePath);
            if (sfdlgDumped.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            var moduleHandle = (IntPtr)ulong.Parse(lvwModules.GetFirstSelectedSubItem(chModuleHandle.Index).Text.Substring(2), NumberStyles.HexNumber, null);

            DumpModule(moduleHandle, lvwModules.GetFirstSelectedSubItem(chModulePath.Index).Text == "InMemory" ? ImageLayout.File : ImageLayout.Memory, sfdlgDumped.FileName);
        }