From dc93e99c9fbcb775da2257eb0ac87a2f5d4811c7 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Mon, 22 Apr 2013 19:36:33 +0000 Subject: [PATCH] [NTOSKRNL] Properly handle (as Windows does) WC in case last dot was eaten in path name translation Fixes last FindFile failing tests svn path=/trunk/; revision=58833 --- reactos/dll/win32/kernel32/client/file/find.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/reactos/dll/win32/kernel32/client/file/find.c b/reactos/dll/win32/kernel32/client/file/find.c index f8f7562807f..c73fb295ee1 100644 --- a/reactos/dll/win32/kernel32/client/file/find.c +++ b/reactos/dll/win32/kernel32/client/file/find.c @@ -669,7 +669,7 @@ FindFirstFileExW(IN LPCWSTR lpFileName, PFIND_DATA_HANDLE FindDataHandle; PFIND_FILE_DATA FindFileData; - UNICODE_STRING NtPath, FilePattern; + UNICODE_STRING NtPath, FilePattern, FileName; PWSTR NtPathBuffer; RTL_RELATIVE_NAME_U RelativePath; ULONG DeviceNameInfo = 0; @@ -679,6 +679,8 @@ FindFirstFileExW(IN LPCWSTR lpFileName, IO_STATUS_BLOCK IoStatusBlock; HANDLE hDirectory = NULL; + BOOLEAN HadADot = FALSE; + /* * May represent many FILE_BOTH_DIR_INFORMATION * or many FILE_FULL_DIR_INFORMATION structures. @@ -693,6 +695,12 @@ FindFirstFileExW(IN LPCWSTR lpFileName, return INVALID_HANDLE_VALUE; } + RtlInitUnicodeString(&FileName, lpFileName); + if (FileName.Length != 0 && FileName.Buffer[FileName.Length / sizeof(WCHAR) - 1] == L'.') + { + HadADot = TRUE; + } + if (!RtlDosPathNameToNtPathName_U(lpFileName, &NtPath, (PCWSTR*)&FilePattern.Buffer, @@ -856,6 +864,15 @@ FindFirstFileExW(IN LPCWSTR lpFileName, PatternIndex++; } + + /* Handle partial wc if our last dot was eaten */ + if (HadADot) + { + if (FilePattern.Buffer[FilePattern.Length / sizeof(WCHAR) - 1] == L'*') + { + FilePattern.Buffer[FilePattern.Length / sizeof(WCHAR) - 1] = L'<'; + } + } } Status = NtQueryDirectoryFile(hDirectory,