The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: redskull on July 07, 2006, 01:03:08 AM

Title: real-time resource editing
Post by: redskull on July 07, 2006, 01:03:08 AM
I had some strings that I was going to store in the registry and edit/save them as necessary, but then I wondered about the possibility of storing them in a resource file and changing them at run-time.  Even though it's just data, it's still probably in the realm of EXE file editing which is bad ju-ju in these parts.  So I guess my question is if it's worth trying to implement it, or if the ends don't justify the means.  I don't mean to toe the legality lines, so delete as necessary.

alan
Title: Re: real-time resource editing
Post by: hutch-- on July 07, 2006, 01:12:19 AM
Red,

Unless you have good reason to do otherwise, nothing is as flexible as a seperate INI file that you always write to the same directory as the executable. You normally test for it at startup of the EXE, write a default version if its not there and read its content into the EXE to retain the values you want. Putting stuff in the registry is a security issue that a trojan can scan the registry for and identify your app from it.

With a lot of messing around you can directly patch an EXE but with all 32 bit Windows versions, it cannot be done from the EXE that is to be patched. You can write a seperate patcher for it but the EXE will have to be closed while you are patching it.
Title: Re: real-time resource editing
Post by: Mark Jones on July 07, 2006, 02:35:15 AM
Hi Alan, here's a great thread on dealing with .ini files.

http://www.masm32.com/board/index.php?topic=1073.0
Title: Re: real-time resource editing
Post by: Casper on July 07, 2006, 01:12:13 PM
I have created an installation program.  One of the things I needed to deal with was to create an ini file but somehow protect it against tampering.  My solution was to bundle the ini file into the exe by adding it as an RCDATA resource and then the exe loads it into memory and parses it.  I did the same with a DLL.

Casper
Title: Re: real-time resource editing
Post by: redskull on July 07, 2006, 02:56:12 PM
thanks guys, an .ini file looks like the way to go  :U