如何将 DLL 反转为 C++ 代码?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15148950/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to reverse a DLL into C++ code?
提问by Imri Persiado
I know it's impossible to reverse a dll into a c++ code so I would like to collect as much as possible details from it. It's not my dll, so I don't have the source code of course. Which program should I use?
我知道将 dll 反转为 C++ 代码是不可能的,所以我想从中收集尽可能多的细节。这不是我的 dll,所以我当然没有源代码。我应该使用哪个程序?
回答by nneonneo
Well, if you are skilled you can disassemble the DLL and understand all of its functions. This takes a substantial amount of time, but if you do that you can reverse it back to source by hand.
好吧,如果您熟练,您可以反汇编 DLL 并了解其所有功能。这需要大量时间,但如果您这样做,您可以手动将其反向回溯到源代码。
Otherwise, you can start by using a tool like Dependency Walker to get the DLLs and functions it depends on, and the functions it exports. From there you can find functions that interest you, and use a disassembler like IDA to see what they do.
否则,您可以首先使用 Dependency Walker 之类的工具来获取它所依赖的 DLL 和函数,以及它导出的函数。从那里你可以找到你感兴趣的函数,并使用像 IDA 这样的反汇编器来查看它们的作用。
回答by selbie
You can see the list of exported functions by using the dumpbintool. If C++ functions are exported, you might be able to infer parameters by the name mangling.
您可以使用dumpbin工具查看导出的函数列表。如果导出 C++ 函数,您可能能够通过名称修改来推断参数。
You can extract all the resources from the DLL by just "opening" it as a file for resource viewing in Visual Studio. If the DLL is a COM based DLL, there's a small chance the Type Library is embedded as a resource inside it. And if you have the Type Library, you can #import it to reconstruct the header files for the public interfaces.
只需将 DLL 作为文件“打开”,即可在 Visual Studio 中进行资源查看,从而从 DLL 中提取所有资源。如果 DLL 是基于 COM 的 DLL,则类型库作为资源嵌入其中的可能性很小。如果你有类型库,你可以 #import 它来重建公共接口的头文件。
That's about as good as it gets.
这几乎是最好的。
回答by James
You need a PE file viewer. This will tell you the exports from the DLL and you can get the data in the .text section to see the machine code.
您需要一个 PE 文件查看器。这将告诉您 DLL 的导出,您可以获取 .text 部分中的数据以查看机器代码。