-
Notifications
You must be signed in to change notification settings - Fork 0
/
MemoryRegion.cpp
25 lines (22 loc) · 905 Bytes
/
MemoryRegion.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "MemoryRegion.hpp"
Xertz::MemoryRegion::MemoryRegion(const uint64_t baseAddress, const uint64_t allocationBase, const uint64_t allocationProtect, const uint64_t regionSize, const int64_t state, const int64_t protect, const int64_t type, const int32_t partitionId)
{
_baseAddress = baseAddress;
_allocationBase = allocationBase;
_allocationProtect = allocationProtect;
_regionSize = regionSize;
_state = state;
_protect = protect;
_type = type;
_partitionId = partitionId;
}
bool Xertz::MemoryRegion::SetAllocationProtect(const DWORD protect) const
{
DWORD oldPRotect;
return VirtualProtect(reinterpret_cast<void*>(_baseAddress), _regionSize, protect, &oldPRotect);
}
bool Xertz::MemoryRegion::SetProtect(const HANDLE handle, const DWORD protect) const
{
DWORD oldPRotect;
return VirtualProtectEx(handle, reinterpret_cast<void*>(_baseAddress), _regionSize, protect, &oldPRotect);
}