From f8c92cfa9eeb82a608d409cac70d9d2533ab79d8 Mon Sep 17 00:00:00 2001 From: Quentin LADEVIE Date: Tue, 29 Apr 2025 23:28:52 +0200 Subject: Compile files one by one --- src/utils.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index de719e9..440b9fb 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1,9 +1,7 @@ -#if defined (_DEBUG) -#define assert(x) if (!(x)) __debugbreak(); -#else -#define assert(x) (x) -#endif -void print(const char* format, ...); +#include "utils.h" + +#include +#include u8 is_alpha(char c) { return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'); @@ -155,3 +153,13 @@ void print(const char* format, ...) { StringCchLengthA(formatted_str, sizeof(formatted_str), &length); SUCCEEDED(WriteFile(standard_err, formatted_str, (DWORD)length, NULL, NULL)); } + +/* Read debugged process memory at address */ +u8 read_memory(const void* addr, void* buffer, size_t size) { + extern PROCESS_INFORMATION proc_info; + + size_t b_read = 0U; + HRESULT hr = ReadProcessMemory(proc_info.hProcess, addr, buffer, size, &b_read); + + return hr > 0 && b_read == size; +} -- cgit v1.3