And a way cool thing as well, you can call a buffer as a functionJust make sure your function has REAL instructions in it.Code:char *buffer = get_function_code_from_somewhere(); typedef long (*FUNCPTR)(int, int); long compatible(int x, int y) { /* This function is compatible with the function pointer */ return x + y; } void somecode() { FUNCPTR pfn = (FUNCPTR)buffer; (*pfn)(6, 7); }
This is one way to make self-modifying code (modify the machine code in memory, and then write it back to the .exe file).





Reply With Quote