Thanks everyone :) I think I've got enough info. for my project now..
Posted on 2002-07-17 18:08:48 by tehktik
found this thread by accident, take a look at:
www.cdw.de.vu
(MsgBoxCreator)
dont think to complex :)
i have a tmpfile (exefile) and an editprog, the user have to write his message down (until 6000 chars) and the editprog create a copy from the tmpfile and write the message down... it works with win2k/XP and 95/98
Posted on 2003-02-17 11:44:51 by CDW
I've made a program in Delphi that does what hutch and cdw have described.

My methodology was to use 2 programs. A configurator, and a program that does the work. The work program reads the end of the file for settings I stored. As hutch said you can store information at the end of a file and still have it run.

Your structure would be something like this:
Compiled Exe -> caption -> sizeof(caption) -> message -> sizeof(message) -> (maybe message box type) -> icon -> buttons -> magic number

storing as much in integers and using case statements really helps the situation. You know the exact byte count of the settings by using sizeof(integer) to know how many bytes the icon and buttons are, then you use the integer count of the strings so that you have the minimal amount of information possible.

You open the work file, usually a bare exe with no settings. You append settings in this order, then read from right to left. Start from the end, read the magic number. If the magic number exists (a constant in both programs) then there are settings. From there you move back sizeof(integer), read the buttons, move sizeof(integer) read the icon, move sizeof(integer) read the message size, move sizeof(message) read the message, move sizeof(integer) read caption size, move sizeof(caption) read the caption. Once the values are read you can do the rest.

At this point you are at the end of the settings. You can then copy the file from the start to this position, then append the settings onto this new file. This will eliminate the need to know the exact byte count of your program and code it into the program itself. Now when you add content to the work application, you don't need to mess with the settings at all.

I can produce delphi code if you think itll help. I don't know the asm equivalent and that's partly why I'm posting because I'd like to include this in a assembly project I'm doing for the delphi apps I programmed. In concept it was hard to figure out but its easy when you understand how it has to be structured. Let me know what you need and I'll try to help in any way I can
Jeremy
Posted on 2003-03-14 03:40:04 by Jeremy
I'm just a bit curious, how did you find the offsets of the Message Buffers?

invoke SendMessage,hEdit1,WM_GETTEXT,63,addr ExeTemplate+0840h
invoke SendMessage,hEdit2,WM_GETTEXT,63,addr ExeTemplate+0800h


many thanks!
Posted on 2003-04-11 22:21:01 by Drocon
IMHO, the best and most resuable way is to write to disk your own PE headers and code/data sections as required. This will be the most flexible for the variousl thing you may want to output. However, there is more overhead in design to do this.

What confuses me is, why?

You write to disk a stand alone exe, but what use is it? You can't directly modify it, and is not easily linked into a current program (ie, sharing windows handles between processes)??

:NaN:
Posted on 2003-04-13 10:13:43 by NaN
drocon, iirc I put a couple of bogus SetWindowText calls with the offsets of those two variables in the messagebox program. Then a disassembled listing showed me the info I needed. Some of my other posts showed my ignorance. I don't always know the right verbage, etc. Sorry if I confused anybody

nan, I discovered that very thing when coding a little patcher. I couldn't find a freeware patcher that could work with two different sized binaries. That certainly wasn't as easy as the messagebox example above, because I needed the flexibility of a dynamic sized .data section.
Posted on 2003-04-14 08:59:17 by Will
Think he wants to create something like Trainer Maker Kit that is like a Visualbasic trainer maker that outputs standalone EXE files (Which are friggin huge though)...
Posted on 2003-04-14 14:04:15 by SFP