如何查看DLL函数?

发布于 2024-10-08 00:35:34 字数 34 浏览 3 评论 0原文

我有一个 DLL 文件。如何查看该 DLL 中的函数?

I have a DLL file. How can I view the functions in that DLL?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(12

梦里兽 2024-10-15 00:35:34

对于本机代码,最好使用 Dependency Walker。也可以使用 dumpbin< /a> Visual Studio 附带的命令行实用程序。

For native code it's probably best to use Dependency Walker. It's also possible to use the dumpbin command line utility that comes with Visual Studio.

落在眉间の轻吻 2024-10-15 00:35:34

使用免费的DLL导出查看器,它非常容易使用。

Use the free DLL Export Viewer, it is very easy to use.

淡淡的优雅 2024-10-15 00:35:34

您可以尝试 Visual Studio 中的对象浏览器

选择“编辑自定义组件集”。。从那里,您可以从各种 .NET、COM 或项目库中进行选择,或者仅通过浏览导入外部 DLL。

You may try the Object Browser in Visual Studio.

Select Edit Custom Component Set. From there, you can choose from a variety of .NET, COM or project libraries or just import external DLLs via Browse.

心房的律动 2024-10-15 00:35:34

使用 dumpbin 命令行< /a>.

  • dumpbin /IMPORTS 应提供导入到该 DLL 中的函数。
  • dumpbin /EXPORTS 应提供其导出的函数。

Use dumpbin command-line.

  • dumpbin /IMPORTS <path-to-file> should provide the function imported into that DLL.
  • dumpbin /EXPORTS <path-to-file> should provide the functions it exports.
请别遗忘我 2024-10-15 00:35:34

对于 .NET DLL,您可以使用 ildasm< /strong>

For .NET DLLs you can use ildasm

月隐月明月朦胧 2024-10-15 00:35:34

使用 JetBrains 的 dotPeek。

https://www.jetbrains.com/decompiler/

dotPeek是一款基于ReSharper的免费工具。它可以可靠地反编译
任何 .NET 程序集转换为 C# 或 IL 代码。

Use dotPeek by JetBrains.

https://www.jetbrains.com/decompiler/

dotPeek is a free tool based on ReSharper. It can reliably decompile
any .NET assembly into C# or IL code.

对你再特殊 2024-10-15 00:35:34

在不告诉我们这个 DLL/程序集来自哪种语言的情况下,我们只能猜测。

那么 .NET Reflector 怎么样。

Without telling us what language this DLL/assembly is from, we can only guess.

So how about .NET Reflector.

黯淡〆 2024-10-15 00:35:34

对于非 .NET dll,在 Linux 系统上安装 binutils 会提供可用于显示 dll 信息的 objdump 命令。

objdump --private-headers <file.dll>

在输出中查找导出地址表部分。

For non .NET dlls, installing binutils on a Linux system presents the objdump command that can be used to display information of a dll.

objdump --private-headers <file.dll>

Look for the Export Address Table section in the output.

暖树树初阳… 2024-10-15 00:35:34

如果 DLL 是用一种 .NET 语言编写的,并且您只想查看哪些函数,则项目中会有对此 DLL 的引用。

然后双击引用文件夹中的 DLL,然后您将在 OBJECT EXPLORER 窗口中看到它有哪些功能。

如果您想查看该 DLL 文件的源代码,可以使用反编译器应用程序,例如 .NET Reflector。

If a DLL is written in one of the .NET languages and if you only want to view what functions, there is a reference to this DLL in the project.

Then doubleclick the DLL in the references folder and then you will see what functions it has in the OBJECT EXPLORER window.

If you would like to view the source code of that DLL file you can use a decompiler application such as .NET reflector.

给不了的爱 2024-10-15 00:35:34

这是一个免费的、cli、便携式软件解决方案!适用于 Linux、Windows、Mac OS

前提是您有 python。

需要安装pefile,无依赖
pip install pefilepacman -S ${MINGW_PACKAGE_PREFIX}-python-pefile 如果您在 msys2 中

import pefile

def list_exports(file_path):
    pe = pefile.PE(file_path)
    # Check if the PE file has an export directory
    if hasattr(pe, 'DIRECTORY_ENTRY_EXPORT'):
        exports = []
        for exp in pe.DIRECTORY_ENTRY_EXPORT.symbols:
            export_dict = {
                'Address': hex(pe.OPTIONAL_HEADER.ImageBase + exp.address),
                'Name': exp.name.decode() if exp.name else '',
                'Ordinal': exp.ordinal
            }
            exports.append(export_dict)
        return exports
    else:
        return None

# Usage
file_path = r"C:\Windows\System32\bcrypt.dll"  # Replace with your file path
exports = list_exports(file_path)
if exports:
    for export in exports:
        print(f"Address: {export['Address']} Name: {export['Name']} Ordinal: {export['Ordinal']}")
else:
    print("No exports found.")

Here is a free,cli,portable software solution! Works on Linux,Windows,Mac OS

Provided that you have python.

you need to install pefile, no dependencies
pip install pefile or pacman -S ${MINGW_PACKAGE_PREFIX}-python-pefile if you are in msys2

import pefile

def list_exports(file_path):
    pe = pefile.PE(file_path)
    # Check if the PE file has an export directory
    if hasattr(pe, 'DIRECTORY_ENTRY_EXPORT'):
        exports = []
        for exp in pe.DIRECTORY_ENTRY_EXPORT.symbols:
            export_dict = {
                'Address': hex(pe.OPTIONAL_HEADER.ImageBase + exp.address),
                'Name': exp.name.decode() if exp.name else '',
                'Ordinal': exp.ordinal
            }
            exports.append(export_dict)
        return exports
    else:
        return None

# Usage
file_path = r"C:\Windows\System32\bcrypt.dll"  # Replace with your file path
exports = list_exports(file_path)
if exports:
    for export in exports:
        print(f"Address: {export['Address']} Name: {export['Name']} Ordinal: {export['Ordinal']}")
else:
    print("No exports found.")
终止放荡 2024-10-15 00:35:34

.NET ildasm

ildasm 提供了帮助,甚至转储了方法体,但要编辑 .DLL,您还需要任何十六进制编辑器。

修复 Help Viewer v2.x 问题的 ildasm 示例:
错误:“更新内容时发生错误:文件‘???.cab’未由 Microsoft 签名”

这里可能是图像
更多示例文件

.NET ildasm

ildasm helped and even dumped methods body, but to edit .DLL you also need any hex editor.

ildasm example to fix Help Viewer v2.x issue:
error: "An error occurred while updating content: File '???.cab' was not signed by Microsoft"

here could be image
more example files

无声静候 2024-10-15 00:35:34

您可以使用 gendef 工具(也是 MinGW-w64 工具链的一部分)。

要在 STDOUT 上显示从 DLL 导出的符号:

gendef - mysharedlib.dll

要从 DLL 生成 .def 文件:

gendef mysharedlib.dll

You can use gendef tool (also part of the MinGW-w64 toolchain).

To display exported symbols from a DLL on STDOUT:

gendef - mysharedlib.dll

To generate a .def file from a DLL:

gendef mysharedlib.dll

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