Solved

DLL function parameters

Posted on 2003-11-24
6
348 Views
Last Modified: 2010-04-01
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
Comment
Question by:PastorDwayne
  • 3
  • 2
6 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 9811276
>>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
 
LVL 13

Expert Comment

by:SteH
ID: 9811349
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
 
LVL 86

Expert Comment

by:jkr
ID: 9811381
>>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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:PastorDwayne
ID: 9811703
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
 
LVL 86

Accepted Solution

by:
jkr earned 125 total points
ID: 9811735
>>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
 

Author Comment

by:PastorDwayne
ID: 9811817
Thanks for your time.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now