-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMemoryScanner.h
More file actions
36 lines (33 loc) · 1.27 KB
/
Copy pathMemoryScanner.h
File metadata and controls
36 lines (33 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once
#include <Windows.h>
#include <vector>
#include <string>
#include "Signatures.h"
struct ScanResult {
std::string signatureName;
std::string pattern;
uintptr_t address;
bool found;
};
class MemoryScanner {
public:
MemoryScanner();
~MemoryScanner();
bool Initialize(const std::string& processName);
std::vector<ScanResult> ScanAllSignatures();
ScanResult ScanSignature(const std::string& signatureName);
bool DumpResultsToFile(const std::string& filename, const std::vector<ScanResult>& results);
HANDLE GetProcessHandle() const { return m_hProcess; }
uintptr_t GetModuleBase() const { return m_moduleBase; }
private:
HANDLE m_hProcess;
uintptr_t m_moduleBase;
std::string m_processName;
uintptr_t FindPattern(const std::string& pattern);
std::vector<uint8_t> PatternToBytes(const std::string& pattern);
bool PatternMatch(const uint8_t* data, const std::vector<uint8_t>& pattern);
bool ReadProcessMemory(uintptr_t address, void* buffer, size_t size);
std::vector<uint8_t> ReadMemoryRegion(uintptr_t address, size_t size);
DWORD GetProcessIdByName(const std::string& processName);
uintptr_t GetModuleBaseAddress(DWORD processId, const std::string& moduleName);
};