It's been asked how to automate the task of embedding binary data into source code (Embedding resources in executable using GCC), but I would like to know whether it is possible to just write binary data into a compiled executable, i.e. without having to compile from source. My first thoug开发者_StackOverflow中文版ht would be to include a "constant variable" large enough to hold the data, but I don't know how to find out where to write the data.
The answer is YES, at least with MINGW on win32 an executable can read itself and it can be appended data. So its last few bytes can be the data's header (offset).
精彩评论