[Lazarus] GetAllFilesMask / AllFilesMask
pascaldragon at googlemail.com
Wed May 1 15:17:25 CEST 2013
On 01.05.2013 14:45, Bart wrote:
> On 5/1/13, Jürgen Hestermann <juergen.hestermann at gmx.de> wrote:
>> But wasn't the original problem that AllFilesMask was wrong on Windows?
> Supplying either '*.*' or '*' to FindFirst() function on Windows will
> correctly list all files.
And I've now checked why this is the case:
If you look at the implementation of FindFirstFileExW (which is in the
end called by all other FindFirstFile* functions) in ReactOS (
) you'll see at line 822 the following code:
=== code begin ===
/* Change pattern: "*.*" --> "*" */
if (FilePattern.Length == 6 &&
RtlCompareMemory(FilePattern.Buffer, L"*.*", 6) == 6)
FilePattern.Length = 2;
=== code end ===
So this means it does not matter whether you pass '*.*' or '*' to
FindFirstFile*, because the Win32 subsystem will adjust the mask anyway
(FPC's FindFirst internally uses FindFirstFileA on Windows).
More information about the Lazarus