Solved

DLL function parameters

Posted on 2003-11-24
6
358 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

920 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

12 Experts available now in Live!

Get 1:1 Help Now