![]() |
FileExists und Vista 64 Bit funktioniert nicht ?
Hallo,
ich teste gerade Delphi 2009 auf Vista 64 Bit und habe ein kleines Problem festgestellt. Delphi und Vista sind auf dem aktuellen Stand. Wenn ich die Funktion FileExists() in einem Windows Ordner benutze gibt sie immer False zurrück. z.B.:
Delphi-Quellcode:
Die Datei existiert natürlich !
procedure TForm1.Button1Click(Sender: TObject);
begin if FileExists('C:\windows\system32\drivers\kbdclass.sys') then ShowMessage('ok'); end; In anderen Ordnern funktioniert es normal. Was ist da das Problem und wie umgehe ich das ? |
Re: FileExists und Vista 64 Bit funktioniert nicht ?
Zitat:
|
Re: FileExists und Vista 64 Bit funktioniert nicht ?
Hilft leider nichts ... gleiches Problem.
|
Re: FileExists und Vista 64 Bit funktioniert nicht ?
Hatte heute ein ganz ähnliches Phänomen: Ich hätte einen Treiber in einem Open-Dialog auswählen sollen - aber da waren keine, obwohl natürlich im Verzeichnis vorhanden :gruebel:
|
Re: FileExists und Vista 64 Bit funktioniert nicht ?
So ... ich habe es jetzt mal so gelöst ...
Delphi-Quellcode:
Es liegt wohl an der "File system redirection" von 64 Bit Systemen, die im System32 Ordner und anderen aktiv ist.
function FileExists64NoRedirection(Filename: string): Boolean;
type TWow64DisableWow64FsRedirection = function(var Wow64FsEnableRedirection: LongBool): LongBool; StdCall; TWow64RevertWow64FsRedirection = function(var Wow64FsEnableRedirection: LongBool): LongBool; StdCall; var hHandle: THandle; Wow64DisableWow64FsRedirection: TWow64DisableWow64FsRedirection; Wow64RevertWow64FsRedirection: TWow64RevertWow64FsRedirection; Wow64FsEnableRedirection: LongBool; Is64BitWin: boolean; begin Is64BitWin := False; Wow64DisableWow64FsRedirection := nil; Wow64RevertWow64FsRedirection := nil; try hHandle := GetModuleHandle('kernel32.dll'); @Wow64RevertWow64FsRedirection := GetProcAddress(hHandle, 'Wow64RevertWow64FsRedirection'); @Wow64DisableWow64FsRedirection := GetProcAddress(hHandle, 'Wow64DisableWow64FsRedirection'); if ((hHandle <> 0) and (@Wow64RevertWow64FsRedirection <> nil) and (@Wow64DisableWow64FsRedirection <> nil)) then Is64BitWin := True; except Is64BitWin := False; end; if Is64BitWin then begin Wow64DisableWow64FsRedirection(Wow64FsEnableRedirection); Result := FileExists(Filename); Wow64RevertWow64FsRedirection(Wow64FsEnableRedirection); end else Result := FileExists(Filename); end; Aber irgendwie denke ich, das CG das mal etwas anpassen sollte. Ich bin noch für andere Lösungen offen. |
Re: FileExists und Vista 64 Bit funktioniert nicht ?
Vll. das hier:
Zitat:
![]() |
Re: FileExists und Vista 64 Bit funktioniert nicht ?
Zitat:
|
Re: FileExists und Vista 64 Bit funktioniert nicht ?
Vista leitet diesen Zugriff auf das Wow64 (oder so ähnlich) Verzeichnis um. Darin sind die 32bit Dateien.
|
Re: FileExists und Vista 64 Bit funktioniert nicht ?
Zitat:
|
Re: FileExists und Vista 64 Bit funktioniert nicht ?
Vielleicht schaltet der Dialog das Umleiten aus? Oder hast du es ausgeschaltet? Oder du wurdest einfach reingelegt? :-D
Erzeuge doch mal mit dem Explorer eine Datei im echten 64bit Ordner und versuche sie zu finden mit nem 32bit Prog. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:39 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz