hi,
long,long time ago i made a simply program where the user can make his own MessageBoxe with. :)
there i am using a "prototype" exe with fixed vars (for example the messagetext is a variable with fixed size about 6000 bytes)
to make an exe my prog opens the "prototype" and writes the message at the fixed adress of this variable.
http://www.cdw.de.vu/MessageBoxCreator.zip

Now i am playing around with dynamical exes:
puting my message at the end of the "prototyp.exe" i want to load the "hole" exe in the virtual adress space:
my masm (by a radasm projekt) generated exe have as last section the .rscr, so i change(at the moment with a hexeditor) the
rawsize of this section to the new exe-size (to load the hole exe in my memory)
i know that the virtual adress of the rscr section is 404000 and the size of this section is 800h
so i load the message at fixed adress 404800h - and it works on my win2k SP3 and winxpSP1
but i don't have win 9.x to test it with so i ask: woul it work there without problems and should i change the virtulsize of the .rscr too?


IMAGE_SECTION_HEADER STRUCT
Name1 db IMAGE_SIZEOF_SHORT_NAME dup(?)
union Misc
PhysicalAddress dd ?
VirtualSize dd ? <= here?
ends
VirtualAddress dd ?
SizeOfRawData dd ? <= and here
PointerToRawData dd ?
PointerToRelocations dd ?
PointerToLinenumbers dd ?
NumberOfRelocations dw ?
NumberOfLinenumbers dw ?
Characteristics dd ?
IMAGE_SECTION_HEADER ENDS
Posted on 2004-02-22 13:13:57 by CDW
This will work under 9x as well as nt/2k/xp
The correct way to do it is to add the number of bytes added to the file to the last section's size of raw data and then round this value up to the value of file allignment, then round the new size of raw data up to the value of section allignment and finnally update the value of SizeOfImage.
Posted on 2004-02-22 17:54:00 by ENF
Do update VirtualSize too (rounded up to peheader.memalign), just to be a good boy.
Posted on 2004-02-22 18:54:39 by f0dder
ok, thats what i wanted to know, thx @all
PS: i will be a good boy :grin:
Posted on 2004-02-23 07:31:49 by CDW