I want to make a letter writer like those of the C-64 and Amiga days. The program will have 2 parts, an editor, and a reader. Once a user writes a letter using the editor portion, then tests it by using the reader portion, I want the user to be able to save his/her letter as an exe that will run and display the letter using my reader routine. I have no idea how to make my program save part of itself (including a buffer with the letter) into a exe program that will run. I did it once in dos6.1 with a .com file, worked no problem, but how do i save it as a working exe file? Any help would be appreciated, examples always a bonus.

Thanks in advance
Posted on 2002-04-07 15:03:56 by SirDan
writing a separate reader program, including it as a resource, extracting it to disk during runtime and appending the actual data to it seems to be the easiest solution to me :)
Posted on 2002-04-07 15:21:15 by Tola
You could it append to the end of an .exe file and make the exe read itself.. Windows doesn't seem to care about additional data behind the normal PE stuff. If you want to be on the safe side you may want to change the physical and virtual size of the last section in the PE header.. For more info see www.wotsit.org and Iczelion's PE tutorials.

Posted on 2002-04-07 15:31:45 by Thomas

Depending on the size of the file you wish to write, there is a tool in MASM32 called BIN2DB.EXE that will convert a binary file to DB format which you can write to disk.

If the file is very large, appending it works well and you can read the file as both Thomas and Tola have mentioned.


Posted on 2002-04-07 17:20:54 by hutch--