TWebUpdate - Files successfully downloaded, but old EXE is started.

Hi,

I have a situation I where the TWebUpdate successfully download all (3) required files for an update of a vcl application of mine, but when application is restarted it is the old EXE that is started.

I'm not sure this could have an effect, or be the reason I see the issue I'm seeing, but due to IT security settings on our company's side, I have already done this:

  1. Excluded {$DEFINE USEUAC} in WUpdate.pas.
  2. I start the update with -> [TWebUpdate].DoUpdate(true);
  3. I've assigned [TWebUpdate].UseWinTempDir := false;
  4. I've assigned [TWebUpdate].TempDirectory := '{MyExeDir}\Temp';

How I reproduce the issue on my side:

  1. Install version 0.9.0.13 on my local machine.
  2. Make version 0.9.0.14 available on my server with this *.inf file:
[update]
newversion=0.9.0.14
localversion=LongHorn.exe

[files]
count=3

[file1]
url=http://tdwos/AppUpdates/LongHorn/LongHorn.db
targetdir={APP}

[file2]
url=http://tdwos/AppUpdates/LongHorn/LongHorn-WhatsNew.txt
targetdir={APP}

[file3]
url=http://tdwos/AppUpdates/LongHorn/LongHorn.exe_NEW
localversion=LongHorn.exe

[application]
appupdate=1
appname=LongHorn.exe
appcomps=LongHorn.exe_NEW
  1. I run version 0.9.0.13 and request an update, I see all 3 files downloaded as expected. BUT in the main directory of my application {MyExeDir} I see that the *.EXE file (Longhorn.exe) is still the revision 0.9.0.13. In the same directory I also see the *.EXE_NEW (Longhorn.exe_NEW), and that is revision 0.9.0.14. So when application starts again it's the old file being executed.
    The other two files *.db & *.txt are correctly the version bewlonging to the new (0.9.0.14) revision.

Here is a clean logfile of the process:

18.11.2025 10:55:34 : [918] Checking for Internet connection (Status:3) (Error:0)
18.11.2025 10:55:34 : [921] Found open Internet connection (Status:3) (Error:0)
18.11.2025 10:55:34 : [915] Download : http://tdwos/AppUpdates/LongHorn.inf (Status:3) (Error:0)
18.11.2025 10:55:35 : [926] Update control file found (Status:3) (Error:0)
18.11.2025 10:55:35 : [933] Version based update found (Status:3) (Error:0)
18.11.2025 10:55:35 : [979] Check versions (Status:3) (Error:0)
18.11.2025 10:55:35 : [944] Version check : Version compare of LongHorn.exe:0.9.0.13 with 0.9.0.14:0.9.0.14 (Status:3) (Error:0)
18.11.2025 10:55:35 : [929] New version found : 0.9.0.14 (Status:5) (Error:0)
18.11.2025 10:55:35 : [949] Closed Internet connection (Status:3) (Error:0)
18.11.2025 10:55:35 : [949] Closed Internet connection (Status:3) (Error:0)
18.11.2025 10:55:41 : [968] Start update : Non threaded update --------------------------- (Status:0) (Error:0)
18.11.2025 10:55:41 : [966] OS version : Unknown (Status:0) (Error:0)
18.11.2025 10:55:41 : [967] IE version : (not found) (Status:0) (Error:0)
18.11.2025 10:55:41 : [969] Compiler :  (Status:0) (Error:0)
18.11.2025 10:55:41 : [970] Installed IDEs :  (Status:0) (Error:0)
18.11.2025 10:55:41 : [963] Start WebUpdate process with version : 2.6.5.1 (Status:0) (Error:0)
18.11.2025 10:55:41 : [918] Checking for Internet connection (Status:3) (Error:0)
18.11.2025 10:55:41 : [921] Found open Internet connection (Status:3) (Error:0)
18.11.2025 10:55:41 : [915] Download : http://tdwos/AppUpdates/LongHorn.inf (Status:3) (Error:0)
18.11.2025 10:55:41 : [926] Update control file found (Status:3) (Error:0)
18.11.2025 10:55:41 : [933] Version based update found (Status:3) (Error:0)
18.11.2025 10:55:41 : [979] Check versions (Status:3) (Error:0)
18.11.2025 10:55:41 : [944] Version check : Version compare of LongHorn.exe:0.9.0.13 with 0.9.0.14:0.9.0.14 (Status:3) (Error:0)
18.11.2025 10:55:41 : [929] New version found : 0.9.0.14 (Status:5) (Error:0)
18.11.2025 10:55:41 : [943] Found file update instruction (Status:3) (Error:0)
18.11.2025 10:55:41 : [971] Processing file : http://tdwos/AppUpdates/LongHorn/LongHorn.db[,nv=,nd=,ns=0,nc=-1] (Status:0) (Error:0)
18.11.2025 10:55:41 : [979] Check versions (Status:3) (Error:0)
18.11.2025 10:55:41 : [971] Processing file : http://tdwos/AppUpdates/LongHorn/LongHorn-WhatsNew.txt[,nv=,nd=,ns=0,nc=-1] (Status:0) (Error:0)
18.11.2025 10:55:41 : [979] Check versions (Status:3) (Error:0)
18.11.2025 10:55:41 : [971] Processing file : http://tdwos/AppUpdates/LongHorn/LongHorn.exe_NEW[LongHorn.exe,nv=,nd=,ns=0,nc=-1] (Status:0) (Error:0)
18.11.2025 10:55:41 : [979] Check versions (Status:3) (Error:0)
18.11.2025 10:55:43 : [915] Download : http://tdwos/AppUpdates/LongHorn/LongHorn.db (Status:3) (Error:0)
18.11.2025 10:55:43 : [915] Download : http://tdwos/AppUpdates/LongHorn/LongHorn-WhatsNew.txt (Status:3) (Error:0)
18.11.2025 10:55:43 : [915] Download : http://tdwos/AppUpdates/LongHorn/LongHorn.exe_NEW (Status:3) (Error:0)
18.11.2025 10:55:44 : [962] Found application component : LongHorn.exe_NEW (Status:0) (Error:0)
18.11.2025 10:55:44 : [948] Finished processing update control file (Status:3) (Error:0)
18.11.2025 10:55:44 : [949] Closed Internet connection (Status:3) (Error:0)
18.11.2025 10:55:44 : [949] Closed Internet connection (Status:3) (Error:0)
18.11.2025 10:55:44 : [959] Restart app in directory : C:\TDWOS Software\LongHorn (Status:0) (Error:0)
18.11.2025 10:55:44 : [958] Spawn 48908 L "C:\TDWOS Software\LongHorn\LongHorn.exe" " " "C:\TDWOS Software\LongHorn\Temp" LongHorn.exe_NEW (Status:0) (Error:0)
18.11.2025 10:55:49 : [000] UPD v2.0.4.1 started
18.11.2025 10:55:49 : [000] UPD current directory: C:\TDWOS Software\LongHorn
18.11.2025 10:55:49 : [000] UPD waited from 18.11.2025 10:55:48:108 to 18.11.2025 10:55:48:482 for application close
18.11.2025 10:55:49 : [000] UPD restart C:\TDWOS Software\LongHorn\LongHorn.exe  
18.11.2025 10:55:49 : [000] UPD has EXE restarted

Can I please ask why my old EXE is started rather than the new downloaded one?

Thank you in advance!

Regards,
Leif Eirik

Can it be something is delaying / upholding closing the application?
I see UPD.EXE waited for closing the running app and it might have been unsuccesful?
Try to force an immediate close of the app from the TWebUpdate.OnAppDoClose event.

I have now tried to put the following 2 tests in the code for both the 0.9.0.13 and 0.9.0.14:
TEST #1:

procedure TfrmMain.wupMainAppDoClose(Sender: TObject);
begin
  Application.Terminate;
end;

TEST #2:

procedure TfrmMain.wupMainAppDoClose(Sender: TObject);
begin
  Halt;
end;

TEST #1 It did not help unfortunately, and here is the WUPDATE.LOG of the process:

18.11.2025 12:32:33 : [918] Checking for Internet connection (Status:3) (Error:0)
18.11.2025 12:32:33 : [921] Found open Internet connection (Status:3) (Error:0)
18.11.2025 12:32:33 : [915] Download : http://tdwos/AppUpdates/LongHorn.inf (Status:3) (Error:0)
18.11.2025 12:32:33 : [926] Update control file found (Status:3) (Error:0)
18.11.2025 12:32:33 : [933] Version based update found (Status:3) (Error:0)
18.11.2025 12:32:33 : [979] Check versions (Status:3) (Error:0)
18.11.2025 12:32:33 : [944] Version check : Version compare of LongHorn.exe:0.9.0.13 with 0.9.0.14:0.9.0.14 (Status:3) (Error:0)
18.11.2025 12:32:33 : [929] New version found : 0.9.0.14 (Status:5) (Error:0)
18.11.2025 12:32:33 : [949] Closed Internet connection (Status:3) (Error:0)
18.11.2025 12:32:33 : [949] Closed Internet connection (Status:3) (Error:0)
18.11.2025 12:32:36 : [968] Start update : Non threaded update --------------------------- (Status:0) (Error:0)
18.11.2025 12:32:36 : [966] OS version : Unknown (Status:0) (Error:0)
18.11.2025 12:32:36 : [967] IE version : (not found) (Status:0) (Error:0)
18.11.2025 12:32:36 : [969] Compiler :  (Status:0) (Error:0)
18.11.2025 12:32:36 : [970] Installed IDEs :  (Status:0) (Error:0)
18.11.2025 12:32:36 : [963] Start WebUpdate process with version : 2.6.5.1 (Status:0) (Error:0)
18.11.2025 12:32:36 : [918] Checking for Internet connection (Status:3) (Error:0)
18.11.2025 12:32:36 : [921] Found open Internet connection (Status:3) (Error:0)
18.11.2025 12:32:36 : [915] Download : http://tdwos/AppUpdates/LongHorn.inf (Status:3) (Error:0)
18.11.2025 12:32:36 : [926] Update control file found (Status:3) (Error:0)
18.11.2025 12:32:36 : [933] Version based update found (Status:3) (Error:0)
18.11.2025 12:32:36 : [979] Check versions (Status:3) (Error:0)
18.11.2025 12:32:36 : [944] Version check : Version compare of LongHorn.exe:0.9.0.13 with 0.9.0.14:0.9.0.14 (Status:3) (Error:0)
18.11.2025 12:32:36 : [929] New version found : 0.9.0.14 (Status:5) (Error:0)
18.11.2025 12:32:36 : [943] Found file update instruction (Status:3) (Error:0)
18.11.2025 12:32:36 : [971] Processing file : http://tdwos/AppUpdates/LongHorn/LongHorn.db[,nv=,nd=,ns=0,nc=-1] (Status:0) (Error:0)
18.11.2025 12:32:36 : [979] Check versions (Status:3) (Error:0)
18.11.2025 12:32:36 : [971] Processing file : http://tdwos/AppUpdates/LongHorn/LongHorn-WhatsNew.txt[,nv=,nd=,ns=0,nc=-1] (Status:0) (Error:0)
18.11.2025 12:32:36 : [979] Check versions (Status:3) (Error:0)
18.11.2025 12:32:36 : [971] Processing file : http://tdwos/AppUpdates/LongHorn/LongHorn.exe_NEW[LongHorn.exe,nv=,nd=,ns=0,nc=-1] (Status:0) (Error:0)
18.11.2025 12:32:36 : [979] Check versions (Status:3) (Error:0)
18.11.2025 12:32:38 : [915] Download : http://tdwos/AppUpdates/LongHorn/LongHorn.db (Status:3) (Error:0)
18.11.2025 12:32:38 : [915] Download : http://tdwos/AppUpdates/LongHorn/LongHorn-WhatsNew.txt (Status:3) (Error:0)
18.11.2025 12:32:38 : [915] Download : http://tdwos/AppUpdates/LongHorn/LongHorn.exe_NEW (Status:3) (Error:0)
18.11.2025 12:32:39 : [962] Found application component : LongHorn.exe_NEW (Status:0) (Error:0)
18.11.2025 12:32:39 : [948] Finished processing update control file (Status:3) (Error:0)
18.11.2025 12:32:39 : [949] Closed Internet connection (Status:3) (Error:0)
18.11.2025 12:32:39 : [949] Closed Internet connection (Status:3) (Error:0)
18.11.2025 12:32:39 : [959] Restart app in directory : C:\TDWOS Software\LongHorn (Status:0) (Error:0)
18.11.2025 12:32:39 : [958] Spawn 17280 L "C:\TDWOS Software\LongHorn\LongHorn.exe" " " "C:\TDWOS Software\LongHorn\Temp" LongHorn.exe_NEW (Status:0) (Error:0)
18.11.2025 12:32:44 : [000] UPD v2.0.4.1 started
18.11.2025 12:32:44 : [000] UPD current directory: C:\TDWOS Software\LongHorn
18.11.2025 12:32:44 : [000] UPD waited from 18.11.2025 12:32:43:548 to 18.11.2025 12:32:44:163 for application close
18.11.2025 12:32:44 : [000] UPD restart C:\TDWOS Software\LongHorn\LongHorn.exe  
18.11.2025 12:32:45 : [000] UPD has EXE restarted

TEST #2 It did also not help unfortunately, and here is the WUPDATE.LOG of that process:

18.11.2025 12:41:49 : [918] Checking for Internet connection (Status:3) (Error:0)
18.11.2025 12:41:49 : [921] Found open Internet connection (Status:3) (Error:0)
18.11.2025 12:41:49 : [915] Download : http://tdwos/AppUpdates/LongHorn.inf (Status:3) (Error:0)
18.11.2025 12:41:49 : [926] Update control file found (Status:3) (Error:0)
18.11.2025 12:41:49 : [933] Version based update found (Status:3) (Error:0)
18.11.2025 12:41:49 : [979] Check versions (Status:3) (Error:0)
18.11.2025 12:41:49 : [944] Version check : Version compare of LongHorn.exe:0.9.0.13 with 0.9.0.14:0.9.0.14 (Status:3) (Error:0)
18.11.2025 12:41:49 : [929] New version found : 0.9.0.14 (Status:5) (Error:0)
18.11.2025 12:41:49 : [949] Closed Internet connection (Status:3) (Error:0)
18.11.2025 12:41:49 : [949] Closed Internet connection (Status:3) (Error:0)
18.11.2025 12:41:51 : [968] Start update : Non threaded update --------------------------- (Status:0) (Error:0)
18.11.2025 12:41:51 : [966] OS version : Unknown (Status:0) (Error:0)
18.11.2025 12:41:51 : [967] IE version : (not found) (Status:0) (Error:0)
18.11.2025 12:41:51 : [969] Compiler :  (Status:0) (Error:0)
18.11.2025 12:41:51 : [970] Installed IDEs :  (Status:0) (Error:0)
18.11.2025 12:41:51 : [963] Start WebUpdate process with version : 2.6.5.1 (Status:0) (Error:0)
18.11.2025 12:41:51 : [918] Checking for Internet connection (Status:3) (Error:0)
18.11.2025 12:41:51 : [921] Found open Internet connection (Status:3) (Error:0)
18.11.2025 12:41:51 : [915] Download : http://tdwos/AppUpdates/LongHorn.inf (Status:3) (Error:0)
18.11.2025 12:41:51 : [926] Update control file found (Status:3) (Error:0)
18.11.2025 12:41:51 : [933] Version based update found (Status:3) (Error:0)
18.11.2025 12:41:51 : [979] Check versions (Status:3) (Error:0)
18.11.2025 12:41:51 : [944] Version check : Version compare of LongHorn.exe:0.9.0.13 with 0.9.0.14:0.9.0.14 (Status:3) (Error:0)
18.11.2025 12:41:51 : [929] New version found : 0.9.0.14 (Status:5) (Error:0)
18.11.2025 12:41:51 : [943] Found file update instruction (Status:3) (Error:0)
18.11.2025 12:41:51 : [971] Processing file : http://tdwos/AppUpdates/LongHorn/LongHorn.db[,nv=,nd=,ns=0,nc=-1] (Status:0) (Error:0)
18.11.2025 12:41:51 : [979] Check versions (Status:3) (Error:0)
18.11.2025 12:41:51 : [971] Processing file : http://tdwos/AppUpdates/LongHorn/LongHorn-WhatsNew.txt[,nv=,nd=,ns=0,nc=-1] (Status:0) (Error:0)
18.11.2025 12:41:51 : [979] Check versions (Status:3) (Error:0)
18.11.2025 12:41:51 : [971] Processing file : http://tdwos/AppUpdates/LongHorn/LongHorn.exe_NEW[LongHorn.exe,nv=,nd=,ns=0,nc=-1] (Status:0) (Error:0)
18.11.2025 12:41:51 : [979] Check versions (Status:3) (Error:0)
18.11.2025 12:41:53 : [915] Download : http://tdwos/AppUpdates/LongHorn/LongHorn.db (Status:3) (Error:0)
18.11.2025 12:41:53 : [915] Download : http://tdwos/AppUpdates/LongHorn/LongHorn-WhatsNew.txt (Status:3) (Error:0)
18.11.2025 12:41:53 : [915] Download : http://tdwos/AppUpdates/LongHorn/LongHorn.exe_NEW (Status:3) (Error:0)
18.11.2025 12:41:54 : [962] Found application component : LongHorn.exe_NEW (Status:0) (Error:0)
18.11.2025 12:41:54 : [948] Finished processing update control file (Status:3) (Error:0)
18.11.2025 12:41:54 : [949] Closed Internet connection (Status:3) (Error:0)
18.11.2025 12:41:54 : [949] Closed Internet connection (Status:3) (Error:0)
18.11.2025 12:41:54 : [959] Restart app in directory : C:\TDWOS Software\LongHorn (Status:0) (Error:0)
18.11.2025 12:41:54 : [958] Spawn 14968 L "C:\TDWOS Software\LongHorn\LongHorn.exe" " " "C:\TDWOS Software\LongHorn\Temp" LongHorn.exe_NEW (Status:0) (Error:0)
18.11.2025 12:42:23 : [000] UPD v2.0.4.1 started
18.11.2025 12:42:23 : [000] UPD current directory: C:\TDWOS Software\LongHorn
18.11.2025 12:42:23 : [000] UPD waited from 18.11.2025 12:42:23:199 to 18.11.2025 12:42:23:325 for application close
18.11.2025 12:42:24 : [000] UPD restart C:\TDWOS Software\LongHorn\LongHorn.exe  
18.11.2025 12:42:24 : [000] UPD has EXE restarted

PS. During the update I do get this dialog:

I just press the "Yes" and accept and it does not give me any errors.

So I'm still not sure what is causing this. Any hints or help greatly appriciated.

Does the file

C:\TDWOS Software\LongHorn\Temp\LongHorn.exe_NEW

exist?

This is also the folder I would expect is set to
TWebUpdate.TempDirectory

No, the file: C:\TDWOS Software\LongHorn\Temp\LongHorn.exe_NEW does not exist here.

It is (now?) located in: C:\TDWOS Software\LongHorn\LongHorn.exe_NEW

My Temp directory is set like this:

  // LEO: Make sure we have a "Temp" directory for server updates. Set TWebUpdate component
  //                 to use this "Temp" folder
  var lTempDir := GetClientTempDirectory(TPath.GetDirectoryName(Application.ExeName));
  if not TDirectory.Exists(lTempDir) then
    TDirectory.CreateDirectory(lTempDir);
  wupMain.UseWinTempDir := false;
  wupMain.TempDirectory := lTempDir;

And I have confirmed that the lTempDir is assigned:
C:\TDWOS Software\LongHorn\Temp

Hi Bruno,

Is it the case that once TWebUpdate gets the *.INF file from the server, it stores this file locally with the name "Temp" (no extention) ?

If that is the case I suspect that might be what causes my issue(s). I'll have to leave the office for today, but I will test more tomorrow.

Have good day all...

Try

If your temp dir is set to C:\TDWOS Software\LongHorn\Temp
you'll need to make sure the file is downloaded to this temp folder.
Try to do this with:

[file3]
url=http://tdwos/AppUpdates/LongHorn/LongHorn.exe_NEW
targetdir={app}\temp