1 static bool IsMatched(CONST TCHAR* p, CONST TCHAR* q) 2 { 3 CONST TCHAR *r, *z, *x = _T(""); 4 for (r = p; *p; ++p) 5 if (*p == '\\') 6 r = p + 1; 7 else if (*p == '.') 8 x = p; 9 z = r; 10 while (*q) 11 { 12 while (*q == '|')q++; 13 if (*q == '*') 14 { 15 r = x; 16 while (*++q != '.' && *q); 17 } 18 while (tolower(*q) == tolower(*r) && *r) r++, q++; 19 if (*q == '*' || !*r && (!*q || *q == '|')) 20 { 21 return true; 22 } 23 while (*q != '|' && *q)++q; 24 r = z; 25 } 26 return false; 27 }