Added getting code base address API function to manage handles on other side

This commit is contained in:
Dmitry Nagibin
2021-01-11 20:27:05 +03:00
parent 59307f0a63
commit a8da72d503
2 changed files with 13 additions and 2 deletions
+7 -2
View File
@@ -603,7 +603,6 @@ HMEMORYMODULE MemoryLoadLibraryEx(const void *data, size_t size,
PIMAGE_NT_HEADERS old_header;
unsigned char *code, *headers;
ptrdiff_t locationDelta;
SYSTEM_INFO sysInfo;
PIMAGE_SECTION_HEADER section;
DWORD i;
size_t optionalSectionSize;
@@ -732,7 +731,7 @@ HMEMORYMODULE MemoryLoadLibraryEx(const void *data, size_t size,
result->getProcAddress = getProcAddress;
result->freeLibrary = freeLibrary;
result->userdata = userdata;
result->pageSize = sysInfo.dwPageSize;
result->pageSize = old_header->OptionalHeader.SectionAlignment;
#ifdef _WIN64
result->blockedMemory = blockedMemory;
#endif
@@ -810,6 +809,12 @@ error:
return NULL;
}
LPVOID MemoryGetCodeAddress(HMEMORYMODULE mod)
{
PMEMORYMODULE module = (PMEMORYMODULE)mod;
return module ? (LPVOID)module->codeBase : NULL;
}
static int _compare(const void *a, const void *b)
{
const struct ExportNameEntry *p1 = (const struct ExportNameEntry*) a;