aboutsummaryrefslogtreecommitdiff
path: root/MemDriverLib
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2019-10-01 23:41:40 +0200
committerToni Uhlig <matzeton@googlemail.com>2019-10-01 23:41:40 +0200
commitbffee68c55a4f23566e5200d2db4f9a102b2c87a (patch)
tree99e27e3907f3318c2179dd7f204149a4b6b3ec97 /MemDriverLib
parent3da2303b0828532c96c68a08e4d6d0f5725857dc (diff)
DLLHelper supports setting preferred virtual address for virtual memory allocation
Diffstat (limited to 'MemDriverLib')
-rw-r--r--MemDriverLib/DLLHelper.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/MemDriverLib/DLLHelper.cpp b/MemDriverLib/DLLHelper.cpp
index 15951b3..20ab974 100644
--- a/MemDriverLib/DLLHelper.cpp
+++ b/MemDriverLib/DLLHelper.cpp
@@ -276,23 +276,23 @@ bool DLLHelper::VerifyHeader()
return VerifyPeHeader(m_DLLPtr, m_DLLSize, &m_NTHeader);
}
-bool DLLHelper::InitTargetMemory()
+bool DLLHelper::InitTargetMemory(UINT64 preferredVirtualAddress)
{
if (!m_DLLPtr || !m_NTHeader) {
return false;
}
- PVOID wantedBaseAddr = m_TargetBaseAddress;
+ PVOID wantedAddress = (PVOID)preferredVirtualAddress;
SIZE_T wantedSize = m_NTHeader->OptionalHeader.SizeOfImage;
KInterface& ki = KInterface::getInstance();
- if (!ki.VAlloc(m_TargetPID, &wantedBaseAddr, &wantedSize, PAGE_EXECUTE_READWRITE)) {
+ if (!ki.VAlloc(m_TargetPID, &wantedAddress, &wantedSize, PAGE_EXECUTE_READWRITE)) {
return false;
}
if (wantedSize < m_NTHeader->OptionalHeader.SizeOfImage) {
return false;
}
- m_TargetBaseAddress = wantedBaseAddr;
+ m_TargetBaseAddress = wantedAddress;
return true;
}