Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

Use a DLL without a header file

Is there anyway I can find the parameters and or return value of a function in a dll without the header file.  I want to use a dll and don't have access to the header file of library file.

0
dirtywerm
Asked:
dirtywerm
  • 2
1 Solution
 
pjknibbsCommented:
Well, yes and no. You can find out the names of the functions the DLL exports by using DUMPBIN (Visual C++) or a similar tool--unfortunately there's no information stored in the DLL about what parameters its functions take or what their return values are (unless the DLL in question is actually a COM component, in which case you access it in a completely different way in any case).
0
 
PlanetCppCommented:
of course, you use loadlibrary. you need to know the name of the function , but you should know that anyway...
you use loadlibrary and save the HMODULE. the use GetProcAddress pass it the hmodule and the name of the function exactlly (maybe also try an alias if this returns NULL, check all returns before you use any pointers) you can create a pointer to the function like so
let's say the function returns long and take two integer parameters:
typedef long (WINAPI *_MyDllFunction)(int,int);
_MyDllFunction MyDllFunction;
set MyDllFunction = (_MyDllFunction)GetProcAddress(hmodulehere,"MyDllFunction");
assuming the address was returned correctlly you call it as normal:
somelong = MyDllFunction(5,5);
thats all.
0
 
PlanetCppCommented:
i read your question wrong, but it can apply after you get the answer ;o\
0
 
dirtywermAuthor Commented:
Yeah, i figured there wasn't any way to do it. Its not a com component.

Thanks
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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