Цитата
сколько не делал поиск, он идет по имени
Повезло... В следующий раз может повезти меньше: в описании
FindFirstFile (которую вызывает FindFirst) явно сказано:
Цитата
Remarks
The FindFirstFile function opens a search handle and returns information about the first file that the file system finds with a name that matches the specified pattern. This may or may not be the first file or directory that appears in a directory-listing application (such as the dir command) when given the same file name string pattern. This is because FindFirstFile does no sorting of the search results.
Описание
FindNextFile еще раз это подтверждает:
Цитата
The order in which this function returns the file names is dependent on the file system type. With the NTFS file system and CDFS file systems, the names are usually returned in alphabetical order. With FAT file systems, the names are usually returned in the order the files were written to the disk, which may or may not be in alphabetical order. However, as stated previously, these behaviors are not guaranteed.