c++ visual studio 2010 exe in resource get Rebased?
Has anyone noticed that if you import an exe as 开发者_如何学Pythonresource it gets rebased and also seems that its PE header gets rebuilt?
There are times that this is irritating. Does anybody knows how to disable the rebasing!?
steps to reproduce in c++:
1) compile a hello world and manually set its base address (in properties) to lets say 0x1000000
2) make a second project and include the hello world into resources. Also manually set its base address as above.
3) build second project
4) extract the exe from resources and check it with a Pe editor! it gets set back to 0x400000. Why?!
How are you including the EXE as a resource into the second project?
Using these defines:
#define BINFILE 222
#define IDR_MYFILE 101
If I reference the executable in my .rc file as pointing to the original file, e.g.:
IDR_MYFILE BINFILE "S:\\mysource\\t1\\Release\\t1.exe"
Then, upon extraction, my embedded EXE resource is not rebased, but maintains what I had built it with.
You might be interested in a binary builder that'll covert your exe file as a const unsigned char [] array. That way, VisualStudio will not have a chance to snoop into your resources.
For example, this one: http://sourceforge.net/projects/juce/files/juce/1.52/prebuilt%20binaries/BinaryBuilder.exe/download
精彩评论