The function matches both the short and long names. This can produce somewhat surprising results. For example, if you ask for "*.htm", this also gives you the file "x.html" since its short name is "X~1.HTM".
Why does it bother matching short names? Shouldn't it match only long names? After all, only old 16-bit programs use short names.
...