delete comments
parent
388d892263
commit
2810b887a9
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#define RET 0xC3 // ret opcode
|
#define RET 0xC3 // ret opcode
|
||||||
|
|
||||||
|
@ -13,8 +14,8 @@ byte* AF_address(byte* f) {
|
||||||
real_address = f;
|
real_address = f;
|
||||||
#else // MSVC debug mode
|
#else // MSVC debug mode
|
||||||
byte* f_p = f;
|
byte* f_p = f;
|
||||||
byte* offset = (byte*)(*((int*)f_p) >> 8);
|
byte* offset = (byte*)(*((int32_t*)f_p) >> 8);
|
||||||
real_address = f_p + (int)offset + 5;
|
real_address = f_p + (int32_t)offset + 5;
|
||||||
#endif
|
#endif
|
||||||
#elif defined(__GNUC__) // GCC
|
#elif defined(__GNUC__) // GCC
|
||||||
real_address = f;
|
real_address = f;
|
||||||
|
@ -23,13 +24,14 @@ byte* AF_address(byte* f) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print bytes from address to address+size
|
// Print bytes from address to address+size
|
||||||
int AF_print_bytes(byte* a, int size) {
|
int32_t AF_print_bytes(byte* a, int32_t size) {
|
||||||
for (int i = 0; i < size; ++i) {
|
for (int32_t i = 0; i < size; ++i) {
|
||||||
printf("%02X ", *(a + i));
|
printf("%02X ", *(a + i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get any function size
|
// Get any function size
|
||||||
int AF_size(byte* f) {
|
int32_t AF_size(byte* f) {
|
||||||
byte* p = f;
|
byte* p = f;
|
||||||
for (; *p != RET; ++p);
|
for (; *p != RET; ++p);
|
||||||
return p - f + 1;
|
return p - f + 1;
|
||||||
|
|
Loading…
Reference in New Issue