3 ms·
> Finally, we need to be aware that we can’t rely on the global variables to be initialized with a known value. Initializing it globally in this code would resu
by koolba 2y ago
> Finally, we need to be aware that we can’t rely on the global variables to be initialized with a known value. Initializing it globally in this code would result in the compiler generating some instructions to be run before main() is called, which we can’t very easily patch into the original binary.
Assuming your increase the size of the binary, change the first instruction to jump to the end of the program, do your magic, perform the original first instruction, and finally jump to the second instruction. If the program itself does not self modify or otherwise examine its own size, this would get you to the original start with your modifications applied.
> In the end, it took about 8 hours to get this project finished, which was spread out over multiple weeks.
That’s incredible.