打印 DLL 中函数的代码
我想打印 DLL 中函数的代码。
我加载了 dll,我有了所需函数的名称,接下来做什么?
谢谢你!
I want to print the code of a function in a DLL.
I loaded the dll, I have the name of the desired function, what's next?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
实际上,下一步就是获取代码。 DLL 中的内容是对象代码——二进制代码的形式可供处理器执行,但不准备打印。
您可以反汇编DLL中的内容。如果您习惯使用汇编语言,这可能很有用,但它绝对不是原始源代码(也可能不是任何非常接近它的代码)。如果您想反汇编它,将其加载到您的程序中(通常)并不是一个很好的起点。尝试打开 VS 命令行并使用
dumpbin /disasm yourfile.dll
。为大量输出做好准备,除非相关 DLL真的很小。Realistically, next is getting the code. What you have in the DLL is object code -- binary code in the form ready for the processor to execute, not ready to be printed.
You can disassemble what's in the DLL. If you're comfortable working with assembly language, that may be useful, but it's definitely not the original source code (nor probably anything very close to it either). If you want to disassemble it, loading it in your program isn't (usually) a very good starting point. Try opening a VS command line and using
dumpbin /disasm yourfile.dll
. Be prepared for a lot of output unless the DLL in question is really tiny.检索有关 DLL 内所述函数的实际实现功能的提示的唯一选择是对程序集的二进制表示形式进行逆向工程。这意味着您几乎必须使用反汇编器(IDA Pro 或调试器,例如 OllyDbg)将操作码转换为实际的汇编助记符,然后按照您的方式进行操作并尝试了解其功能的详细信息。
请注意,由于它是从 C/C++ 编译的,因此由于优化和过程的性质,过程中会丢失大量数据;生成的程序集可能(并且可能会)看起来神秘且毫无意义,但它仍然以与程序员用高级语言对其进行编程的方式完全相同。这并不容易。这需要时间。你需要运气和勇气。但这是可行的。 :)
Your only option to retrieve hints about the actual implemented functionality of said function inside the DLL is to reverse engineer whatever the binary representation of assembly happens to be. What this means is that you pretty much have to use a disassembler(IDA Pro, or debugger, e.g. OllyDbg) to translate the opcodes to actual assembly mnemonics and then just work your way through it and try to understand the details of how it functions.
Note, that since it is compiled from C/C++ there is lots and lots of data lost in the process due to optimization and the nature of the process; the resulting assembly can(and probably will) seem cryptic and senseless, but it still does it's job the exact same way as the programmer programmed it in higher level language. It won't be easy. It will take time. You will need luck and nerves. But it IS doable. :)
没有什么。 DLL是编译后的二进制代码;您无法仅通过下载并知道函数名称来获取源代码。
如果这是一个 .NET 程序集,您也许能够使用反射获取源代码。不过,你提到了C++,所以这是值得怀疑的。
Nothing. A DLL is compiled binary code; you can't get the source just by downloading it and knowing the name of the function.
If this was a .NET assembly, you might be able to get the source using reflection. However, you mentioned C++, so this is doubtful.
看看这个http://www.cprogramming.com/challenges/solutions/self_print.html< /a> 和这个 打印自己的程序代码?和这个http://en.wikipedia.org/wiki/Quine_ %28computing%29
我不确定它是否会做你想要的,但我想它可能对你有帮助。
Check out this http://www.cprogramming.com/challenges/solutions/self_print.html and this Program that prints its own code? and this http://en.wikipedia.org/wiki/Quine_%28computing%29
I am not sure if it will do what you want, but i guess it may help you.