Delete exe while application running ?

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
armink
Experienced Solver
Experienced Solver
Posts: 79
Joined: Tue Aug 31, 2004 10:25 am
Location: Bavaria / Germany

Delete exe while application running ?

Post by armink » Fri Apr 01, 2005 12:24 pm

MayBe this is a silly question ... but is it possible to compile an Application whose exe file may be deleted or overwritten while it is started ? :oops:

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Fri Apr 01, 2005 12:58 pm

Well it's not so silly. Like an installer or something ?

- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

armink
Experienced Solver
Experienced Solver
Posts: 79
Joined: Tue Aug 31, 2004 10:25 am
Location: Bavaria / Germany

Post by armink » Fri Apr 01, 2005 1:06 pm

Just copy e.g.

c:\f.exe to z:\f.exe while somebody has started it from z:\

Cause some people start the App from Z:\ via desktop links while I'm improving the Application locally. When I'm ready with compiling I want to copy the exe to the net location, but when somebody has started it, I get the message " bla .. not possible ...".

Thats the background ...

Avi
Super wx Problem Solver
Super wx Problem Solver
Posts: 398
Joined: Mon Aug 30, 2004 9:27 pm
Location: Tel-Aviv, Israel

Post by Avi » Fri Apr 01, 2005 3:45 pm

That's actually a nice question... I thought about it and I think I got a solution.
Make the application check if it's being running from the Windows temp dir... If not, copy the executable file to the temp dir, tell the system to execute it, and then shut down the original .exe...

For example, you have MyProgram.exe in z:\.
1. Somebody on the network launches MyProgram.exe from his computer.
2. MyProgram.exe checks and finds out it is not being ran from the Windows temp dir. It copies itself into the temp dir as TempProgram.exe (overwriting any .exe already there).
3. MyProgram.exe executes TempProgram.exe in a non-blocking manner (not as a "sub-proccess").
4. MyProgram.exe shuts down.
5. TempProgram.exe is running (it found out it is running from the Temp dir) until it shuts down (and deletes itself).

Heh, Yes, I'm bored. :) Brainstorm here, or tell me how can one do it easier...

Btw, can't you just give more limited premissions on your network (not allow anyone to lock files, etc.)?

armink
Experienced Solver
Experienced Solver
Posts: 79
Joined: Tue Aug 31, 2004 10:25 am
Location: Bavaria / Germany

Post by armink » Sun Apr 03, 2005 11:55 am

Nice and good Idea, I' ll try it out next week and post results.

Thanx and nice week end ! :)

Post Reply