On 01.05.2013 14:45, Bart wrote:
On 5/1/13, Jürgen Hestermann <[email protected]> wrote:


But wasn't the original problem that AllFilesMask was wrong on Windows?

No.
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 ( http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/file/find.c?revision=58833&view=markup ) 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).

Regards,
Sven

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to