Executing machine code in memory

后端 未结 9 1506
盖世英雄少女心
盖世英雄少女心 2020-12-04 12:47

I\'m trying to figure out how to execute machine code stored in memory.

I have the following code:

#include 
#include          


        
9条回答
  •  天涯浪人
    2020-12-04 13:12

    Executable files contain much more than just code. Header, code, data, more data, this stuff is separated and loaded into different areas of memory by the OS and its libraries. You can't load a program file into a single chunk of memory and expect to jump to it's first byte.

    If you are trying to execute your own arbitrary code, you need to look into dynamic libraries because that is exactly what they're for.

提交回复
热议问题