From: Sebastian Lackner Subject: [2/2] kernel32/tests: Add tests for FindFirstFileExA with FIND_FIRST_EX_CASE_SENSITIVE flag. Message-Id: <542D1988.3040900@fds-team.de> Date: Thu, 02 Oct 2014 11:23:20 +0200 --- dlls/kernel32/tests/file.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) From 7096913b76e9f85e9eabfba70d32b93b253c5511 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Thu, 2 Oct 2014 04:01:36 +0200 Subject: kernel32/tests: Add tests for FindFirstFileExA with FIND_FIRST_EX_CASE_SENSITIVE flag. --- dlls/kernel32/tests/file.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c index 106e68a..0973efe 100644 --- a/dlls/kernel32/tests/file.c +++ b/dlls/kernel32/tests/file.c @@ -2608,22 +2608,38 @@ static void test_FindFirstFileExA(FINDEX_SEARCH_OPS search_ops, DWORD flags) skip("File system supports directory filtering\n"); /* Results from the previous call are not cleared */ ok(strcmp(search_results.cFileName, "dir1") == 0, "Third entry should be 'dir1' is %s\n", search_results.cFileName); - FindClose( handle ); - goto cleanup; } + else + { + ok(ret, "Fetching fourth file failed\n"); + ok(CHECK_NAME(search_results.cFileName), "Invalid fourth entry - %s\n", search_results.cFileName); - ok(ret, "Fetching fourth file failed\n"); - ok(CHECK_NAME(search_results.cFileName), "Invalid fourth entry - %s\n", search_results.cFileName); + ok(FindNextFileA(handle, &search_results), "Fetching fifth file failed\n"); + ok(CHECK_NAME(search_results.cFileName), "Invalid fifth entry - %s\n", search_results.cFileName); - ok(FindNextFileA(handle, &search_results), "Fetching fifth file failed\n"); - ok(CHECK_NAME(search_results.cFileName), "Invalid fifth entry - %s\n", search_results.cFileName); + ok(FindNextFileA(handle, &search_results) == FALSE, "Fetching sixth file should fail\n"); + } #undef CHECK_NAME - ok(FindNextFileA(handle, &search_results) == FALSE, "Fetching sixth file should fail\n"); - FindClose( handle ); + /* Most Windows systems seem to ignore the FIND_FIRST_EX_CASE_SENSITIVE flag. Unofficial documentation + * suggests that there are registry keys and that it might depend on the used filesystem. */ + SetLastError(0xdeadbeef); + handle = pFindFirstFileExA("TEST-DIR\\*", FindExInfoStandard, &search_results, search_ops, NULL, flags); + if (flags & FIND_FIRST_EX_CASE_SENSITIVE) + { + ok(handle != INVALID_HANDLE_VALUE || GetLastError() == ERROR_PATH_NOT_FOUND, + "Unexpected error %x, expected valid handle or ERROR_PATH_NOT_FOUND\n", GetLastError()); + trace("FindFirstFileExA flag FIND_FIRST_EX_CASE_SENSITIVE is %signored\n", + (handle == INVALID_HANDLE_VALUE) ? "not " : ""); + } + else + ok(handle != INVALID_HANDLE_VALUE, "Unexpected error %x, expected valid handle\n", GetLastError()); + if (handle != INVALID_HANDLE_VALUE) + FindClose( handle ); + cleanup: DeleteFileA("test-dir\\file1"); DeleteFileA("test-dir\\file2"); @@ -4177,9 +4193,11 @@ START_TEST(file) test_FindFirstFileA(); test_FindNextFileA(); test_FindFirstFileExA(0, 0); + test_FindFirstFileExA(0, FIND_FIRST_EX_CASE_SENSITIVE); test_FindFirstFileExA(0, FIND_FIRST_EX_LARGE_FETCH); /* FindExLimitToDirectories is ignored if the file system doesn't support directory filtering */ test_FindFirstFileExA(FindExSearchLimitToDirectories, 0); + test_FindFirstFileExA(FindExSearchLimitToDirectories, FIND_FIRST_EX_CASE_SENSITIVE); test_FindFirstFileExA(FindExSearchLimitToDirectories, FIND_FIRST_EX_LARGE_FETCH); test_LockFile(); test_file_sharing(); -- 2.1.1