From c22c4595dbe982b5d59ecaa031a26431441eef84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=87=E7=85=8C?= Date: Mon, 18 Jan 2021 22:04:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=8D=E6=AC=A1=E4=BF=AE=E5=A4=8D=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E4=B8=8B=E8=BD=BD=E7=AC=A6=E5=8F=B7=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=8D=A1=E6=AD=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 2 +- ExtremeDumper-x86/ExtremeDumper-x86.csproj | 8 ++++++ ExtremeDumper-x86/Program.cs | 4 +-- ExtremeDumper.Common.props | 4 +-- ExtremeDumper/Forms/ModulesForm.cs | 30 ++++++++++++++++++++++ ExtremeDumper/Program.cs | 2 -- appveyor.yml | 2 +- 7 files changed, 43 insertions(+), 9 deletions(-) diff --git a/.editorconfig b/.editorconfig index 573f622..a1d8d71 100644 --- a/.editorconfig +++ b/.editorconfig @@ -77,7 +77,7 @@ csharp_style_expression_bodied_properties = true:suggestion # Pattern matching preferences csharp_style_pattern_matching_over_as_with_null_check = true:suggestion csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion -csharp_style_prefer_switch_expression = true:suggestion +csharp_style_prefer_switch_expression = false:suggestion # Null-checking preferences csharp_style_conditional_delegate_call = true:suggestion diff --git a/ExtremeDumper-x86/ExtremeDumper-x86.csproj b/ExtremeDumper-x86/ExtremeDumper-x86.csproj index 1bf590d..db5254a 100644 --- a/ExtremeDumper-x86/ExtremeDumper-x86.csproj +++ b/ExtremeDumper-x86/ExtremeDumper-x86.csproj @@ -2,5 +2,13 @@ x86 + + + + + + + + diff --git a/ExtremeDumper-x86/Program.cs b/ExtremeDumper-x86/Program.cs index 374030a..45aa147 100644 --- a/ExtremeDumper-x86/Program.cs +++ b/ExtremeDumper-x86/Program.cs @@ -1,12 +1,10 @@ using System; -using System.IO; -using System.Reflection; namespace ExtremeDumper_x86 { internal static class Program { [STAThread] private static void Main() { - Assembly.LoadFile(Path.GetFullPath("ExtremeDumper.exe")).EntryPoint.Invoke(null, null); + ExtremeDumper.Program.Main(); } } } diff --git a/ExtremeDumper.Common.props b/ExtremeDumper.Common.props index e5173b6..2496cfc 100644 --- a/ExtremeDumper.Common.props +++ b/ExtremeDumper.Common.props @@ -1,8 +1,8 @@ ExtremeDumper - 3.0.0.1 - Copyright © 2018-2020 Wwh + 3.0.0.2 + Copyright © 2018-2021 Wwh .NET Assemblies Dumper ..\ExtremeDumper\Images\ExtremeDumper.ico diff --git a/ExtremeDumper/Forms/ModulesForm.cs b/ExtremeDumper/Forms/ModulesForm.cs index dc3745a..1870485 100644 --- a/ExtremeDumper/Forms/ModulesForm.cs +++ b/ExtremeDumper/Forms/ModulesForm.cs @@ -7,9 +7,11 @@ using System.Reflection; using System.Resources; using System.Text; +using System.Threading.Tasks; using System.Windows.Forms; using ExtremeDumper.Dumping; using Microsoft.Diagnostics.Runtime; +using Microsoft.Diagnostics.Runtime.Utilities; using NativeSharp; using static ExtremeDumper.Forms.NativeMethods; using ImageLayout = dnlib.PE.ImageLayout; @@ -114,6 +116,7 @@ private void RefreshModuleList() { if (_isDotNetProcess) { try { using (var dataTarget = DataTarget.AttachToProcess((int)_process.Id, 1000, AttachFlag.Passive)) { + dataTarget.SymbolLocator = DummySymbolLocator.Instance; foreach (var clrModule in dataTarget.ClrVersions.Select(t => t.CreateRuntime()).SelectMany(t => t.AppDomains).SelectMany(t => t.Modules)) { string name = clrModule.Name; bool inMemory; @@ -179,5 +182,32 @@ protected override void Dispose(bool disposing) { } base.Dispose(disposing); } + + private sealed class DummySymbolLocator : SymbolLocator { + public static DummySymbolLocator Instance { get; } = new DummySymbolLocator(); + + private DummySymbolLocator() { + } + + public override string FindBinary(string fileName, int buildTimeStamp, int imageSize, bool checkProperties = true) { + return string.Empty; + } + + public override Task FindBinaryAsync(string fileName, int buildTimeStamp, int imageSize, bool checkProperties = true) { + return Task.FromResult(string.Empty); + } + + public override string FindPdb(string pdbName, Guid pdbIndexGuid, int pdbIndexAge) { + return string.Empty; + } + + public override Task FindPdbAsync(string pdbName, Guid pdbIndexGuid, int pdbIndexAge) { + return Task.FromResult(string.Empty); + } + + protected override Task CopyStreamToFileAsync(Stream input, string fullSrcPath, string fullDestPath, long size) { + throw new NotImplementedException(); + } + } } } diff --git a/ExtremeDumper/Program.cs b/ExtremeDumper/Program.cs index ff52540..8dc5a72 100644 --- a/ExtremeDumper/Program.cs +++ b/ExtremeDumper/Program.cs @@ -6,8 +6,6 @@ namespace ExtremeDumper { public static class Program { [STAThread] public static void Main() { - Environment.SetEnvironmentVariable("_NT_SYMBOL_PATH", string.Empty); - // 禁止在线搜索PDB文件 GlobalExceptionCatcher.Catch(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); diff --git a/appveyor.yml b/appveyor.yml index 7896542..e1088e1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,7 +8,7 @@ build: project: ExtremeDumper.sln verbosity: normal artifacts: -- path: bin\Release\ +- path: bin\Release name: ExtremeDumper deploy: - provider: GitHub