Added VEH debegguer, functions comments and renamed functions
This commit is contained in:
@@ -13,14 +13,48 @@ Memory::WriteInstructions(allocMemory, INSTRUCTIONS, sizeof INSTRUCTIONS, ADDRES
|
||||
class Memory
|
||||
{
|
||||
public:
|
||||
static void PatchBytes(void* address, const char* bytes, size_t len);
|
||||
//static void RestoreBytes(uintptr_t address);
|
||||
/**
|
||||
* Patch x bytes in memory.
|
||||
*
|
||||
* @param address : The address to patch.
|
||||
* @param bytes : The bytes to patch
|
||||
* @param len : The number of bytes to be patched
|
||||
*/
|
||||
static void PatchBytes(void* address, const char* bytes, size_t len);
|
||||
|
||||
/**
|
||||
* Restore x bytes in memory.
|
||||
*
|
||||
* @param address : The address to patch.
|
||||
*/
|
||||
static void RestoreBytes(void* address);
|
||||
// AOB scan dans le module spécifié (par nom), avec filtrage sur protections (ex: PAGE_EXECUTE_READ) et offset optionnel
|
||||
static uint8_t* aob_scan(const std::string& module_name, const std::string& signature, DWORD protect_flags, std::shared_ptr<spdlog::logger> log = nullptr);
|
||||
static bool wait_for_module(const std::string& module_name, int timeoutMs, int intervalMs);
|
||||
static std::string byteToHexEscaped(const BYTE byte);
|
||||
|
||||
/**
|
||||
* Achieve an AOB scan in memory.
|
||||
*
|
||||
* @param module_name : The executable to scan.
|
||||
* @param signature : The signature to search for (eg : 7F ?? F3 0F ?? ?? ?? F2)
|
||||
* @param protect_flags : Page protection (PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_READWRITE | PAGE_EXECUTE_WRITECOPY)
|
||||
* @param log : If any log is to be used
|
||||
* @return uint_8* : Pointer to address where AOB is found.
|
||||
*/
|
||||
static uint8_t* AOBScan(const std::string& module_name, const std::string& signature, DWORD protect_flags, std::shared_ptr<spdlog::logger> log = nullptr);
|
||||
|
||||
static std::string ByteToHexEscaped(const BYTE byte);
|
||||
|
||||
/**
|
||||
* Set or clear VEH hardware breakpoint.
|
||||
*
|
||||
* @param targetAddress : The memory target to set a VEH breakpoint.
|
||||
* @param vehHandle : The VEH handle (nullptr when to set breakpoint or a handle when to unset
|
||||
* @param enable : Set or unset the VEH debugger
|
||||
* @param pVEH : The function where to detour (set to nullptr to unset)
|
||||
* @param hwIndex : The hawdware breakpoint to set (0 - 4)
|
||||
* @return hwIndex : The VEH breakpoint handle
|
||||
*/
|
||||
static PVOID SetupOrClearHardwareBreakPointForAllThreads(uintptr_t targetAddress, PVOID vehHandle, bool enable, PVECTORED_EXCEPTION_HANDLER pVEH = nullptr, int hwIndex = 0);
|
||||
private:
|
||||
static bool WaitForModule(const std::string& module_name, int timeoutMs, int intervalMs);
|
||||
struct PatchInfo {
|
||||
void* address;
|
||||
std::vector<BYTE> originalBytes;
|
||||
|
||||
Reference in New Issue
Block a user