diff options
| author | jbzdarkid <jbzdarkid@gmail.com> | 2019-11-05 10:01:52 -0800 |
|---|---|---|
| committer | jbzdarkid <jbzdarkid@gmail.com> | 2019-11-05 10:01:52 -0800 |
| commit | 66b2bc177853d33f4559eb240fbbca354b173fa2 (patch) | |
| tree | 08739589749ab0def5afbed2520e520736656e3c /Source/Memory.h | |
| parent | e3758a15a6430e7ab7ce9821c0d9e19bbf7a1e87 (diff) | |
| download | witness-tutorializer-66b2bc177853d33f4559eb240fbbca354b173fa2.tar.gz witness-tutorializer-66b2bc177853d33f4559eb240fbbca354b173fa2.tar.bz2 witness-tutorializer-66b2bc177853d33f4559eb240fbbca354b173fa2.zip | |
All set... time to wire up actual randomizer
Diffstat (limited to 'Source/Memory.h')
| -rw-r--r-- | Source/Memory.h | 15 |
1 files changed, 11 insertions, 4 deletions
| diff --git a/Source/Memory.h b/Source/Memory.h index d7552c5..c19d92b 100644 --- a/Source/Memory.h +++ b/Source/Memory.h | |||
| @@ -1,12 +1,14 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | #include <functional> | 2 | #include <functional> |
| 3 | #include <map> | 3 | #include <map> |
| 4 | #include <thread> | ||
| 4 | #include <vector> | 5 | #include <vector> |
| 5 | #include <windows.h> | 6 | #include <windows.h> |
| 6 | 7 | ||
| 7 | // #define GLOBALS 0x5B28C0 | 8 | // #define GLOBALS 0x5B28C0 |
| 8 | #define GLOBALS 0x62D0A0 | 9 | #define GLOBALS 0x62D0A0 |
| 9 | 10 | ||
| 11 | #define HEARTBEAT 0x401 | ||
| 10 | enum class ProcStatus { | 12 | enum class ProcStatus { |
| 11 | NotRunning, | 13 | NotRunning, |
| 12 | Running, | 14 | Running, |
| @@ -17,11 +19,11 @@ enum class ProcStatus { | |||
| 17 | // http://stackoverflow.com/q/32798185 | 19 | // http://stackoverflow.com/q/32798185 |
| 18 | // http://stackoverflow.com/q/36018838 | 20 | // http://stackoverflow.com/q/36018838 |
| 19 | // http://stackoverflow.com/q/1387064 | 21 | // http://stackoverflow.com/q/1387064 |
| 20 | class Memory { | 22 | class Memory final : public std::enable_shared_from_this<Memory> { |
| 21 | public: | 23 | public: |
| 22 | Memory() = default; | 24 | Memory(const std::wstring& processName); |
| 23 | ProcStatus Heartbeat(const std::wstring& processName); | ||
| 24 | ~Memory(); | 25 | ~Memory(); |
| 26 | void StartHeartbeat(HWND window, std::chrono::milliseconds beat = std::chrono::milliseconds(1000)); | ||
| 25 | 27 | ||
| 26 | Memory(const Memory& memory) = delete; | 28 | Memory(const Memory& memory) = delete; |
| 27 | Memory& operator=(const Memory& other) = delete; | 29 | Memory& operator=(const Memory& other) = delete; |
| @@ -74,10 +76,15 @@ private: | |||
| 74 | ThrowError(); | 76 | ThrowError(); |
| 75 | } | 77 | } |
| 76 | 78 | ||
| 77 | bool Initialize(const std::wstring& processName); | 79 | void Heartbeat(HWND window); |
| 80 | bool Initialize(); | ||
| 78 | void ThrowError(); | 81 | void ThrowError(); |
| 79 | void* ComputeOffset(std::vector<int> offsets); | 82 | void* ComputeOffset(std::vector<int> offsets); |
| 80 | 83 | ||
| 84 | int _previousFrame = 0; | ||
| 85 | bool _threadActive = false; | ||
| 86 | std::thread _thread; | ||
| 87 | std::wstring _processName; | ||
| 81 | std::map<uintptr_t, uintptr_t> _computedAddresses; | 88 | std::map<uintptr_t, uintptr_t> _computedAddresses; |
| 82 | uintptr_t _baseAddress = 0; | 89 | uintptr_t _baseAddress = 0; |
| 83 | HANDLE _handle = nullptr; | 90 | HANDLE _handle = nullptr; |
