From: Paul Gofman pgofman@codeweavers.com
--- dlls/ntdll/tests/directory.c | 19 +++++++++++++++++++ dlls/ntdll/unix/file.c | 14 ++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/tests/directory.c b/dlls/ntdll/tests/directory.c index c12c5547ade..d61a1a73b3f 100644 --- a/dlls/ntdll/tests/directory.c +++ b/dlls/ntdll/tests/directory.c @@ -485,12 +485,17 @@ static void test_NtQueryDirectoryFile(void) {L"<", {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1}}, {L"<.", {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1}}, {L"<..", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}, + {L"<."", {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1}}, {L".<", {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0}}, {L"..<", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}}, {L"..*", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}}, {L"*..*", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1}}, {L"*..", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}, {L"..?", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}}, + {L".."", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, + {L""", {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0}}, + {L"""", {0, 0, 0, 0, 0, 0, 0, 0, 0, 1,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0, 0}}, + {L"*"tmp", {1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}}, {L"<.<", {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, + {L"<"<", {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, + {L"<"<"", {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, + {L"<"<.", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}}, + {L"<.<"", {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, {L"<<", {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, {L"<a", {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0}}, {L"*a", {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0}}, @@ -512,6 +530,7 @@ static void test_NtQueryDirectoryFile(void) {L"<.<<", {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, {L"<<<", {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, {L"< ..", {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, + {L"<""", {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1}}, };
OBJECT_ATTRIBUTES attr; diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 8694564b576..eee3610b487 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -1441,10 +1441,11 @@ static BOOLEAN match_filename_part( const WCHAR *name, const WCHAR *name_end, co
while (name < name_end) { + c = *mask == '"' ? '.' : *mask; if (is_case_sensitive) - while (name < name_end && (*name != *mask)) name++; + while (name < name_end && (*name != c)) name++; else - while (name < name_end && (towupper(*name) != towupper(*mask))) name++; + while (name < name_end && (towupper(*name) != towupper(c))) name++; if (match_filename_part( name, name_end, mask, mask_end )) return TRUE; ++name; } @@ -1469,7 +1470,7 @@ static BOOLEAN match_filename_part( const WCHAR *name, const WCHAR *name_end, co { while (name < next_dot) { - c = *mask; + c = *mask == '"' ? '.' : *mask; if (!is_wildcard(c)) { if (is_case_sensitive) @@ -1491,14 +1492,15 @@ static BOOLEAN match_filename_part( const WCHAR *name, const WCHAR *name_end, co name++; break; default: - if (is_case_sensitive && *mask != *name) return FALSE; - if (!is_case_sensitive && towupper(*mask) != towupper(*name)) return FALSE; + c = *mask == '"' ? '.' : *mask; + if (is_case_sensitive && c != *name) return FALSE; + if (!is_case_sensitive && towupper(c) != towupper(*name)) return FALSE; mask++; name++; break; } } - while (mask < mask_end && (*mask == '*' || *mask == '<')) + while (mask < mask_end && (*mask == '*' || *mask == '<' || *mask == '"')) mask++; return (name == name_end && mask == mask_end); }