Re: self modifying exe

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Tim Robinson (tim.at.gaat.freeserve.co.uk_at_invalid.com)
Date: 06/23/04


Date: Wed, 23 Jun 2004 19:49:16 +0100

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/


Relevant Pages

  • Re: ListView-style column headers?
    ... writing from scratch (or modifying a CodeProject component) is probably ... articles on CodeProject on how to do this. ... Writing a Treeview/Listview control from scratch is not a trivial task. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Write to executable which has done execve
    ... and try to open old file for writing in new ... You cannot modify a program's running image ... So if modifying the program file was allowed, ...
    (comp.unix.programmer)
  • RE: vb.net - datagrids inserting records
    ... modifying the generated code, we have to create the DataAdapter by writing ... Prev by Date: ...
    (microsoft.public.data.ado)
  • Re: self modifying exe
    ... i want it be modifying itself and writing back changes to disk. ... >> can anyone help me writing self modifying exe??? ...
    (microsoft.public.vc.language)