This function will print out a list of exports from a DLL. Note that this function for enumerating DLL exports requires imagehlp.lib and dbghelp.lib (and the corresponding dynamic libs).
void ListDLLFunctions(PCSTR pszDllName)
{
_IMAGE_EXPORT_DIRECTORY *ImageExportDirectory;
unsigned
long cDirSize;
LOADED_IMAGE *pImage = ImageLoad(pszDllName, NULL);
ImageExportDirectory = (_IMAGE_EXPORT_DIRECTORY *)ImageDirectoryEntryToData(pImage->MappedAddress, FALSE, IMAGE_DIRECTORY_ENTRY_EXPORT, &cDirSize);
if (ImageExportDirectory != NULL)
{
DWORD* dwNameRVAs = (DWORD*)ImageRvaToVa(pImage->FileHeader, pImage->MappedAddress, ImageExportDirectory->AddressOfNames, NULL);
for( DWORD i = 0; i < ImageExportDirectory->NumberOfNames; i++)
{
PCSTR pszName = (PCSTR)ImageRvaToVa(pImage->FileHeader, pImage->MappedAddress, dwNameRVAs[i], NULL);
printf(“%s\n”, pszName);
}
}
}