i know this is an 2000's post but ..
yes you can write over an executable in the time is running.
there is a method very simple :
1.get the path of user's Temp folder(only if you try in Windows this)
2.run your executable
a1) create a copy of .exe in Temp
a2) put the timer over x position in .exe (write it over using seek ,low level buffer)
a3) on exit: create a .bat and run it with this commands:
line 1 : copy from Temp to over my original .exe
line 2: delete the Temp .exe because you don't need anymore
line 3: not a fantasy it's work - delete the .bat himself (in windows works)
well done ,now you know how to write over a .exe is running
to make sure that a hacker will not attack your Temp's exe with a patch or a crack make sure after the step a1 there another step a1a :"open the .exe Temp and keep it in read only for modify it from other programs" (an alternative to do this is to create a read only windows service that protect your .exe 's Temp sending commands using a server on localhost:port to allow you from original .exe to make modifies on the clone)
that all folks!
