Click to See Complete Forum and Search --> : how to unlock the file


Grykar
November 20th, 2007, 09:47 AM
Hi,

I am looking for method how to unlock the locked file.

e.g
I run the program lolo.exe. The program is modifing itself but cannot due to file lolo.exe is locked.
As temporary solution I move the lolo.exe file to temporary directory then create copy of lolo.exe in old location (from where the lolo.exe has been started), of course copy of lolo.exe can be modify because of is not locked.

The temporary solution doesn't work on all machines don't know why therefore looking for more professional solution.

Thanks for further help
Karol

Marc G
November 20th, 2007, 10:17 AM
You are probably thinking about some kind of patching system.
The best way is to let lolo.exe launch another application for example patcher.exe and then terminate itself. The patcher.exe should wait untill lolo.exe has really terminated and then patcher.exe can write to lolo.exe. After that patcher.exe could relaunch lolo and terminate itself.

Grykar
November 20th, 2007, 10:42 AM
Marc G,

I thought about this solution but the program I develop has to consist of only one file.

Grykar

Marc G
November 21st, 2007, 04:16 AM
Why?
A possible solution might be then to put the updater.exe as a resource in the lolo.exe. When you need to update, you extract the updated.exe from the resource, save it to a temporary directory and launch it.