Can I store files in an executable?


I need to store a file, no matter its extension (it's mostly an executable) within another executable.

I'm compiling with CodeDom an executable that inside it there is a "special" and encrypted file, while executing the all magic executable is done. But the problem with this magic is the way I'm saving% w of the magic m file inside the x executable.

I want to put the bytes of the m file inside the x file literally.

I did the following in the pre-compiler, I made a static method that already automatically returns the bytes of the m file, but to do this, byte by byte inside the code, I did a huge gambiarra to do that, but it worked. For example, I wrote a Hello World program in C # and got the bytes from this file and compiled it inside another executable, type a file container.

When I decompiled the output executable, I got a huge list of encrypted bytes, and I do not know if this is good practice. Here is the image of how it was:

It was a little steady, was not it?

Question Summary

I would like to know if there is any way to implement bytes of a file without using literal values, or not to declare a variable to save huge amounts of bytes, as I did in the example above.

If this is not possible, can these lists have limits on how many bytes I can put in them?


To get an idea, that method returned about 200MB.

asked by anonymous 29.08.2017 / 09:03