Commit 25e15ddb authored by Mikolaj Zalewski's avatar Mikolaj Zalewski Committed by Alexandre Julliard

kernel32: FindExSearchLimitToDirectories has no effect on FindFirstFileEx.

parent 1ae9a9d6
...@@ -1544,6 +1544,9 @@ BOOL WINAPI ReplaceFileA(LPCSTR lpReplacedFileName,LPCSTR lpReplacementFileName, ...@@ -1544,6 +1544,9 @@ BOOL WINAPI ReplaceFileA(LPCSTR lpReplacedFileName,LPCSTR lpReplacementFileName,
/************************************************************************* /*************************************************************************
* FindFirstFileExW (KERNEL32.@) * FindFirstFileExW (KERNEL32.@)
*
* NOTE: The FindExSearchLimitToDirectories is ignored - it gives the same
* results as FindExSearchNameMatch
*/ */
HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level, HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level,
LPVOID data, FINDEX_SEARCH_OPS search_op, LPVOID data, FINDEX_SEARCH_OPS search_op,
...@@ -1781,9 +1784,6 @@ BOOL WINAPI FindNextFileW( HANDLE handle, WIN32_FIND_DATAW *data ) ...@@ -1781,9 +1784,6 @@ BOOL WINAPI FindNextFileW( HANDLE handle, WIN32_FIND_DATAW *data )
{ {
if (!check_dir_symlink( info, dir_info )) continue; if (!check_dir_symlink( info, dir_info )) continue;
} }
if (info->search_op == FindExSearchLimitToDirectories &&
(dir_info->FileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
continue;
data->dwFileAttributes = dir_info->FileAttributes; data->dwFileAttributes = dir_info->FileAttributes;
data->ftCreationTime = *(FILETIME *)&dir_info->CreationTime; data->ftCreationTime = *(FILETIME *)&dir_info->CreationTime;
......
...@@ -1377,6 +1377,43 @@ static void test_FindNextFileA(void) ...@@ -1377,6 +1377,43 @@ static void test_FindNextFileA(void)
ok ( err == ERROR_NO_MORE_FILES, "GetLastError should return ERROR_NO_MORE_FILES\n"); ok ( err == ERROR_NO_MORE_FILES, "GetLastError should return ERROR_NO_MORE_FILES\n");
} }
static void test_FindFirstFileExA(void)
{
WIN32_FIND_DATAA search_results;
HANDLE handle;
CreateDirectoryA("test-dir", NULL);
_lclose(_lcreat("test-dir\\file1", 0));
_lclose(_lcreat("test-dir\\file2", 0));
CreateDirectoryA("test-dir\\dir1", NULL);
/* FindExLimitToDirectories is ignored */
handle = FindFirstFileExA("test-dir\\*", FindExInfoStandard, &search_results, FindExSearchLimitToDirectories, NULL, 0);
ok(handle != INVALID_HANDLE_VALUE, "FindFirstFile failed (err=%u)\n", GetLastError());
ok(strcmp(search_results.cFileName, ".") == 0, "First entry should be '.', is %s\n", search_results.cFileName);
#define CHECK_NAME(fn) (strcmp((fn), "file1") == 0 || strcmp((fn), "file2") == 0 || strcmp((fn), "dir1") == 0)
ok(FindNextFile(handle, &search_results), "Fetching second file failed\n");
ok(strcmp(search_results.cFileName, "..") == 0, "Second entry should be '..' is %s\n", search_results.cFileName);
ok(FindNextFile(handle, &search_results), "Fetching third file failed\n");
ok(CHECK_NAME(search_results.cFileName), "Invalid thrid entry - %s\n", search_results.cFileName);
ok(FindNextFile(handle, &search_results), "Fetching fourth file failed\n");
ok(CHECK_NAME(search_results.cFileName), "Invalid fourth entry - %s\n", search_results.cFileName);
ok(FindNextFile(handle, &search_results), "Fetching fifth file failed\n");
ok(CHECK_NAME(search_results.cFileName), "Invalid fifth entry - %s\n", search_results.cFileName);
#undef CHECK_NAME
ok(FindNextFile(handle, &search_results) == FALSE, "Fetching sixth file should failed\n");
DeleteFileA("test-dir\\file1");
DeleteFileA("test-dir\\file2");
RemoveDirectoryA("test-dir\\dir1");
RemoveDirectoryA("test-dir");
}
static int test_Mapfile_createtemp(HANDLE *handle) static int test_Mapfile_createtemp(HANDLE *handle)
{ {
SetFileAttributesA(filename,FILE_ATTRIBUTE_NORMAL); SetFileAttributesA(filename,FILE_ATTRIBUTE_NORMAL);
...@@ -1839,6 +1876,7 @@ START_TEST(file) ...@@ -1839,6 +1876,7 @@ START_TEST(file)
test_MoveFileW(); test_MoveFileW();
test_FindFirstFileA(); test_FindFirstFileA();
test_FindNextFileA(); test_FindNextFileA();
test_FindFirstFileExA();
test_LockFile(); test_LockFile();
test_file_sharing(); test_file_sharing();
test_offset_in_overlapped_structure(); test_offset_in_overlapped_structure();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment