gpt4 book ai didi

windows - 如何在不知道参数的情况下使用dll?

转载 作者:可可西里 更新时间:2023-11-01 11:14:58 24 4
gpt4 key购买 nike

我有一个需要使用的 dll。我还有一个程序可以调用这个 dll 来使用它。我需要能够在另一个程序中使用这个 dll,但是以前的程序员没有留下任何文档或源代码。有什么方法可以监控对此 dll 进行了哪些调用以及传递了什么?

最佳答案

一般来说,你不能。这是来自 Dependency Walker常见问题:

Q: How do I view the parameter and return types of a function?

A: For most functions, this information is simply not present in the module. The Windows' module file format only provides a single text string to identify each function. There is no structured way to list the number of parameters, the parameter types, or the return type. However, some languages do something called function "decoration" or "mangling", which is the process of encoding information into the text string. For example, a function like int Foo(int, int) encoded with simple decoration might be exported as _Foo@8. The 8 refers to the number of bytes used by the parameters. If C++ decoration is used, the function would be exported as ?Foo@@YGHHH@Z, which can be directly decoded back to the function's original prototype: int Foo(int, int). Dependency Walker supports C++ undecoration by using the Undecorate C++ Functions Command.

编辑:我认为,您可以做的一件事是获取反汇编程序并反汇编 DLL 和/或调用代码,然后从中计算出参数的数量和类型,和返回类型。不过,您将无法找出参数的名称。

关于windows - 如何在不知道参数的情况下使用dll?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2263630/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com