Hola sonjeux.
Ampliando el caso de
FileExists, se puede encapsular la detección del SO en una función para que trabaje en Win32 y Win64:
Código Delphi
[-]
function FileExistsExt(aFileName: TFileName): Boolean;
type
LPFN_ISWOW64PROCESS = function(hProcess: THandle; var Wow64Proc: BOOL): BOOL; stdcall;
var
fnIsWow64Proc: LPFN_ISWOW64PROCESS;
IsWow64: BOOL;
begin
fnIsWow64Proc:= LPFN_ISWOW64PROCESS(GetProcAddress(GetModuleHandle('kernel32'), 'IsWow64Process'));
if Assigned(fnIsWow64Proc) then
fnIsWow64Proc(GetCurrentProcess(), IsWow64);
if IsWow64 then
Result:= FileExists(StringReplace(aFileName, 'System32', 'Sysnative', [rfIgnoreCase]))
else
Result:= FileExists(aFileName);
end;
Saludos