summary refs log tree commit diff stats
path: root/Source/Memory.cpp
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2019-11-16 21:15:59 -0800
committerjbzdarkid <jbzdarkid@gmail.com>2019-11-16 21:15:59 -0800
commitfd2fa2211dc09c9030601fde1afd2f7823b22ed8 (patch)
treedfd3d3195315b69e5ccb397f7aedde115fb7e6e6 /Source/Memory.cpp
parentee426c3bde4b4c7fb1ea38a953d849e8893d8311 (diff)
downloadwitness-tutorializer-fd2fa2211dc09c9030601fde1afd2f7823b22ed8.tar.gz
witness-tutorializer-fd2fa2211dc09c9030601fde1afd2f7823b22ed8.tar.bz2
witness-tutorializer-fd2fa2211dc09c9030601fde1afd2f7823b22ed8.zip
Cleanup tabs -> spaces, actually free memory
Diffstat (limited to 'Source/Memory.cpp')
-rw-r--r--Source/Memory.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/Source/Memory.cpp b/Source/Memory.cpp index e240b90..d90c402 100644 --- a/Source/Memory.cpp +++ b/Source/Memory.cpp
@@ -8,16 +8,17 @@
8#undef PROCESSENTRY32 8#undef PROCESSENTRY32
9#undef Process32Next 9#undef Process32Next
10 10
11Memory::Memory(const std::wstring& processName) : _processName(processName) { 11Memory::Memory(const std::wstring& processName) : _processName(processName) {}
12}
13 12
14Memory::~Memory() { 13Memory::~Memory() {
15 if (_threadActive) { 14 if (_threadActive) {
16 _threadActive = false; 15 _threadActive = false;
17 _thread.join(); 16 _thread.join();
18 } 17 }
18
19 if (_handle != nullptr) { 19 if (_handle != nullptr) {
20 CloseHandle(_handle); 20 for (uintptr_t addr : _allocations) VirtualFreeEx(_handle, (void*)addr, 0, MEM_RELEASE);
21 CloseHandle(_handle);
21 } 22 }
22} 23}
23 24
@@ -133,7 +134,7 @@ int Memory::ExecuteSigScans()
133{ 134{
134 for (int i=0; i<0x200000; i+=0x1000) { 135 for (int i=0; i<0x200000; i+=0x1000) {
135 std::vector<byte> data = ReadData<byte>({i}, 0x1100); 136 std::vector<byte> data = ReadData<byte>({i}, 0x1100);
136 137
137 for (auto& [scanBytes, sigScan] : _sigScans) { 138 for (auto& [scanBytes, sigScan] : _sigScans) {
138 if (sigScan.found) continue; 139 if (sigScan.found) continue;
139 int index = find(data, scanBytes); 140 int index = find(data, scanBytes);