Dll Export table

This is a discussion on Dll Export table within the Windows Programming forums, part of the Platform Specific Boards category; I was wondering if there were any functions to help generate either information similar to the dll's header listing the ...

  1. #1
    HelpingYouHelpUsHelpUsAll
    Join Date
    Dec 2007
    Location
    In your nightmares
    Posts
    223

    Dll Export table

    I was wondering if there were any functions to help generate either information similar to the dll's header listing the exported functions for a .dll or just an export table listing all the functions exported by the specified dll. I am not going to bother making this a GUI app, the console will suffice. It would be great to get the parameters for each of the functions but they are not required, likewise with the ordinates. As I have seen quite a few programs that do this job and more but aren't freeware, I thought It might be better to write a simple program that just does this.
    long time no C; //seige
    You miss 100% of the people you don't C;
    Code:
    if (language != LANG_C && language != LANG_CPP)
        drown(language);

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    There are several tools that will show what DLL's export, but if you have either gcc or Visual Studio tools on your machine, you can use objdump or dumpbin from the respective toolsets to display the export table of a DLL.

    Code:
    c:\>dumpbin "c:\WINNT\system32\USER32.DLL" /exports
    produces (I snipped the copyright and other "meaningless junk"):
    Code:
        ordinal hint RVA      name
    
              1    0 0001E494 ActivateKeyboardLayout
              2    1 00010F63 AdjustWindowRect
              3    2 000289E1 AdjustWindowRectEx
              4    3 0004901B AlignRects
              5    4 0002D680 AllowSetForegroundWindow
              6    5 00043F9C AnimateWindow
              7    6 00043C4F AnyPopup
              8    7 000172D4 AppendMenuA
              9    8 0002787D AppendMenuW
             10    9 0002D406 ArrangeIconicWindows
             11    A 000481CA AttachThreadInput
             12    B 000170E6 BeginDeferWindowPos
             13    C 000481D8 BeginPaint
             14    D 000481E6 BlockInput
             15    E 00010C46 BringWindowToTop
             16    F 00045B64 BroadcastSystemMessage
             17   10 00045B64 BroadcastSystemMessageA
    objdump -x does list the same info, but it's hidden inside a whole heap of other data.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Apr 2007
    Posts
    137
    Quote Originally Posted by matsp View Post
    There are several tools
    You don't have to use "tools".
    20 lines of code with debug apis to list export table...

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Alex31 View Post
    You don't have to use "tools".
    20 lines of code with debug apis to list export table...
    Sure, but that means that you have to write code yourself, and to do that you will need at least a C compiler capable of generating Win32 API calls - which probably means that you have to install either MS Visual Studio (which includes dumpbin) or gcc-mingw (which includes objdump) - so why bother writing your own code for it?

    The "tools" I was referring to are more the ones that graphically show DLL dependencies - I have used at least one of those in the past, but I can't remember it's name.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,059
    I thought It might be better to write a simple program that just does this.
    This link will give you some background info. Be sure to check out the source code to Pietrak's PeDump utility. It is there that you will find the code to write your simple program.

  6. #6
    HelpingYouHelpUsHelpUsAll
    Join Date
    Dec 2007
    Location
    In your nightmares
    Posts
    223
    Thanks, I have objdump (not the others) and works fine. I may create this program in the near future but for the moment this "tool" will suffice. I see what you mean about the whole heap of other data, its great that is so simple to redirect output from the console. I will read the background info and look at the source code provided by BobS0327 out of curiosity.
    20 lines of code with debug apis to list export table
    I don't know any debug apis ,does this involve using a debugger? If it does I don't have one, and could really use it. As there is a lot of trial and error involved without a debugger.
    long time no C; //seige
    You miss 100% of the people you don't C;
    Code:
    if (language != LANG_C && language != LANG_CPP)
        drown(language);

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    debug API's are what the OS provides for applications to implement a debugger. That involves functions to read/write process memory, set breakpoints, wait for breakpoint events, and other functions that "help" build a debugger. It is what visual studio's debugger or GDB uses to implement the low-level debug functionality. It is then a WHOLE heap of code to implement the higher levels.

    Google for "MSDN debug API" or some such.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  8. #8
    HelpingYouHelpUsHelpUsAll
    Join Date
    Dec 2007
    Location
    In your nightmares
    Posts
    223
    Thanks for explaining that, makes sense. I still don't see how they could provide a suitable solution to the problem though. Wouldn't another program be required to call the dll and a function inside it (which the name of is not yet known)? Anyway understanding how to do this requires working with memory that wouldn't normally be needed to find the name of a function.
    Also does this rely on the dll having debug info as this info is not required and many don't have it?
    P.S. If to answer the above requires writing those 20 lines of code, then don't worry.
    long time no C; //seige
    You miss 100% of the people you don't C;
    Code:
    if (language != LANG_C && language != LANG_CPP)
        drown(language);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DLL Export List
    By Yarin in forum C++ Programming
    Replies: 4
    Last Post: 09-14-2007, 03:01 AM
  2. Writing array, to file
    By zootreeves in forum C Programming
    Replies: 9
    Last Post: 09-08-2007, 06:06 PM
  3. dll communicating between each other
    By cloudy in forum C++ Programming
    Replies: 5
    Last Post: 06-17-2005, 03:20 AM
  4. How to export dll function for VB
    By joeyzt in forum C++ Programming
    Replies: 0
    Last Post: 01-31-2005, 12:33 PM
  5. DLL and std::string woes!
    By Magos in forum C++ Programming
    Replies: 7
    Last Post: 09-08-2004, 01:34 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21