Reputation: 2151
I have a DLL file. How can I view the functions in that DLL?
Upvotes: 215
Views: 550845
Reputation: 205
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
Upvotes: 1
Reputation: 2465
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.")
Upvotes: 2
Reputation: 15299
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.
Upvotes: 98
Reputation: 5844
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.
Upvotes: 6
Reputation: 676
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.
Upvotes: 56
Reputation: 2423
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.
Upvotes: 2
Reputation: 166506
Without telling us what language this DLL/assembly is from, we can only guess.
So how about .NET Reflector.
Upvotes: 7
Reputation: 1
.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
Upvotes: 0
Reputation: 823
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.Upvotes: 55
Reputation: 867
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.
Upvotes: 14