Can a program dump it's own source code?

VantiveGuy

Member
Joined
Mar 5, 2009
Messages
18
Location
Brussels on Contract
Programming Experience
1-3
Yes, I know it sounds an odd request, but in order for others to gain access to an executable's VB.Net source code long after I have left the project I wanted to add something that could output the source code to notepad. This would be triggered by calling the exe with a numbner of parameters passed, like a pass phrase.
I know how to pass the parameters and can call a proc based on what is passed, but I don't know if it's possible within that proc to dump the entire program's source code to notepad.
Is this possible?
Thanks for any tips,

Alan.
 
Hello.

You'd be better of to make sure that the source isn't lost. ;)

To your question...it's possible...somehow. If you need a simple program for examining and patching a assembly, have a look at reflector (in my signature). Also have a look at the Mono Library Cecil, which is a very powerful reflection library. Though, the extracted code will never match the code you've written:
VB.NET:
VB.Net -> [Compiler] -> CIL -> [Disassembler] -> CIL (read-, browseable) -> [Translator] -> VB.NET

Just make sure that the code will exist in the future, and keep a copy of it, just in case.

Bobby
 
By including the source code in the exe itself, you're just making the end file be much larger and opening the door for other developers to be able to get at your source code because your own program would allow them to get it (doesn't matter if you password it and whatnot, they'll be able to get it anyways)
 
Hi Guys,

And thanks for your input. I guess I'll just give up on this idea. Yes, of course I will keep backups and several copies of the code, but I thought it would be cool for the program to cough up it's code when the right pass phrase was entered.
Thanks again for taking the time to respond to a silly idea :)
 
Back
Top