Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to retrieve dll function parameter variables?

how to retrieve dll function parameter variables?

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelptutorial
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    ThinkingPrometheus
    wrote on last edited by
    #1

    hiho@ll what i have: a dll what i want: a list of every function available in the dll and the parameters each function needs (the return value would be cool too) seems like i need something like "function prototypes" from a dll the problem: to retrieve the function names i think i will use pexport program cause source is available (i have to read the source, didn't yet) but it only can read function names, but i need the parameters too question: 1. how can i read parameters of a dll function if i only have the dll? 2. is there something like a dll file format, or a documentation how a dll works (dll header, dll symbols etc. at which offset in the dll files can i find what ...) 3. is there a simple windows function to retrieve this stuff? thx@ll

    D S V 3 Replies Last reply
    0
    • T ThinkingPrometheus

      hiho@ll what i have: a dll what i want: a list of every function available in the dll and the parameters each function needs (the return value would be cool too) seems like i need something like "function prototypes" from a dll the problem: to retrieve the function names i think i will use pexport program cause source is available (i have to read the source, didn't yet) but it only can read function names, but i need the parameters too question: 1. how can i read parameters of a dll function if i only have the dll? 2. is there something like a dll file format, or a documentation how a dll works (dll header, dll symbols etc. at which offset in the dll files can i find what ...) 3. is there a simple windows function to retrieve this stuff? thx@ll

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      ThinkingPrometheus wrote:

      a list of every function available in the dll...

      This can easily be obtained by examining the PE file format, specifically the .edata section.


      "The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb

      1 Reply Last reply
      0
      • T ThinkingPrometheus

        hiho@ll what i have: a dll what i want: a list of every function available in the dll and the parameters each function needs (the return value would be cool too) seems like i need something like "function prototypes" from a dll the problem: to retrieve the function names i think i will use pexport program cause source is available (i have to read the source, didn't yet) but it only can read function names, but i need the parameters too question: 1. how can i read parameters of a dll function if i only have the dll? 2. is there something like a dll file format, or a documentation how a dll works (dll header, dll symbols etc. at which offset in the dll files can i find what ...) 3. is there a simple windows function to retrieve this stuff? thx@ll

        S Offline
        S Offline
        Stephen Hewitt
        wrote on last edited by
        #3

        You can't necessarily get the function parameters - in general you can't. If the exported names are mangled (they will contain "funny" characters) then you can, see the UnDecorateSymbolName API. If the functions are extern "C"d this information is lost. You can get this kind of information from the symbol file (.pdb) if you have one for your .EXE (or DLL). Steve

        T 1 Reply Last reply
        0
        • T ThinkingPrometheus

          hiho@ll what i have: a dll what i want: a list of every function available in the dll and the parameters each function needs (the return value would be cool too) seems like i need something like "function prototypes" from a dll the problem: to retrieve the function names i think i will use pexport program cause source is available (i have to read the source, didn't yet) but it only can read function names, but i need the parameters too question: 1. how can i read parameters of a dll function if i only have the dll? 2. is there something like a dll file format, or a documentation how a dll works (dll header, dll symbols etc. at which offset in the dll files can i find what ...) 3. is there a simple windows function to retrieve this stuff? thx@ll

          V Offline
          V Offline
          vallikumar
          wrote on last edited by
          #4

          Hi, I hope if you have release version of DLL(Only DLL file no others like lib,def etc), then you cannot see the funtions and paremeters of DLL. If your DLL is Debug version, then you have a chance to reengineering the DLL and get source code. Using this we can see what's inside the DLL. Best of luck regards Vallikumar A

          T 1 Reply Last reply
          0
          • S Stephen Hewitt

            You can't necessarily get the function parameters - in general you can't. If the exported names are mangled (they will contain "funny" characters) then you can, see the UnDecorateSymbolName API. If the functions are extern "C"d this information is lost. You can get this kind of information from the symbol file (.pdb) if you have one for your .EXE (or DLL). Steve

            T Offline
            T Offline
            ThinkingPrometheus
            wrote on last edited by
            #5

            the .pdb file does mean that i have a debug version of this file too? cause (i'm not sure if i'm right) i only know the .pdb from my projects (well it could be a realse version of the dll too, but it means i should have access to the source code otherwise it would be a bit difficult to get the pdb file, not?) thx

            S 1 Reply Last reply
            0
            • V vallikumar

              Hi, I hope if you have release version of DLL(Only DLL file no others like lib,def etc), then you cannot see the funtions and paremeters of DLL. If your DLL is Debug version, then you have a chance to reengineering the DLL and get source code. Using this we can see what's inside the DLL. Best of luck regards Vallikumar A

              T Offline
              T Offline
              ThinkingPrometheus
              wrote on last edited by
              #6

              hmm what about disassembly? i just found pe explorer and it can disassemble every dll i tried (just to make it clear i don't really want to reengineer the code of the dll and hack something or such stuff, i don't even know how this works, but:) wouldn't it be possible if i disassemble a file, know the function names and the function entry points in the dll i could have a "clue" of the parameters if i have a look at "push" assembler commands before such a function is called? i mean if a pointer is pushed it could mean something like void* or a eax value is pushed it could mean int i know i can't be 100% sure, but with the above method (i don't even know how i could do this, but just for fun ;-) ) i can have a clue of the amount of parameters and a bit of the type it could be and i think it could be enough to not be wrong with this clue i mean, if i use void* altough the dll function expects a char*, it would be somthing like try and error but i can be sure its a pointer or an int ? or maybe i'm completely wrong? thx

              1 Reply Last reply
              0
              • T ThinkingPrometheus

                the .pdb file does mean that i have a debug version of this file too? cause (i'm not sure if i'm right) i only know the .pdb from my projects (well it could be a realse version of the dll too, but it means i should have access to the source code otherwise it would be a bit difficult to get the pdb file, not?) thx

                S Offline
                S Offline
                Stephen Hewitt
                wrote on last edited by
                #7

                A .pdb file can be generated for a release or a debug build. The people who built the DLL would have had to setup their compiler to create one however (and you'd have to have a copy). As one of the other posters mentioned, if you know your x86 machine code you could disassemble the .DLL and figure out the parameters. Steve

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups