How does that work?
I was looking at https://msdn.microsoft.com/en-us/lib...=vs.85%29.aspx when I noticed this very interesting sentence.
To execute dynamically generated code, use VirtualAlloc to allocate memory and the VirtualProtect function to grant PAGE_EXECUTE access.
Apparantly I can create a blank space in memory to stick raw executable code (like would come out of an x86 assembler after feeding it some assembly sourcecode, but without converting it into an exe file with a "linker"), and then have my program execute it. Problem is, this only tells me how to allocate space that will be executable. Next I need to find an API call to cause the code in the allocated memory space to actually be executed. What API call allows me to execute arbitrary code stored in memory?
I was looking at https://msdn.microsoft.com/en-us/lib...=vs.85%29.aspx when I noticed this very interesting sentence.
Quote:
To execute dynamically generated code, use VirtualAlloc to allocate memory and the VirtualProtect function to grant PAGE_EXECUTE access.