CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2006
    Posts
    143

    Finding Syntax of a dll function

    Hi,
    I have obtained a dll created in VC++ whose source code i don't have.I want to use this dll in my vc++ application.But i know I need the lib file and header files associated with the dll file in order for me to use it in vc++.But is there some way I can obtain the syntax of the functions exported by the dll ,like the number and type of arguments etc. so that i can call the dll function in vb.I tried using Dependency Walker but it does not seem to provide the kind of information i need.Please help

  2. #2
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Finding Syntax of a dll function

    Well, not really. OK, there is the option of disassemblying it (if that's allowed for your DLL) and try to figure out from the ASM code what the signatures are.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  3. #3
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Finding Syntax of a dll function

    Quote Originally Posted by dreamer60
    Hi,
    I have obtained a dll created in VC++ whose source code i don't have.
    You don't need the source code. Are the functions documented? If not, what good does it do if you don't know what those functions are supposed to do? That type of information cannot be discovered with Dependency Walker.

    Yes, you can try to guess the parameters and what they mean, but that is programming calling functions blindly without any context of what those functions do, what the parameters are supposed to denote, what order to call the functions, etc.

    In other words, get the documentation. It is worth far more than the source code.

    Regards,

    Paul McKenzie

  4. #4
    Join Date
    Jun 2006
    Posts
    143

    Re: Finding Syntax of a dll function

    Thanks... but i found the same problem on some web site and as directed by them i downloaded the latest verion of Dependency Walker .

    http://www.dependencywalker.com

    and they have a screen shot of a dll being opened in the Dependency Walker.And the screen shot shows the syntax of a dll function (check the screen shot). But at the same time they also make it clear that the definiction of most dlls cannot be viewed...Could do with a modification, eh?

    OK , how can we disassemble a dll and obtain the signature of fucntion calls?

  5. #5
    Join Date
    Apr 1999
    Posts
    3,585

    Re: Finding Syntax of a dll function

    I'm using that same version of Dependency Walker and it does not seem to have a problem displaying function signatures. However, it does appear that it will not display 'C' type function signatures.
    Gort...Klaatu, Barada Nikto!

  6. #6
    Join Date
    Jan 2001
    Posts
    253

    Re: Finding Syntax of a dll function

    From the FAQ of the Dependency walker program:

    How do I view the parameter and return types of a function?

    For most functions, this information is simply not present in the module. The Windows’ module file format only provides a single text string to identify each function. There is no structured way to list the number of parameters, the parameter types, or the return type. However, some languages do something called function "decoration" or "mangling", which is the process of encoding information into the text string. For example, a function like int Foo(int, int) encoded with simple decoration might be exported as _Foo@8. The 8 refers to the number of bytes used by the parameters. If C++ decoration is used, the function would be exported as ?Foo@@YGHHH@Z, which can be directly decoded back to the function's original prototype: int Foo(int, int). Dependency Walker supports C++ undecoration by using the "Undecorate C++ Functions Command".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured