ntdll: Do not ignore trailing dots in match_filename().

This commit is contained in:
Paul Gofman 2024-06-03 16:46:51 -06:00 committed by Alexandre Julliard
parent 5b061122f3
commit 31ab5ec2d7
2 changed files with 5 additions and 9 deletions

View file

@ -453,13 +453,12 @@ static void test_NtQueryDirectoryFile(void)
{
const WCHAR *mask;
int found[ARRAY_SIZE(testfiles)];
BOOL todo_missing;
}
mask_tests[] =
{
{L"*.", {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}, TRUE},
{L"*.*", {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1}, TRUE},
{L"*.**", {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1}, TRUE},
{L"*.", {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1}},
{L"*.*", {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1}},
{L"*.**", {1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1}},
{L"*", {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}},
{L"**", {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}},
{L"??.???", {0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0}},
@ -517,10 +516,7 @@ static void test_NtQueryDirectoryFile(void)
RtlInitUnicodeString(&mask, mask_tests[i].mask);
test_flags_NtQueryDirectoryFile(&attr, testdirA, &mask, FALSE, TRUE);
for (j = 0; j < test_dir_count; j++)
{
todo_wine_if(mask_tests[i].todo_missing && !mask_tests[i].found[j])
ok(testfiles[j].nfound == mask_tests[i].found[j], "%S, got %d.\n", testfiles[j].name, testfiles[j].nfound);
}
winetest_pop_context();
}

View file

@ -1487,8 +1487,8 @@ static BOOLEAN match_filename( const WCHAR *name, int length, const UNICODE_STRI
break;
}
}
while (mask < mask_end && ((*mask == '.') || (*mask == '*')))
mask++; /* Ignore trailing '.' or '*' in mask */
while (mask < mask_end && *mask == '*')
mask++;
return (name == name_end && mask == mask_end);
}