Delphi: Support Windows XP in Delphi 11

Issue #1: PE Headers

Set OS Version fields in PE Headers” and “Set SubSystem Version fields in PE Headers” to “5.1”.

More information about Windows Versions and PE Headers

Issue #2: GetTickCount64

GetTickCount vs GetTickCount64

Unless your application uses System.Threading.pas (TTask etc) you should run it under Windows XP with no problems. But if so, then you have to tweak this unit.
Threading objects actually use in their internals new TThread.GetTickCount64 method, which is hardwired to Windows API GetTickCount64 which is not available in Windows XP API.
Take this unit from “source\rtl\common” folder in Delphi 11 installation. Declare new local function in the beginning of implementation section of this unit like this:

function _GetTickCount64: UInt64;
begin
  if TOSVersion.Major<6 then
    Result :=  TThread.GetTickCount
  else
    Result :=  TThread.GetTickCount64;
end;

and replace all occurrences of TThread.GetTickCount64 calls with _GetTickCount64.

For Win32 applications then copy this modified unit to \lib\win32\debug and \lib\win32\release folders in Delphi 11 installation and rename original System.Threading.dcu to e.g. _System.Threading.dcu.

Then build your project which uses System.Threading with Debug and Release configuration. New System.Threading.dcu should be created in mentioned folders. After this you should remove modified System.Threading.pas from these folders to prevent its recurrent compilation.

Now your Delphi 11 Win32 applications should run under Windows XP with no External Exception crash.

Source: https://en.delphipraxis.net/topic/5536-delphi-11-windows-xp-compatibility-tweak/

Leave a comment