I came across a program SelfNote which stores all the text we write and the password in itself.No other file is created (the EXE changes its size as we change it's contents) . It is a standalone exe with all the content within it.
How can an exe modify itself ?
Is this possible in VB.net ??

Possible? Yes. Off the top of my head, I'd probably approach it as storing the settings in an embedded resource, then replacing that resource when settings change.

However, this strikes me as an unnnecessary complication. I don't see any good reason why you can't distribute a config file along with your executable and use the usual settings methods. The password can (and should) of course be encrypted when stored in a user-accessible location, but that's trivial to do.

In terms of an executable modifying itself, there's a hard limitation of the file being locked while loaded in memory. So any solution would need to work around this limitation. Therein lies the rub, because now you're either using tricks like the resource replacement I mentioned, or actively disassembling and reassembling the IL from the client side (not a good idea in general).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.