Solid File System

Virtual file system enigne that can be embedded into your software.

SolFSStorage.FindFirstEx method


Pascal    Plain C    C++ (DLL/Lib)    C++ (VCL)    C++ (.NET)    C#    VB.NET    Java 

SolFSStorage     See also    


Searches for the first instance of a file name with a given set of attributes in a specified SolFS storage.


    function FindFirstEx(var Search: TStorageSearch; const Mask: TSolFSString; Attributes: LongWord; Flags : LongWord): Boolean;

[Plain C]
    long _stdcall StorageFindFirstEx(unsigned long Storage, PStorageSearch Search, wchar_t* Mask, unsigned long Attributes, unsigned long Flags);

[C++ (DLL/Lib)]
    bool FindFirstEx(StorageSearch & Search, unsigned short *Mask, unsigned long Attributes, unsigned long Flags);

[C++ (VCL)]
    bool __fastcall FindFirstEx(TStorageSearch & Search, const TSolFSString Mask, unsigned Attributes, unsigned long Flags);

[C++ (.NET)]
    bool FindFirstEx(String *fileMask, long attributes, StorageSearch & search, long flags);

    bool FindFirstEx(string fileMask, int attributes, StorageSearch search, int flags)

    Function FindFirstEx(ByVal fileMask As String, ByVal attributes As Integer, ByRef search As StorageSearch, flags As Integer) As Boolean

    boolean findFirstEx( SolFSStorageSearch search, String mask, long attributes, long flags )


  • Attributes - specifies what do we overhaul: files, directories or both.
  • Mask - the full file name mask, including wildcard characters. To use several streams in the file see Files and streams.
  • Flags - flags, which specify types information to retrieve.
  • Search - returns result of searching.
  • [Plain C] Storage - handle to the storage returned by Create or Open function.

Values of Attributes

Values of Flags

Flags can be combination of one or more values:

Return value

    True if a file was successfully located.
    False if no files have been found.
     [Plain C]  0 if the function succeeded or one of Error codes if the function failed.


FindFirstEx searches the directory specified by Mask for the first file that matches the file name Mask and the attributes specified by the Attributes parameter. The function returns the information requested using Flags parameter
Don't specify flags for information which you don't need: retrieval of file times and file size takes certain amount of time, and the enumeration works faster when the corresponding flags are not set.

Note, that to find files without extension (for example a file with the name "JustAFileWithoutExtension"), you will need so specify "*" in Mask. Specifying "*.*" will not locate this file.
If you want to include folders into results, you need to add attrDirectory to Attributes, otherwise folders will not be included.
The result is returned in the Search parameter. Use the fields of this search record to extract the information needed.
When you finish enumeration, remember to call FindClose. Calling this method is not necessary, if FindFirstEx returned False ([DLL] "errNoMoreFiles" error code).

See also

Files and streams     FindFirst     FindClose     FindNext

Back to top