base relocation

This commit is contained in:
Boring
2024-07-03 12:49:50 +08:00
parent 61a80f4ec9
commit 252e628a71
+1 -1
View File
@@ -285,7 +285,7 @@ NTSTATUS MemoryLoadLibrary(
PIMAGE_BASE_RELOCATION_HEADER relocation = (PIMAGE_BASE_RELOCATION_HEADER)(LPBYTE(base) + dir->VirtualAddress);
if (dir->Size && dir->VirtualAddress) {
while (relocation->VirtualAddress > 0) {
while ((LPBYTE(relocation) < LPBYTE(base) + dir->VirtualAddress + dir->Size) && relocation->VirtualAddress > 0) {
auto relInfo = (_REBASE_INFO*)&relocation->TypeOffset;
for (DWORD i = 0; i < relocation->TypeOffsetCount(); ++i, ++relInfo) {
switch (relInfo->Type) {