calling code stored in the heap from vc++

后端 未结 4 485
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-23 13:08

Imagine I am doing something like this:

void *p = malloc (1000);
*((char*)p) = some_opcode;
*((char*)p+1) = another_opcode; // for the sake of the example: t         


        
4条回答
  •  隐瞒了意图╮
    2020-12-23 13:28

    I'm also currently looking into executing generated code, and while the answers here didn't give me precisely what I needed, you guys sent me on the right track.

    If you need to mark a page as executable on POSIX systems (Linux, BSD etc.), check out the mmap(2) function.

提交回复
热议问题