From 922dbb03a50a54f3e5ae9efaec3b4759cd701c3e Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Tue, 23 Oct 2018 22:12:38 -0700 Subject: move panels to new file, additional filtering, additional swapping. --- WitnessRandomizer/Memory.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'WitnessRandomizer/Memory.h') 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: std::vector ReadData(const std::vector& offsets, int numItems) { std::vector data; data.resize(numItems); - if (!ReadProcessMemory(_handle, (LPVOID)ComputeOffset(offsets), &data[0], sizeof(T) * numItems, NULL)) { - ThrowError(); + for (int i=0; i<5; i++) { + if (ReadProcessMemory(_handle, (LPVOID)ComputeOffset(offsets), &data[0], sizeof(T) * numItems, NULL)) + { + return data; + } } - return data; + ThrowError(); } template - bool WriteData(const std::vector& offsets, const std::vector& data) { - if (!WriteProcessMemory(_handle, (LPVOID)ComputeOffset(offsets), &data[0], sizeof(T) * data.size(), NULL)) { - return false; + void WriteData(const std::vector& offsets, const std::vector& data) { + for (int i=0; i<5; i++) { + if (WriteProcessMemory(_handle, (LPVOID)ComputeOffset(offsets), &data[0], sizeof(T) * data.size(), NULL)) { + return; + } } - return true; + ThrowError(); } private: -- cgit 1.4.1