Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get list of functions inside a DLL (managed and unmanaged)?

So I play around a DLL (UnityEditor.dll) I wanna to get a list of all functions inside of this managed DLL which are unmanaged (dll is probably composed from a native C++ (with statically compiled libaries if such were used) core and managed C++ wrapper all wrapped into one dll.) I want to get a list of all unmanaged functions inside of that Dll to for example create my own managed\unmanaged wrapper?

like image 739
myWallJSON Avatar asked Jul 25 '12 20:07

myWallJSON


People also ask

How do I get a list of functions in a DLL?

You can list function names for a specific DLL, such as user32. dll, by running a variety of command-line tools. For example, you can use dumpbin /exports user32. dll or link /dump /exports user32.

How do I know if a DLL is managed or unmanaged?

To determine whether a DLL (or EXE) is managed or unmanaged, use dumpbin.exe with the /dependents switch. If you see mscoree. dll in the output, then the assembly is a managed assembly.

What functions are in a DLL?

A DLL helps promote developing modular programs. It helps you develop large programs that require multiple language versions or a program that requires modular architecture. An example of a modular program is an accounting program that has many modules that can be dynamically loaded at run time.

What are the functions in user32 DLL?

USER32. DLL implements the Windows USER component that creates and manipulates the standard elements of the Windows user interface, such as the desktop, windows, and menus. It thus enables programs to implement a graphical user interface (GUI) that matches the Windows look and feel.


3 Answers

The dumpbin.exe utility shipped with Visual Studio can be used to display a list of exports. For example:

dumpbin.exe /EXPORTS C:\WINDOWS\System32\Kernel32.dll

Example output:

Microsoft (R) COFF/PE Dumper Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file C:\Windows\System32\kernel32.dll

File Type: DLL

  Section contains the following exports for KERNEL32.dll

    00000000 characteristics
    4E20FBA0 time date stamp Sat Jul 16 03:46:56 2011
        0.00 version
           1 ordinal base
        1390 number of functions
        1390 number of names

    ordinal hint RVA      name

          1    0          AcquireSRWLockExclusive (forwarded to NTDLL.RtlAcquireSRWLockExclusive)
          2    1          AcquireSRWLockShared (forwarded to NTDLL.RtlAcquireSRWLockShared)
          3    2 00004440 ActivateActCtx
          4    3 00066B80 AddAtomA
          5    4 00066B20 AddAtomW
          6    5 0006ADF0 AddConsoleAliasA
          7    6 0006AE60 AddConsoleAliasW
like image 56
hmjd Avatar answered Oct 29 '22 06:10

hmjd


Open the .dll file and look for the EXPORT section of this PE file using the binary PE/COFF specs available from Microsoft.

But that's an overkill, I think. Your question should be a concrete want. What exactly do you want to wrap and what do you have ? Only the binaries and no source/headers ?

like image 31
Viktor Latypov Avatar answered Oct 29 '22 05:10

Viktor Latypov


DLLs don't contain "functions". They contain code and entrypoints. It's not possible to tell from optimized code where transitions between functions occur unless you have a debug database.

like image 24
Ben Voigt Avatar answered Oct 29 '22 04:10

Ben Voigt