打印 DLL 中函数的代码

发布于 2024-11-01 15:54:39 字数 72 浏览 0 评论 0原文

我想打印 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

薄暮涼年 2024-11-08 15:54:40

实际上,下一步就是获取代码。 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.

慢慢从新开始 2024-11-08 15:54:40

检索有关 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. :)

对不⑦ 2024-11-08 15:54:40

没有什么。 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文