[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 397
  • Last Modified:

DLL function parameters

Good-day,

I am attempting to load and run a function from a DLL using LoadLibrary and GetProcAddress.  I am able to find out the name of the functions within the DLL using Dependency Walker; but I am unable to find out the number of parameters and the type of parameters that each functions takes (ie float, UINT…).  How would I find out this info?

Thanks.
0
PastorDwayne
Asked:
PastorDwayne
  • 3
  • 2
1 Solution
 
jkrCommented:
>>but I am unable to find out the number of parameters and the type of parameters
>>that each functions takes (ie float, UINT…).  How would I find out this info?

Without a header file or any kind of documentation, there is hardly any chance to find out what arguments the functions take. Bad luck :-(

0
 
SteHCommented:
Depends on whether the DLL as C++ mangled names. But if the function name has C++ mangling dependency walker will show you the function parameters automatically unless you see only the mangled name. Try hitting the C++ button. Otherwise accept jkr comment, no other chance.
0
 
jkrCommented:
>>But if the function name has C++ mangling dependency walker will show you the function parameters

Only for simple data types. Sth. like

struct TheHellOfALotData {

// content goes here

};

int foo ( TheHellOfALotData*);

it'll come up with 'a pointer' at best...
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
PastorDwayneAuthor Commented:
Alright; Assuming one of the parameters is an array, how could this be passed to GetProcAddress? For an UINT I use

typedef UINT (CALLBACK* LPFNDLLFUNC1)(UINT);

What would the typedef be for an array on integers? Would a pointer have to be passed instead?
0
 
jkrCommented:
>>What would the typedef be for an array on integers?

typedef UINT (CALLBACK* LPFNDLLFUNC1)(UINT*);

>>Would a pointer have to be passed instead?

Yes, indeed. But, unless you are sure about what parameters the function takes, this is more than risky...
0
 
PastorDwayneAuthor Commented:
Thanks for your time.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now