Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DLL without exported functions?

Tags:

c++

dll

dllexport

I've snooped around a little bit in MS-Office DLLs, and I noticed that some of the DLLs don't have any exported functions. What I don't quite understand, how an application can use these DLLs without any functions exported ?!

I mean, the dllmain() does get executed on LoadLibrary(), but whats the point? Why would anyone create a DLL without exported functions?

thanks! :-)

like image 745
TCS Avatar asked Jul 05 '11 20:07

TCS


People also ask

What are exported functions in a DLL?

The exports table contains the name of every function that the DLL exports to other executables. These functions are the entry points into the DLL; only the functions in the exports table can be accessed by other executables. Any other functions in the DLL are private to the DLL.

How do I see exported functions in a DLL?

The winedump tool for interacting with DLL PE files. We can use the winedump command to display information about a PE file. A PE file stores its exported symbols in its export address table. The PE file then stores its export address table in the “export” section of the PE file.

What does __ Declspec Dllexport do?

__declspec(dllexport) adds the export directive to the object file so you do not need to use a . def file. This convenience is most apparent when trying to export decorated C++ function names.

What functions are in a DLL?

A DLL helps promote developing modular programs. It helps you develop large programs that require multiple language versions or a program that requires modular architecture. An example of a modular program is an accounting program that has many modules that can be dynamically loaded at run time.


2 Answers

One way of dealing with versions of a program destined for different languages is to put all of the resources into a language DLL. The DLL doesn't contain any code, just resources that have been translated to a target language. When the main program starts up, all it needs to do is load the proper language DLL.

like image 102
Mark Ransom Avatar answered Oct 17 '22 16:10

Mark Ransom


I haven't looked at the DLLs in question; but it's possible in something like MSOffice Microsoft have done this to obfuscate the DLL to make it more difficult to debug / reverse engineer.

However, as you ask how would you use such a DLL? Well if the application knows the layout of the DLL then it can create a function pointer with the address of a known function and call it.

If you really want to dig further you could objdump the DLL and look for standard C / C++ ABI function prologues & epilogues and possibly work out where the functions start.

like image 3
DaveR Avatar answered Oct 17 '22 16:10

DaveR