diff --git a/analysis_function.h b/analysis_function.h index 68233e7..424735b 100644 --- a/analysis_function.h +++ b/analysis_function.h @@ -1,6 +1,7 @@ #pragma once #include +#include #define RET 0xC3 // ret opcode @@ -13,8 +14,8 @@ byte* AF_address(byte* f) { real_address = f; #else // MSVC debug mode byte* f_p = f; - byte* offset = (byte*)(*((int*)f_p) >> 8); - real_address = f_p + (int)offset + 5; + byte* offset = (byte*)(*((int32_t*)f_p) >> 8); + real_address = f_p + (int32_t)offset + 5; #endif #elif defined(__GNUC__) // GCC real_address = f; @@ -23,13 +24,14 @@ byte* AF_address(byte* f) { } // Print bytes from address to address+size -int AF_print_bytes(byte* a, int size) { - for (int i = 0; i < size; ++i) { +int32_t AF_print_bytes(byte* a, int32_t size) { + for (int32_t i = 0; i < size; ++i) { printf("%02X ", *(a + i)); } } + // Get any function size -int AF_size(byte* f) { +int32_t AF_size(byte* f) { byte* p = f; for (; *p != RET; ++p); return p - f + 1;