diff options
Diffstat (limited to 'Source/Memory.cpp')
-rw-r--r-- | Source/Memory.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Source/Memory.cpp b/Source/Memory.cpp index 825346a..43cb9b3 100644 --- a/Source/Memory.cpp +++ b/Source/Memory.cpp | |||
@@ -39,6 +39,11 @@ Memory::Memory(const std::string& processName) { | |||
39 | if (_baseAddress == 0) { | 39 | if (_baseAddress == 0) { |
40 | throw std::exception("Couldn't find the base process address!"); | 40 | throw std::exception("Couldn't find the base process address!"); |
41 | } | 41 | } |
42 | |||
43 | // Unprotect regions of memory | ||
44 | |||
45 | DWORD oldProtect; | ||
46 | VirtualProtectEx(_handle, (LPVOID)_baseAddress, sizeof(DWORD), PAGE_READWRITE, &oldProtect); | ||
42 | } | 47 | } |
43 | 48 | ||
44 | Memory::~Memory() { | 49 | Memory::~Memory() { |
@@ -58,6 +63,14 @@ int Memory::GetCurrentFrame() | |||
58 | return ReadData<int>({SCRIPT_FRAMES}, 1)[0]; | 63 | return ReadData<int>({SCRIPT_FRAMES}, 1)[0]; |
59 | } | 64 | } |
60 | 65 | ||
66 | void Memory::SigScan(std::function<void(int offset, const std::vector<byte>& data)> scanFunc) | ||
67 | { | ||
68 | for (int i=0; i<0x200000; i+=0x1000) { | ||
69 | std::vector<byte> data = ReadData<byte>({i}, 0x1100); | ||
70 | scanFunc(i, data); | ||
71 | } | ||
72 | } | ||
73 | |||
61 | void Memory::ThrowError() { | 74 | void Memory::ThrowError() { |
62 | std::string message(256, '\0'); | 75 | std::string message(256, '\0'); |
63 | int length = FormatMessageA(4096, nullptr, GetLastError(), 1024, &message[0], static_cast<DWORD>(message.size()), nullptr); | 76 | int length = FormatMessageA(4096, nullptr, GetLastError(), 1024, &message[0], static_cast<DWORD>(message.size()), nullptr); |