FindFirstFile
also includes short names for legacy reasons so the pattern *.txt
will include anything with an 8.3
representation ending in *.txt
which includes *.txtANYTHING
, not just the ~
character (see dir /x
for what's being matched against).
You will need to filter in your FindNext enumeration.