diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2019-09-28 22:28:24 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2019-09-28 22:28:24 +0200 |
commit | 5259dc69ebc108c4f5eec024a22ae80396fe39a7 (patch) | |
tree | 31c67602a8dd9a173bddc9bc0c4d897d13ca1713 /MemDriverLib | |
parent | 37f1a2f66109ed4d16b15880c4a63cc85e9871c2 (diff) |
relocation fixup used only 32bit deltas instead of 64bot
Diffstat (limited to 'MemDriverLib')
-rw-r--r-- | MemDriverLib/DLLHelper.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/MemDriverLib/DLLHelper.cpp b/MemDriverLib/DLLHelper.cpp index 2e52f84..15951b3 100644 --- a/MemDriverLib/DLLHelper.cpp +++ b/MemDriverLib/DLLHelper.cpp @@ -363,7 +363,7 @@ bool DLLHelper::FixRelocs() { unsigned long long ImageBase; unsigned int nBytes = 0; - unsigned long delta; + unsigned long long delta; IMAGE_BASE_RELOCATION *reloc; if (!m_TargetPID || !m_TargetBaseAddress || !m_NTHeader || @@ -384,12 +384,12 @@ bool DLLHelper::FixRelocs() (DWORD)(m_NTHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress), m_NTHeader, (PBYTE)m_DLLPtr); ImageBase = m_NTHeader->OptionalHeader.ImageBase; - delta = MakeDelta(unsigned long, m_TargetBaseAddress, ImageBase); + delta = MakeDelta(unsigned long long, m_TargetBaseAddress, ImageBase); while (1) { - unsigned long *locBase = - (unsigned long *)GetPtrFromRVA((DWORD)(reloc->VirtualAddress), m_NTHeader, + unsigned long long *locBase = + (unsigned long long *)GetPtrFromRVA((DWORD)(reloc->VirtualAddress), m_NTHeader, (PBYTE)m_DLLPtr); unsigned int numRelocs = (reloc->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof(WORD); @@ -401,7 +401,7 @@ bool DLLHelper::FixRelocs() for (unsigned int i = 0; i < numRelocs; i++) { if (((*locData >> 12) & IMAGE_REL_BASED_HIGHLOW)) - *MakePtr(unsigned long *, locBase, (*locData & 0x0FFF)) += delta; + *MakePtr(unsigned long long *, locBase, (*locData & 0x0FFF)) += delta; locData++; } |