dnSpy

https://github.com/0xd4d/dnSpy

下载压缩包之后,解压,发现目录里面有3个exe文件

 

需要用管理员运行dnSpy.exe,然后打开exe文件,设置好断点,然后start

 

使用技巧

edit method

在左侧的导航栏,找到某个类里面的某个方法,右键,会有2个edit method

1. 白色的是重命名方法,会同步修改reference处的引用

2. 绿色的是修改方法体,也就是方法里面的内容

 

analyze

找到某一个方法,右键analyze

 

 show compiler generated code

这个可以用来查看async关键字生成的state machine的代码

 

 

右键菜单的Merge with Assembly

假如你打开了HearthBuddy的exe,现在想要引用另外一个dll文件,那就可以直接merge with assembly。另外一个dll文件里面的类,会被直接导入到HearthBuddy.exe里面

 

Reference another assembly

https://github.com/0xd4d/dnSpy/issues/357

应该用第一个图标,浏览

 

不支持async和await

关于async的反编译

https://github.com/0xd4d/dnSpy/issues/687#issuecomment-354990427

await is just synthetic sugar for what you see in the decompiled code. Usually ILSpy converts this back to what a programmer would normally write, but the version that dnSpy uses didn't have that implemented yet. You can find all implemented language features for the latest version of ILSpy here, but keep in mind that dnSpy still uses ILSpy 2.x, not 3.x.

 

 

 取消反编译async methods

复制代码
// Triton.Bot.Logic.Bots.DefaultBot.DefaultBot
// Token: 0x060013A3 RID: 5027 RVA: 0x000BD93C File Offset: 0x000BBB3C
private Task method_49(TournamentScene tournamentScene_0)
{
    DefaultBot.Struct88 @struct;
    @struct.defaultBot_0 = this;
    @struct.tournamentScene_0 = tournamentScene_0;
    @struct.asyncTaskMethodBuilder_0 = AsyncTaskMethodBuilder.Create();
    @struct.int_0 = -1;
    AsyncTaskMethodBuilder asyncTaskMethodBuilder_ = @struct.asyncTaskMethodBuilder_0;
    asyncTaskMethodBuilder_.Start<DefaultBot.Struct88>(ref @struct);
    return @struct.asyncTaskMethodBuilder_0.Task;
}
复制代码

找到Struct88的定义,然后找到里面的MoveNext方法,右键edit method body

然后找到https://www.cnblogs.com/chucklu/p/11184577.html 263行以及672行,进行替换。

 

Search in framework assemblies

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(6244)  评论(2编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2018-07-13 How to check HTML version of any website
2018-07-13 Bootstrap UI 编辑器
2016-07-13 DataSet.Clear Method ()
2015-07-13 Service Oriented Architecture
2015-07-13 Hello Indigo
2015-07-13 确保客户端可以接收到服务端的异常serviceDebug includeExceptionDetailInFaults="true"
2015-07-13 Visual Studio中一个解决方案设置多个启动项目
点击右上角即可分享
微信分享提示