Meta dll finished updating
Also, a log is written of all users that have updated, just so we can check.
If the user agrees, I get the new version, save it as s different filename, run an "updater" application (as the program executable file is locked while the program is running) and terminate the current program (remember this is before the program created its main form): if Message Dlg ( 'A new version of YYY is available. mt Confirmation, mb Yes No, 0) = id Yes then begin // download new version filestream := TFile Stream. How to you mange automatic updates of Delphi programs? We has some trouble with Vista's UAC, but solved that by letting the updater execute itself with elevated rights, this way you keep the primary token, which helps somehow (I forgot what it meant actually). Users start this program, and as soon as it discovers that a new version is available, it will update the main program before executing it.This way I can perform more operations in the updater.You dont need to execute an external program to update the current exe file.Windows will count them as no longer in use, so all overwrites are working.I'm using this procedure in application with 6 additional DLLs and it proves working over a year and a half. We use a similar setup to deploy our application, except that the initial downloaded file is an xml file with all the metadata we need to decide to update the file.We used a service or another executable to detect upgrades, download them and then launch the installer, that took care of detecting running applications and locked shared files, now we're using our install tool update feature.
I wrote an article for the UK Bug magazine several years ago that used a similar strategy.
You can rename a running program, and that way "override" the exe file name.
(The same with dll's) And if you have updated the exe file, you just restart the program.
Terminate; end; The Update YYY program is a non visual program that waits a little time (for the main program to actually terminate), copies the current executable to a backup file, moves the _update version in place, and executes the new main program.
This pre-loader also checks and updates some dll's and templates in the users profile.
- Create Process: the updater needs to be created with Create Process because the process handle of the newly created process is required by Duplicate Handle.