about summary refs log tree commit diff stats
path: root/Source/Memory.h
diff options
context:
space:
mode:
authorjbzdarkid <jbzdarkid@gmail.com>2018-11-01 20:56:56 -0700
committerjbzdarkid <jbzdarkid@gmail.com>2018-11-01 20:56:56 -0700
commit5de975b03c7200cc66188a4b1a76e1213524975d (patch)
treee3ed982a0dd4fee4db402532aeda2e6bf5e66344 /Source/Memory.h
parent3557f0ba80942397a9d963208695b4fa80290cb0 (diff)
downloadwitness-tutorializer-5de975b03c7200cc66188a4b1a76e1213524975d.tar.gz
witness-tutorializer-5de975b03c7200cc66188a4b1a76e1213524975d.tar.bz2
witness-tutorializer-5de975b03c7200cc66188a4b1a76e1213524975d.zip
pain and suffering, but I can read/write decorations & dots.
Diffstat (limited to 'Source/Memory.h')
-rw-r--r--Source/Memory.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/Source/Memory.h b/Source/Memory.h index 53fa1e0..310c971 100644 --- a/Source/Memory.h +++ b/Source/Memory.h
@@ -3,6 +3,9 @@
3#include <map> 3#include <map>
4#include <windows.h> 4#include <windows.h>
5 5
6#define GLOBALS 0x5B28C0
7//#define GLOBALS 0x62A080
8
6// https://github.com/erayarslan/WriteProcessMemory-Example 9// https://github.com/erayarslan/WriteProcessMemory-Example
7// http://stackoverflow.com/q/32798185 10// http://stackoverflow.com/q/32798185
8// http://stackoverflow.com/q/36018838 11// http://stackoverflow.com/q/36018838
@@ -16,6 +19,27 @@ public:
16 Memory(const Memory& memory) = delete; 19 Memory(const Memory& memory) = delete;
17 Memory& operator=(const Memory& other) = delete; 20 Memory& operator=(const Memory& other) = delete;
18 21
22
23 template <class T>
24 std::vector<T> ReadArray(int panel, int offset, int size) {
25 return ReadData<T>({GLOBALS, 0x18, panel*8, offset, 0}, size);
26 }
27
28 template <class T>
29 void WriteArray(int panel, int offset, const std::vector<T>& data) {
30 WriteData<T>({GLOBALS, 0x18, panel*8, offset, 0}, data);
31 }
32
33 template <class T>
34 std::vector<T> ReadPanelData(int panel, int offset, size_t size) {
35 return ReadData<T>({GLOBALS, 0x18, panel*8, offset}, size);
36 }
37
38 template <class T>
39 void WritePanelData(int panel, int offset, const std::vector<T>& data) {
40 WriteData<T>({GLOBALS, 0x18, panel*8, offset}, data);
41 }
42
19 template<class T> 43 template<class T>
20 std::vector<T> ReadData(const std::vector<int>& offsets, size_t numItems) { 44 std::vector<T> ReadData(const std::vector<int>& offsets, size_t numItems) {
21 std::vector<T> data; 45 std::vector<T> data;
@@ -41,6 +65,7 @@ public:
41 } 65 }
42 66
43private: 67private:
68
44 void ThrowError(); 69 void ThrowError();
45 70
46 void* ComputeOffset(std::vector<int> offsets); 71 void* ComputeOffset(std::vector<int> offsets);