Page 1 of 1
Exporting Dynamic Functions using the .def file
Posted: Fri Mar 25, 2005 4:35 pm
by DarkBrute
Some of you know that the .def file is used to export function from dlls to because you don't know the memory adress of a funtion in a dll.
Now, is there a way to export funtions from dlls if you don't know the funtion name? Say you have a dll. You don't have the source, and you have no idea what the name is of the funtion you want to export. Is there a way to export the funtion, view it, without knowing the name of it in the DLL?
Just asking...
Posted: Sat Mar 26, 2005 1:19 am
by kyboren
You can always get the address of a function with the Windows API function call GetProcAddress().
Are you trying to import or export? Your statements seem contradictory:
you have a DLL (but not the source), but you want to export a function you don't know?
Could you please elaborate?
Posted: Sun Mar 27, 2005 12:11 pm
by DarkBrute
I wish to export a funtion that I have no idea what its ID is. It is in the DLL but I have no idea what its name is and such.
Posted: Mon Mar 28, 2005 5:23 pm
by kyboren
Erm, then you just want to look for the function that's exported in a DLL? You can download a free trial of IDA Pro and disassemble the DLL and get the exports section (or you could just open it up in a hex editor and go to the exports section yourself and look around).
Posted: Fri Apr 08, 2005 9:28 pm
by kaptainkommie
http://msdn.microsoft.com/library/defau ... y_name.asp
You can export the functions by Ordinal. Click the above link to learn more.
Posted: Mon Apr 11, 2005 6:11 pm
by kyboren
I think he really means import.
You'll still have to know the name of the function you want to import with a .def file. They will be listed in there, though.
You can also load without a .def file by ordinal (going with kaptainkommie's idea here) with good ol' GetProcAddress(). Just specify the ordinal you want to import in the low-order word of the parameter you'd usually use for the name of the function.