1. Modifying the Original EXE File
- Posted by C & K L <candkNOSPAM2ME at TICNET.COM> Nov 23, 1998
- 565 views
If I wanted to store some variable information IN THE EXE file (for instance, at the end of the exe I would put encoded info like user's name, etc.), would this be possible? If so, how so? T'anks! ck
2. Re: Modifying the Original EXE File
- Posted by Daniel Berstein <daber at PAIR.COM> Nov 23, 1998
- 512 views
>If I wanted to store some variable information IN THE EXE file (for >instance, at the end of the exe I would put encoded info like user's >name, etc.), would this be possible? If so, how so? Yes, it can be done. The steps are: 1.- Create a constant in your source that hold the size (in bytes) of the bounded (.exe) file. 2.- To read/write data make a seek() to the above offset 3.- The very last statement in your source must be abort(0) 4.- Iterate step 1 until you match the exact size of the exe (using bind and then dir) Example: constant ExeLength = 150000 .... function GetUserName() integer fn sequence exename, -- Name of the executable username -- Data to be read exename = command_line() -- Get command line exename = exename[2] -- Get executable name fn = open(exename,"rb") -- Open file for binary read seek(exename, ExeLength) -- Let's get to the end of the EXE -- In this example we'll read 20 bytes that hold the user name for loop = 1 to 20 do username = username & getc(fn) end for close(fn) -- Close file return username -- Return info end function .... abort(0) -- The interpreter won't read after this Regards, Daniel Berstein daber at pair.com
3. Re: Modifying the Original EXE File
- Posted by Ralf Nieuwenhuijsen <nieuwen at XS4ALL.NL> Nov 23, 1998
- 499 views
- Last edited Nov 24, 1998
>If I wanted to store some variable information IN THE EXE file (for >instance, at the end of the exe I would put encoded info like user's >name, etc.), would this be possible? If so, how so? Some one build a resource binder. I think it was David. Go look in the archives. Ralf
4. Re: Modifying the Original EXE File
- Posted by David Cuny <dcuny at LANSET.COM> Nov 23, 1998
- 526 views
ck wrote: > If I wanted to store some variable information > IN THE EXE file (for instance, at the end of the > exe I would put encoded info like user's name, etc.), > would this be possible? If so, how so? Some time ago I posted a toolkit called RES. Among other things, you can: - Bind a large number of files into a single resource file - Bind a resource file to an executable Each file in the resource file can be read and written to just as if they were normal files. The only caveat is that you cannot make a bound resource file *larger*. This allows delivering applications that consist of many files as either a single executable, or as an executable and a resource file. The method that it uses is the same as that described by Daniel in his post, but it takes care of all the details (calculating file size, etc) for you. I think it's fairly simple to use. It's probably been moved to the archives by now. -- David Cuny
5. Re: Modifying the Original EXE File
- Posted by C & K L <candk at TICNET.COM> Nov 23, 1998
- 507 views
- Last edited Nov 24, 1998
Wow! Coolness personified/codified. Mr. Cuny is a coding whirlwind. How come RDS hasn't hired him? hehe Thanks Ralf and Daniel and David... David Cuny wrote: > > Some time ago I posted a toolkit called RES. Among other things, you can: <description of just what I need snipped for brevity>