c++ - Change .exe with hexeditor -
i wrote little program in c++:
#include <iostream> int main() { int input; std::cin >> input; if(input == 5){ std::cout << "input == 5"; } else{ std::cout << "input != 5"; } return 0; }
i have built program. working program in release
folder. want change if
statement, without changing c++ code. downloaded hex editor , opened file. inside .exe
lot. googled problem , found nice image:
i searched inside hex editor output input == 5
. found it. when change different , execute file, program displays new entered message, not old one.
but want change structure of code (the if
statement). searched if
, didn't find anything. so, code section (image)?
c++ high-level language. written in "source" (plain text, i.e. if ( ... )
), , compiler translates machine code.
machine code different, low-level language. one, c++ "if ... else", machine code "conditional branch instruction", (sequence of) specific byte values, i.e. see in hex editor. "if" no longer exists.
the specific command set, , byte values representing commands, differ cpu family cpu family.
if really interested in machine code, check out the art of assembly language programming randy hyde. has very introduction x86 assembly , machine code.
generally speaking, though, won't need more token knowledge of asm / machine code, since subject pops rather seldom on professional level, unless working on operating systems , / or device drivers (and of time not then).
Comments
Post a Comment