Tim
Wed Jun 23 13:49:16 CDT 2004
Farooq Khan wrote:
> well, i want it be modifying itself and writing back changes to disk.
> let me tell what this application be doing exactly.
> this applcation would be writing application exit time somewhere in
> it and reading it afterwards when it is launched again to do some
> calculation. i cannot go for registry or any other thing.
> thanks.
Self-modifying EXEs don't work because Windows itself locks the EXE file.
You won't be able to open the file for write access while the EXE is
running.
Modifying EXEs in general usually won't work because ordinary users don't
have write access to the Program Files directory.
In any case, what do you intend to do if more than one user uses your
application? With your scheme, they will overwrite each others' changes.
--
Tim Robinson (MVP, Windows SDK)
http://mobius.sourceforge.net/