[fpc-devel] [Go32v2] LFN FindFirst bug

Tomas Hajny XHajT03 at hajny.biz
Tue Feb 28 23:34:45 CET 2012


On 28 Feb 12, at 21:20, Marco Borsari wrote:
> Jonas Maebe wrote:


Marco,

> > That is by design, see http://www.freepascal.org/docs-html/rtl/sysutils/findfirst.html (the same goes for the findfirst from the Dos unit)
> > 
> > You have to check the attributes of the returned entries to see whether they match what you want. This is TP/Delphi-compatible.
> > 
> I don't know of Delphi compatibility, but sure not for TP and/or FPC 
> itself when doslfn is disabled. It cannot be other than that, because 
> the interrupt service which lies on short FindFirst don't accept in the 
> cx required criteria, but only allowable. Retaining this discrepance 
> makes old application that use file searching to crash when running on 
> new environment.

Jonas is right, it is no bug. The difference you get between the case 
of having LFN enabled or not is most likely related to the fact that 
you search for '*' mask rather than '*.*' in your example. As you 
might know, '*' matches or names with or without extensions on LFN 
enabled drives (or operating systems - see below) whereas SFN limited 
access (which includes TP/BP) requires you to use '*.*' to get the 
same result. Typically, directories don't have any extensions on DOS 
drives which is the most likely explanation for your results. You can 
check the results with the attached example program (I just did and 
the results if compiled with TP/BP and FPC are exactly the same for 
me).

Tomas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.pas
Type: application/octet-stream
Size: 982 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20120228/e3d1ad4c/attachment.obj>


More information about the fpc-devel mailing list