FindFirstFile undocumented wildcard or bug?

前端 未结 1 1935
夕颜
夕颜 2020-12-10 03:49

MSDN says:

HANDLE WINAPI FindFirstFile( LPCTSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData );

lpFileName The directory or pa

相关标签:
1条回答
  • 2020-12-10 04:41

    According to a post on the OSR ntfsd list from 2002, this is an intentional feature of NtQueryDirectoryFile/ZwQueryDirectoryFile via FsRtlIsNameInExpression. < and > correspond to * and ?, but perform matching "using MS-DOS semantics".

    The FsRtlIsNameInExpression states:

    The following wildcard characters can be used in the pattern string.
    
    Wildcard character  Meaning
    
    * (asterisk)        Matches zero or more characters.
    
    ? (question mark)   Matches a single character.
    
    DOS_DOT             Matches either a period or zero characters beyond the name
                        string.
    
    DOS_QM              Matches any single character or, upon encountering a period
                        or end of name string, advances the expression to the end of
                        the set of contiguous DOS_QMs.
    
    DOS_STAR            Matches zero or more characters until encountering and
                        matching the final . in the name.
    

    For some reason, this page does not give the values of the DOS_* macros, but ntifs.h does:

    //  The following constants provide addition meta characters to fully
    //  support the more obscure aspects of DOS wild card processing.
    
    #define DOS_STAR        (L'<')
    #define DOS_QM          (L'>')
    #define DOS_DOT         (L'"')
    
    0 讨论(0)
提交回复
热议问题