[Interest] [Development] Issues with latest Qt MaintenanceTool and Kaspersky

Julien Cugnière julien.cugniere at gmail.com
Wed May 4 09:21:15 CEST 2022

Le mer. 4 mai 2022 à 08:44, Kai Köhne <Kai.Koehne at qt.io> a écrit :
> They are not _included_ in the MaintenanceTool package. Anyhow, "deferredrenameXXXXXX.vbs”are temporary files the MaintenaceTool.exe writes to schedule an update of itself. That is, because on Windows an executable cannot be replaced when it is running, the MaintenanceTool.exe
> Saves the new MaintenanceTool.exe in parallel
> Writes above .vbs file, and starts it
> Stops itself
> The .vbs script will then every second try to replace the original .exe file, and – after being successful – restarting the MaintenanceTool.


Is there a reason to be using a vbs file ? In windows a running
executable cannot replace itself, but it can rename itself. The way
I've done it in the past is:

* The running executable renames itself.
* It then creates the new executable with the correct name.
* Just before returning from main, it starts the new executable (there
is a short window of time where both the old and new one can be
running, but it doesn't matter if the old one is not using any
resources any more ; if need be, the new one can be given a flag to
wait for the old one to exit).

I find it simpler, and much less likely to trigger an antivirus than a
vbs file :)

Julien Cugnière

More information about the Interest mailing list