Merge pull request #48 from bb107/relocation

base relocation
This commit is contained in:
Boring
2024-07-03 15:17:01 +08:00
committed by GitHub
+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) {