Two common mistakes you can make here. First of all, select unsigned char*
instead of char *. Then, and important, Project + Properties, Linker, General and turn off incremental binding.
When incremental binding is enabled, the address of the function actually points to a small stub that does not contain anything other than JMP for the real function. This allows the linker to replace the old code with new code without having to rearrange the entire executable image. Your code reads this stub instead of the real function when incremental binding is enabled. The correct conclusion:
Reading dummy... 90 90 90 90 C3 //... rest is random
source share