Hello,
I'm trying to create a data area within an .exe file. Then I will open the .exe file and scan it for the data area. When the data area is found, I will write some data to this data area and write the .exe file back to disk. I want to accomplish this by creating a character array in my source file like so:
char arr[] = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
Then that should be stored in the .exe file somewhere. The problem is, all of those A's don't appear anywhere in the .exe file . I know why, it's because the compiler ignored the array because I didn't reference it. If I reference it, by using a simply for loop and incrementing each element of the array, then those A's do appear in the .exe file as expected.
So, my question is, is there anyway to keep the compiler from deciding for me what I need or don't need in my code? So that I don't have to reference the array in order to get it included in the compilation process? I thought maybe this problem had to do with the compiler's optimization but I turned off the optimization feature in the compiler's configuration but with no luck. I'm using Visual Studio Community 2015. Any help would be appreciated.
Thanks.