对 DLL 进行逆向工程
Reverse engineering a DLL
我正在为游戏创建配置文件编辑器。主要问题是处理找出用于存储所有数据的二进制文件的结构。
为此,我反编译了源代码,并查看了处理保存(和读取)to/from 保存文件的代码。但是,我运行撞墙了。我有类似这样的代码:
if (this.entity == Q.FG(45768))
{
//read data in one manner
}
else if (this.entity == Q.FG(96583))
{
//read data in another manner
}
这个出现的地方比较多,可以有不少if then else
个语句。
现在,我知道 this.entity
的值,因为它的值已在代码的前面从保存文件中读取。但是,我不知道 Q.FG(int num)
的值。代码是用C#写的。
Q
是一个内部静态方法 class 而 FG(int num)
是一个内部静态方法 returns 一个 string
类型的对象。为了继续,我需要知道至少几个数字的该方法的输出。
另一个问题是该方法正在使用 dll 资源文件和名称并手动提供这些资源文件和名称给了我无效的结果。我可以检查输出,因为其中一个数字的输出必须匹配 this.entity
.
有没有办法让我从某个地方调用这个方法并查看它的结果returns?
我愿意接受任何这样做的方式,无论是编程和调用方法,还是使用工具并尝试在游戏执行期间捕获值。
有什么办法吗?
public class Program
{
static void Main(string[] args)
{
MethodInfo info2 = Type.GetType("A.PW, Assembly-CSharp").GetMethod("G", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof(int) }, null);
System.Diagnostics.Debug.WriteLine("");
System.Diagnostics.Debug.WriteLine("");
System.Diagnostics.Debug.WriteLine((string) info2.Invoke(null, new object[] {75432}));
System.Diagnostics.Debug.WriteLine((string)info2.Invoke(null, new object[] {45634}));
System.Diagnostics.Debug.WriteLine((string)info2.Invoke(null, new object[] {70345}));
System.Diagnostics.Debug.WriteLine((string)info2.Invoke(null, new object[] {3456}));
System.Diagnostics.Debug.WriteLine((string)info2.Invoke(null, new object[] {4734}));
System.Diagnostics.Debug.WriteLine("");
System.Diagnostics.Debug.WriteLine("");
}
}
如果在解决方案中引用了该程序集,则会执行此操作。无法完全正确地命名。
我正在为游戏创建配置文件编辑器。主要问题是处理找出用于存储所有数据的二进制文件的结构。
为此,我反编译了源代码,并查看了处理保存(和读取)to/from 保存文件的代码。但是,我运行撞墙了。我有类似这样的代码:
if (this.entity == Q.FG(45768))
{
//read data in one manner
}
else if (this.entity == Q.FG(96583))
{
//read data in another manner
}
这个出现的地方比较多,可以有不少if then else
个语句。
现在,我知道 this.entity
的值,因为它的值已在代码的前面从保存文件中读取。但是,我不知道 Q.FG(int num)
的值。代码是用C#写的。
Q
是一个内部静态方法 class 而 FG(int num)
是一个内部静态方法 returns 一个 string
类型的对象。为了继续,我需要知道至少几个数字的该方法的输出。
另一个问题是该方法正在使用 dll 资源文件和名称并手动提供这些资源文件和名称给了我无效的结果。我可以检查输出,因为其中一个数字的输出必须匹配 this.entity
.
有没有办法让我从某个地方调用这个方法并查看它的结果returns?
我愿意接受任何这样做的方式,无论是编程和调用方法,还是使用工具并尝试在游戏执行期间捕获值。
有什么办法吗?
public class Program
{
static void Main(string[] args)
{
MethodInfo info2 = Type.GetType("A.PW, Assembly-CSharp").GetMethod("G", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof(int) }, null);
System.Diagnostics.Debug.WriteLine("");
System.Diagnostics.Debug.WriteLine("");
System.Diagnostics.Debug.WriteLine((string) info2.Invoke(null, new object[] {75432}));
System.Diagnostics.Debug.WriteLine((string)info2.Invoke(null, new object[] {45634}));
System.Diagnostics.Debug.WriteLine((string)info2.Invoke(null, new object[] {70345}));
System.Diagnostics.Debug.WriteLine((string)info2.Invoke(null, new object[] {3456}));
System.Diagnostics.Debug.WriteLine((string)info2.Invoke(null, new object[] {4734}));
System.Diagnostics.Debug.WriteLine("");
System.Diagnostics.Debug.WriteLine("");
}
}
如果在解决方案中引用了该程序集,则会执行此操作。无法完全正确地命名。