[PATCH] kernel32: handle FindFirstFileEx better
Maarten Lankhorst
m.b.lankhorst at gmail.com
Fri May 10 03:09:05 CDT 2013
Fixes qtcreator starting when windows version is set to win7.
Signed-off-by: Maarten Lankhorst <m.b.lankhorst at gmail.com>
---
diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c
index 89e0fad..a2a92c7 100644
--- a/dlls/kernel32/file.c
+++ b/dlls/kernel32/file.c
@@ -53,6 +53,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(file);
typedef struct
{
DWORD magic; /* magic number */
+ FINDEX_INFO_LEVELS level; /* FindExInfoBasic or FindExInfoStandard */
HANDLE handle; /* handle to directory */
CRITICAL_SECTION cs; /* crit section protecting this structure */
FINDEX_SEARCH_OPS search_op; /* Flags passed to FindFirst. */
@@ -1827,13 +1828,13 @@ HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level,
TRACE("%s %d %p %d %p %x\n", debugstr_w(filename), level, data, search_op, filter, flags);
- if ((search_op != FindExSearchNameMatch && search_op != FindExSearchLimitToDirectories)
- || flags != 0)
+ if ((search_op != FindExSearchNameMatch && search_op != FindExSearchLimitToDirectories) ||
+ (flags & ~FIND_FIRST_EX_LARGE_FETCH))
{
FIXME("options not implemented 0x%08x 0x%08x\n", search_op, flags );
return INVALID_HANDLE_VALUE;
}
- if (level != FindExInfoStandard)
+ if (level > FindExInfoBasic)
{
FIXME("info level %d not implemented\n", level );
return INVALID_HANDLE_VALUE;
@@ -1936,6 +1937,7 @@ HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level,
info->data_size = 0;
info->data = NULL;
info->search_op = search_op;
+ info->level = level;
if (device)
{
@@ -2098,8 +2100,12 @@ BOOL WINAPI FindNextFileW( HANDLE handle, WIN32_FIND_DATAW *data )
memcpy( data->cFileName, dir_info->FileName, dir_info->FileNameLength );
data->cFileName[dir_info->FileNameLength/sizeof(WCHAR)] = 0;
- memcpy( data->cAlternateFileName, dir_info->ShortName, dir_info->ShortNameLength );
- data->cAlternateFileName[dir_info->ShortNameLength/sizeof(WCHAR)] = 0;
+
+ if (info->level != FindExInfoBasic) {
+ memcpy( data->cAlternateFileName, dir_info->ShortName, dir_info->ShortNameLength );
+ data->cAlternateFileName[dir_info->ShortNameLength/sizeof(WCHAR)] = 0;
+ } else
+ data->cAlternateFileName[0] = 0;
TRACE("returning %s (%s)\n",
debugstr_w(data->cFileName), debugstr_w(data->cAlternateFileName) );
diff --git a/include/winbase.h b/include/winbase.h
index ad51af3..506075b 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -283,9 +283,14 @@ DECL_WINELIB_TYPE_AW(LPWIN32_FIND_DATA)
typedef enum _FINDEX_INFO_LEVELS
{
FindExInfoStandard,
+ FindExInfoBasic,
FindExInfoMaxInfoLevel
} FINDEX_INFO_LEVELS;
+/* flags for FindFirstFileEx */
+#define FIND_FIRST_EX_CASE_SENSITIVE 0x1
+#define FIND_FIRST_EX_LARGE_FETCH 0x2
+
typedef enum _FINDEX_SEARCH_OPS
{
FindExSearchNameMatch,
More information about the wine-patches
mailing list