You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How can load references dll still using MemoryLoadLibrary #119
I have a library named a.dll, a.dll has a reference b.dll.
When I want to use MemoryLoadLibrary to load a.dll, the default references loader is LoadLibraryA, when I changed the loader to my own loader like the code below, it crashed. How to change the return value of MemoryLoadLibraryEx to a value like the return value of LoadLibraryA?
HCUSTOMMODULE LoadLibrary_R(LPCSTR filename, void* userdata)
{
bool isFound = false;
for(auto it: names)
{
if (strcmp(it, filename) == 0) {
isFound = true;
break;
}
}
if (isFound) {
size_t size;
auto buffer = readFileToBuffer(filename, &size);
auto t = (HMODULE)((PMEMORYMODULE)MemoryLoadLibraryEx(buffer, LoadLibrary_R, _GetProcAddress, _FreeLibrary, NULL))->codeBase;
//still wrong
//auto t = (HMODULE)MemoryLoadLibraryEx(buffer, LoadLibrary_R, _GetProcAddress, _FreeLibrary, NULL));
return t;
}
else {
HMODULE result = LoadLibraryA(filename);
if (result == NULL) {
return NULL;
}
return (HCUSTOMMODULE)result;
}
}
Activity