12

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?

Paul Farry
  • 4,730
  • 2
  • 35
  • 61
myWallJSON
  • 9,110
  • 22
  • 78
  • 149

3 Answers3

17

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
hmjd
  • 120,187
  • 20
  • 207
  • 252
  • all I get from it is: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>dumpbin.exe /EXPORTS "C:\Program Files (x86)\ppp \UnityEngine.dll" Microsoft (R) COFF/PE Dumper Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved. Dump of file C:\Program Files (x86)\ppp\UnityEngine.dll File Type: DLL Summary 2000 .reloc 2000 .rsrc 74000 .text C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC> – myWallJSON Jul 25 '12 at 21:06
  • @myWallJSON, then there are no functions exported by that DLL. You could investigate the other options to `dumpbin`. – hmjd Jul 25 '12 at 21:52
  • even "ALL" does not provide any info. the unmanaged DLL is wrapped inside a native one=( – myWallJSON Jul 26 '12 at 10:58
2

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 ?

Viktor Latypov
  • 14,289
  • 3
  • 40
  • 55
1

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.

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720