| author | Ruben Gonzalez <drifter01620@gmail.com> |
| Fri Sep 12 13:06:03 2014 -0400 (2014-09-12) | |
| changeset 192 | f03ec327fc85 |
| parent 184 | 7ddf645a50d5 |
| permissions | -rw-r--r-- |
| drifter01620@184 | 1 |
#ifndef __ASM_H__ |
| drifter01620@184 | 2 |
#define __ASM_H__ |
| drifter01620@184 | 3 |
|
| drifter01620@184 | 4 |
#define OP_JMP 0xE9 |
| drifter01620@184 | 5 |
#define OP_JMP_SIZE 5 |
| drifter01620@184 | 6 |
|
| drifter01620@184 | 7 |
#define OP_NOP 0x90 |
| drifter01620@184 | 8 |
#define OP_NOP_SIZE 1 |
| drifter01620@184 | 9 |
|
| drifter01620@184 | 10 |
#define OP_PREFIX 0xFF |
| drifter01620@184 | 11 |
#define OP_JMP_SEG 0x25 |
| drifter01620@184 | 12 |
|
| drifter01620@184 | 13 |
#define OP_JMP_BYTE 0xEB |
| drifter01620@184 | 14 |
#define OP_JMP_BYTE_SIZE 2 |
| drifter01620@184 | 15 |
|
| drifter01620@184 | 16 |
#ifdef __cplusplus |
| drifter01620@184 | 17 |
extern "C" { |
| drifter01620@184 | 18 |
#endif |
| drifter01620@184 | 19 |
|
| drifter01620@184 | 20 |
void check_thunks(unsigned char *dest, unsigned char *pc); |
| drifter01620@184 | 21 |
|
| drifter01620@184 | 22 |
//if dest is NULL, returns minimum number of bytes needed to be copied |
| drifter01620@184 | 23 |
//if dest is not NULL, it will copy the bytes to dest as well as fix CALLs and JMPs |
| drifter01620@184 | 24 |
//http://www.devmaster.net/forums/showthread.php?t=2311 |
| drifter01620@184 | 25 |
int copy_bytes(unsigned char *func, unsigned char* dest, int required_len); |
| drifter01620@184 | 26 |
|
| drifter01620@184 | 27 |
//insert a specific JMP instruction at the given location |
| drifter01620@184 | 28 |
void inject_jmp(void* src, void* dest); |
| drifter01620@184 | 29 |
|
| drifter01620@184 | 30 |
//fill a given block with NOPs |
| drifter01620@184 | 31 |
void fill_nop(void* src, unsigned int len); |
| drifter01620@184 | 32 |
|
| drifter01620@184 | 33 |
//evaluate a JMP at the target |
| drifter01620@184 | 34 |
void* eval_jump(void* src); |
| drifter01620@184 | 35 |
|
| drifter01620@184 | 36 |
#ifdef __cplusplus |
| drifter01620@184 | 37 |
} |
| drifter01620@184 | 38 |
#endif |
| drifter01620@184 | 39 |
|
| drifter01620@184 | 40 |
#endif //__ASM_H__ |