Removing exported symbols from a DLL and its associated import library (VS8)
See the question and my original answer on StackOverflowI don't know a tool that does this, but here is a piece of C++ code you can build that can change a DLL exported names. In this case, you can set the names you don't want to an empty string (the 0 character):
void RemoveUnwantedExports(PSTR ImageName)
{
LOADED_IMAGE image;
// load dll in memory for r/w access
// you'll need Imagehlp.h and Imagehlp.lib to compile successfully
if (MapAndLoad(ImageName, NULL, &image, TRUE, FALSE))
{
// get the export table
ULONG size;
PIMAGE_EXPORT_DIRECTORY exports = (PIMAGE_EXPORT_DIRECTORY)ImageDirectoryEntryToData(image.MappedAddress, FALSE, IMAGE_DIRECTORY_ENTRY_EXPORT, &size);
PIMAGE_SECTION_HEADER *pHeader = new PIMAGE_SECTION_HEADER();
// get the names address
PULONG names = (PULONG)ImageRvaToVa(image.FileHeader, image.MappedAddress, exports->AddressOfNames, pHeader);
for (ULONG i = 0; i < exports->NumberOfNames; i++)
{
// get a given name
PSTR name = (PSTR)ImageRvaToVa(image.FileHeader, image.MappedAddress, names[i] , pHeader);
// printf("%s\n", name); // debug info
if (IsUnwanted(name))
{
name[0] = 0; // set it to an empty string
}
}
UnMapAndLoad(&image); // commit & write
}
}
BOOL IsUnwanted(PSTR name)
{
// implement this
}
It's more some kind of obfuscation but removing names completely is more complex since it requires a full consistent rewrite of the exports section.