about summary refs log tree commit diff stats
path: root/WitnessRandomizer/Memory.h
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2018-10-23 22:12:38 -0700
committerjbzdarkid <jbzdarkid@gmail.com>2018-10-23 22:12:38 -0700
commit922dbb03a50a54f3e5ae9efaec3b4759cd701c3e (patch)
tree08c0053b92b1e32e3c74b074815411f71e497eb5 /WitnessRandomizer/Memory.h
parentfac6378cf7370b93099ff73851cc9a0b68497335 (diff)
downloadwitness-tutorializer-922dbb03a50a54f3e5ae9efaec3b4759cd701c3e.tar.gz
witness-tutorializer-922dbb03a50a54f3e5ae9efaec3b4759cd701c3e.tar.bz2
witness-tutorializer-922dbb03a50a54f3e5ae9efaec3b4759cd701c3e.zip
move panels to new file, additional filtering, additional swapping.
Diffstat (limited to 'WitnessRandomizer/Memory.h')
-rw-r--r--WitnessRandomizer/Memory.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/WitnessRandomizer/Memory.h b/WitnessRandomizer/Memory.h index 6b50948..6882c9c 100644 --- a/WitnessRandomizer/Memory.h +++ b/WitnessRandomizer/Memory.h
@@ -17,18 +17,23 @@ public:
17 std::vector<T> ReadData(const std::vector<int>& offsets, int numItems) { 17 std::vector<T> ReadData(const std::vector<int>& offsets, int numItems) {
18 std::vector<T> data; 18 std::vector<T> data;
19 data.resize(numItems); 19 data.resize(numItems);
20 if (!ReadProcessMemory(_handle, (LPVOID)ComputeOffset(offsets), &data[0], sizeof(T) * numItems, NULL)) { 20 for (int i=0; i<5; i++) {
21 ThrowError(); 21 if (ReadProcessMemory(_handle, (LPVOID)ComputeOffset(offsets), &data[0], sizeof(T) * numItems, NULL))
22 {
23 return data;
24 }
22 } 25 }
23 return data; 26 ThrowError();
24 } 27 }
25 28
26 template <class T> 29 template <class T>
27 bool WriteData(const std::vector<int>& offsets, const std::vector<T>& data) { 30 void WriteData(const std::vector<int>& offsets, const std::vector<T>& data) {
28 if (!WriteProcessMemory(_handle, (LPVOID)ComputeOffset(offsets), &data[0], sizeof(T) * data.size(), NULL)) { 31 for (int i=0; i<5; i++) {
29 return false; 32 if (WriteProcessMemory(_handle, (LPVOID)ComputeOffset(offsets), &data[0], sizeof(T) * data.size(), NULL)) {
33 return;
34 }
30 } 35 }
31 return true; 36 ThrowError();
32 } 37 }
33 38
34private: 39private: