mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Rebase against 5f0b5d350566a46f0f999e4cff7ad9e280fcfa05
This commit is contained in:
parent
dc9fa12a14
commit
4522654f1c
@ -1,17 +1,18 @@
|
||||
From 8a1bbc2907aee4de18948be8d3c4a8ad04ddd544 Mon Sep 17 00:00:00 2001
|
||||
From 339d3f797f4ba20feac9c887dc79734cd15a2c10 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sat, 6 Feb 2016 18:31:25 +0100
|
||||
Subject: kernel32: Strip invalid characters from mask in FindFirstFileExW.
|
||||
Subject: [PATCH] kernel32: Strip invalid characters from mask in
|
||||
FindFirstFileExW.
|
||||
|
||||
---
|
||||
dlls/kernel32/file.c | 27 +++++++++++++++++++++++----
|
||||
1 file changed, 23 insertions(+), 4 deletions(-)
|
||||
dlls/kernelbase/file.c | 26 ++++++++++++++++++++++----
|
||||
1 file changed, 22 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c
|
||||
index cc7ead1..f078a9c 100644
|
||||
--- a/dlls/kernel32/file.c
|
||||
+++ b/dlls/kernel32/file.c
|
||||
@@ -1942,6 +1942,7 @@ HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level,
|
||||
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c
|
||||
index 89c5f85cb20..542531e895c 100644
|
||||
--- a/dlls/kernelbase/file.c
|
||||
+++ b/dlls/kernelbase/file.c
|
||||
@@ -795,6 +795,7 @@ HANDLE WINAPI DECLSPEC_HOTPATCH FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_
|
||||
WCHAR *mask;
|
||||
BOOL has_wildcard = FALSE;
|
||||
FIND_FIRST_INFO *info = NULL;
|
||||
@ -19,7 +20,7 @@ index cc7ead1..f078a9c 100644
|
||||
UNICODE_STRING nt_name;
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
IO_STATUS_BLOCK io;
|
||||
@@ -1973,6 +1974,8 @@ HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level,
|
||||
@@ -826,6 +827,8 @@ HANDLE WINAPI DECLSPEC_HOTPATCH FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
@ -28,36 +29,35 @@ index cc7ead1..f078a9c 100644
|
||||
if (!mask && (device = RtlIsDosDeviceName_U( filename )))
|
||||
{
|
||||
static const WCHAR dotW[] = {'.',0};
|
||||
@@ -2007,8 +2010,27 @@ HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level,
|
||||
@@ -860,8 +863,26 @@ HANDLE WINAPI DECLSPEC_HOTPATCH FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_
|
||||
}
|
||||
else
|
||||
{
|
||||
+ static const WCHAR invalidW[] = { '<', '>', '\"', 0 };
|
||||
+ static const WCHAR wildcardW[] = { '*', 0 };
|
||||
+ DWORD mask_len = strlenW( mask );
|
||||
+ DWORD mask_len = lstrlenW( mask );
|
||||
+
|
||||
+ /* strip invalid characters from mask */
|
||||
+ while (mask_len && strchrW( invalidW, mask[mask_len - 1] ))
|
||||
+ while (mask_len && wcschr( invalidW, mask[mask_len - 1] ))
|
||||
+ mask_len--;
|
||||
+
|
||||
+ if (!mask_len)
|
||||
+ {
|
||||
+ has_wildcard = TRUE;
|
||||
+ RtlInitUnicodeString( &mask_str, wildcardW );
|
||||
+ RtlInitUnicodeString( &mask_str, L"*?" );
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ has_wildcard = strpbrkW( mask, wildcardsW ) != NULL;
|
||||
+ has_wildcard = wcspbrk( mask, L"*?" ) != NULL;
|
||||
+ RtlInitUnicodeString( &mask_str, mask );
|
||||
+ mask_str.Length = mask_len * sizeof(WCHAR);
|
||||
+ }
|
||||
+
|
||||
nt_name.Length = (mask - nt_name.Buffer) * sizeof(WCHAR);
|
||||
- has_wildcard = strpbrkW( mask, wildcardsW ) != NULL;
|
||||
- has_wildcard = wcspbrk( mask, L"*?" ) != NULL;
|
||||
size = has_wildcard ? 8192 : max_entry_size;
|
||||
}
|
||||
|
||||
@@ -2070,9 +2092,6 @@ HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level,
|
||||
@@ -922,9 +943,6 @@ HANDLE WINAPI DECLSPEC_HOTPATCH FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -68,5 +68,5 @@ index cc7ead1..f078a9c 100644
|
||||
FileBothDirectoryInformation, FALSE, &mask_str, TRUE );
|
||||
if (status)
|
||||
--
|
||||
2.8.0
|
||||
2.17.1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From 94fa98ee5bb6e098d6d22f05332da3fe814b112b Mon Sep 17 00:00:00 2001
|
||||
From 540abe549f414881f5e0bd2afb0e4f81d4674850 Mon Sep 17 00:00:00 2001
|
||||
From: Louis Lenders <xerox.xerox2000x@gmail.com>
|
||||
Date: Fri, 4 Oct 2019 23:10:29 +0200
|
||||
Subject: [PATCH] kernelbase: Improve stub for ReOpenFile and add small test
|
||||
@ -12,7 +12,7 @@ Signed-off-by: Louis Lenders <xerox.xerox2000x@gmail.com>
|
||||
2 files changed, 76 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
|
||||
index 5bd168276..0ed5aa6f0 100644
|
||||
index 5bd168276f9..0ed5aa6f03c 100644
|
||||
--- a/dlls/kernel32/tests/file.c
|
||||
+++ b/dlls/kernel32/tests/file.c
|
||||
@@ -59,6 +59,7 @@ static BOOL (WINAPI *pRtlDosPathNameToNtPathName_U)(LPCWSTR, PUNICODE_STRING, PW
|
||||
@ -91,19 +91,19 @@ index 5bd168276..0ed5aa6f0 100644
|
||||
test_OpenFileById();
|
||||
test_SetFileValidData();
|
||||
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c
|
||||
index 23ca5629a..3a68097f7 100644
|
||||
index 89c5f85cb20..c2922fac68b 100644
|
||||
--- a/dlls/kernelbase/file.c
|
||||
+++ b/dlls/kernelbase/file.c
|
||||
@@ -43,6 +43,8 @@
|
||||
@@ -64,6 +64,8 @@ typedef struct
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(file);
|
||||
static const UINT max_entry_size = offsetof( FILE_BOTH_DIRECTORY_INFORMATION, FileName[256] );
|
||||
|
||||
+extern DWORD WINAPI GetFinalPathNameByHandleW(HANDLE,LPWSTR,DWORD,DWORD);
|
||||
+
|
||||
const WCHAR windows_dir[] = {'C',':','\\','w','i','n','d','o','w','s',0};
|
||||
const WCHAR system_dir[] = {'C',':','\\','w','i','n','d','o','w','s','\\','s','y','s','t','e','m','3','2',0};
|
||||
|
||||
@@ -2159,8 +2161,33 @@ HANDLE WINAPI DECLSPEC_HOTPATCH OpenFileById( HANDLE handle, LPFILE_ID_DESCRIPTO
|
||||
@@ -2555,8 +2557,33 @@ HANDLE WINAPI DECLSPEC_HOTPATCH OpenFileById( HANDLE handle, LPFILE_ID_DESCRIPTO
|
||||
*/
|
||||
HANDLE WINAPI /* DECLSPEC_HOTPATCH */ ReOpenFile( HANDLE handle, DWORD access, DWORD sharing, DWORD flags )
|
||||
{
|
||||
@ -140,5 +140,5 @@ index 23ca5629a..3a68097f7 100644
|
||||
|
||||
|
||||
--
|
||||
2.23.0
|
||||
2.17.1
|
||||
|
||||
|
@ -52,7 +52,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "626162f7db979360d231698ab1288cda97940bb9"
|
||||
echo "5f0b5d350566a46f0f999e4cff7ad9e280fcfa05"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -4211,7 +4211,7 @@ fi
|
||||
# | * [#22635] Strip invalid characters from mask in FindFirstFileExW
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/kernel32/file.c, dlls/kernel32/tests/file.c
|
||||
# | * dlls/kernel32/tests/file.c, dlls/kernelbase/file.c
|
||||
# |
|
||||
if test "$enable_kernel32_FindFirstFile" -eq 1; then
|
||||
patch_apply kernel32-FindFirstFile/0001-kernel32-Strip-invalid-characters-from-mask-in-FindF.patch
|
||||
|
Loading…
Reference in New Issue
Block a user