Correct me if I'm wrong, but I believe its possible to load executable data from a file and execute it through a jmp instruction using inline asm. Assuming that is correct, what would the correct syntax be? I'm using MinGW with CodeBlocks (AT&T syntax asm).
I tried the following code, but it crashes from a segfault.
* EXE file is not all machine code. If you want to run a program, just use CreateProcess. There is some hard work needed otherwise. If you are willing though, I suggest starting with COM files as they are much simpler.
* The OS might not be crazy about executing random memory. Although I think I've don similar things on windows..
* I don't get that ASM. Possibly due to at&t syntax.. Why would you jump to 0?
here is a nice article on stack exploits, it is similar to what you are doing in that it overflows a char buffer to run some shell code. it is for linux though, it uses the AT&T/GAS syntax for assembly
@roberts, Your definition of ADT is uselessly strict. Both SS and std::stack have their memory locations and operations push, pop. This is all that should matter. The only differences are that std::stack performs reallocations and SS is implemented in the instruction set.