function GetFileAttributesExPreload(lpFileName: PChar; fInfoLevelId: TGetFileExInfoLevels;
lpFileInformation: Pointer): BOOL;
stdcall;
forward;
var
{ Diesen Funktion-Zeiger kann man nun aufrufen }
GetFileAttributesExFunc:
function(lpFileName: PChar; fInfoLevelId: TGetFileExInfoLevels;
lpFileInformation: Pointer): BOOL;
stdcall = GetFileAttributesExPreload;
{ Use FindFirstFile as an alternative on systems that do not support the GetFileAttributesEx }
function GetFileAttributesExEmulated(lpFileName: PChar; fInfoLevelId: TGetFileExInfoLevels;
lpFileInformation: Pointer): BOOL;
stdcall;
var
Handle: THandle;
FindData: TWin32FindData;
begin
Handle := FindFirstFile(lpFileName, FindData);
if Handle <> INVALID_HANDLE_VALUE
then
begin
Windows.FindClose(
Handle);
if lpFileInformation <>
nil then
begin
Move(FindData, lpFileInformation^, SizeOf(TWin32FileAttributeData));
Result := True;
Exit;
end;
end;
Result := False;
end;
function GetFileAttributesExPreload(lpFileName: PChar; fInfoLevelId: TGetFileExInfoLevels;
lpFileInformation: Pointer): BOOL;
stdcall;
begin
GetFileAttributesExFunc := GetProcAddress(GetModuleHandle(kernel32), '
GetFileAttributesExA');
if not Assigned(GetFileAttributesExFunc)
then
GetFileAttributesExFunc := GetFileAttributesExEmulated;
Result := GetFileAttributesExFunc(lpFileName, fInfoLevelId, lpFileInformation);
end;