Quote Originally Posted by adeyblue View Post
That's probably due to compiling with the "Enable Function Level Linking" flag. With that enabled, function pointers are indexes into a jump table so all that gets copied is part of the the table, which in the target process probably point to no mans land.

Also, freeing the memory your executing in the target process is going to lead to a crash.
Also, buffer security check must be disabled.