MemoryModule
MemoryModule copied to clipboard
MemoryGetProcAddress fails to import a function by ordinal number if dll has no exported names
I debugged the function and noticed:
if (exports->NumberOfNames == 0 || exports->NumberOfFunctions == 0) {
// DLL doesn't export anything
SetLastError(ERROR_PROC_NOT_FOUND);
return NULL;
}
A dll may have no exported names, but has a set of private exported functions with no expoted names. Thus, NumberOfNames == 0 while NumberOfFunctions > 0 cannot impliy that DLL doesn't export anything.
Maybe the code above should be changed to
if (exports->NumberOfFunctions == 0) {
// DLL doesn't export anything
SetLastError(ERROR_PROC_NOT_FOUND);
return NULL;
}
See https://github.com/fancycode/MemoryModule/pull/96/files