From: Jiajin Cui cuijiajin@uniontech.com
Signed-off-by: Jiajin Cui cuijiajin@uniontech.com --- dlls/dwrite/dwrite_private.h | 2 +- dlls/dwrite/font.c | 32 +++++++++++++++++--------------- dlls/dwrite/main.c | 11 +++++++++-- 3 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index d0ed1db97ef..02e28eec60e 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -336,7 +336,7 @@ extern HRESULT create_fontfacereference(IDWriteFactory7 *factory, IDWriteFontFil DWRITE_FONT_SIMULATIONS simulations, DWRITE_FONT_AXIS_VALUE const *axis_values, UINT32 axis_values_count, IDWriteFontFaceReference1 **reference) DECLSPEC_HIDDEN; extern HRESULT factory_get_cached_fontface(IDWriteFactory7 *factory, IDWriteFontFile * const *files, UINT32 num_files, - DWRITE_FONT_SIMULATIONS simulations, struct list **cache, REFIID riid, void **obj) DECLSPEC_HIDDEN; + DWRITE_FONT_SIMULATIONS simulations, const WCHAR *name, struct list **cache, REFIID riid, void **obj) DECLSPEC_HIDDEN; extern void factory_detach_fontcollection(IDWriteFactory7 *factory, IDWriteFontCollection3 *collection) DECLSPEC_HIDDEN; extern void factory_detach_gdiinterop(IDWriteFactory7 *factory, IDWriteGdiInterop1 *interop) DECLSPEC_HIDDEN; extern struct fontfacecached *factory_cache_fontface(IDWriteFactory7 *factory, struct list *fontfaces, diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index d2d2b7963f7..a1b7397c99b 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -2191,17 +2191,33 @@ static const IDWriteFontFaceReferenceVtbl dwritefontface_reference_vtbl = dwritefontface_reference_EnqueueFileFragmentDownloadRequest, };
+static void fontstrings_get_en_string(IDWriteLocalizedStrings *strings, WCHAR *buffer, UINT32 size) +{ + BOOL exists = FALSE; + UINT32 index; + HRESULT hr; + + buffer[0] = 0; + hr = IDWriteLocalizedStrings_FindLocaleName(strings, L"en-us", &index, &exists); + if (FAILED(hr) || !exists) + return; + + IDWriteLocalizedStrings_GetString(strings, index, buffer, size); +} + static HRESULT get_fontface_from_font(struct dwrite_font *font, IDWriteFontFace5 **fontface) { struct dwrite_font_data *data = font->data; struct fontface_desc desc; struct list *cached_list; HRESULT hr; + WCHAR familyW[255]={};
*fontface = NULL;
+ fontstrings_get_en_string(data->family_names, familyW, ARRAY_SIZE(familyW)); hr = factory_get_cached_fontface(font->family->collection->factory, &data->file, data->face_index, - font->data->simulations, &cached_list, &IID_IDWriteFontFace4, (void **)fontface); + font->data->simulations, familyW, &cached_list, &IID_IDWriteFontFace4, (void **)fontface); if (hr == S_OK) return hr;
@@ -3574,20 +3590,6 @@ HRESULT get_filestream_from_file(IDWriteFontFile *file, IDWriteFontFileStream ** return hr; }
-static void fontstrings_get_en_string(IDWriteLocalizedStrings *strings, WCHAR *buffer, UINT32 size) -{ - BOOL exists = FALSE; - UINT32 index; - HRESULT hr; - - buffer[0] = 0; - hr = IDWriteLocalizedStrings_FindLocaleName(strings, L"en-us", &index, &exists); - if (FAILED(hr) || !exists) - return; - - IDWriteLocalizedStrings_GetString(strings, index, buffer, size); -} - static int trim_spaces(WCHAR *in, WCHAR *ret) { int len; diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c index 8cc5d4dccf7..da6242e528e 100644 --- a/dlls/dwrite/main.c +++ b/dlls/dwrite/main.c @@ -926,7 +926,7 @@ void factory_unlock(IDWriteFactory7 *iface) }
HRESULT factory_get_cached_fontface(IDWriteFactory7 *iface, IDWriteFontFile * const *font_files, UINT32 index, - DWRITE_FONT_SIMULATIONS simulations, struct list **cached_list, REFIID riid, void **obj) + DWRITE_FONT_SIMULATIONS simulations, const WCHAR *name, struct list **cached_list, REFIID riid, void **obj) { struct dwritefactory *factory = impl_from_IDWriteFactory7(iface); struct fontfacecached *cached; @@ -969,6 +969,7 @@ HRESULT factory_get_cached_fontface(IDWriteFactory7 *iface, IDWriteFontFile * co DWRITE_FONT_SIMULATIONS cached_simulations; const void *cached_key; IDWriteFontFile *file; + IDWriteLocalizedStrings* family_names;
cached_face_index = IDWriteFontFace5_GetIndex(cached->fontface); cached_simulations = IDWriteFontFace5_GetSimulations(cached->fontface); @@ -977,6 +978,12 @@ HRESULT factory_get_cached_fontface(IDWriteFactory7 *iface, IDWriteFontFile * co if (cached_face_index != index || cached_simulations != simulations) continue;
+ hr = IDWriteFontFace5_GetFaceNames(cached->fontface, &family_names); + if (FAILED(hr)) + break; + + if(name && name[0] && !localizedstrings_contains(family_names, name)) continue; + hr = IDWriteFontFace5_GetFiles(cached->fontface, &count, &file); if (FAILED(hr)) break; @@ -1066,7 +1073,7 @@ static HRESULT WINAPI dwritefactory_CreateFontFace(IDWriteFactory7 *iface, DWRIT goto failed; }
- hr = factory_get_cached_fontface(iface, font_files, index, simulations, &fontfaces, + hr = factory_get_cached_fontface(iface, font_files, index, simulations, NULL, &fontfaces, &IID_IDWriteFontFace, (void **)fontface); if (hr != S_FALSE) goto failed;
From: Jiajin Cui cuijiajin@uniontech.com
When the child window and the parent window are no longer in the same process, the parent window shadow does not update the vis rgn of the child window and modify the WS_VISIBLE style of the child window. so we need to update the vis rgn when another process gets the DC of the child window.
Signed-off-by: Jiajin Cui cuijiajin@uniontech.com --- dlls/win32u/dce.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index 0c25fdcf61b..d4158d7bea4 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -1012,6 +1012,9 @@ HDC WINAPI NtUserGetDCEx( HWND hwnd, HRGN clip_rgn, DWORD flags ) /* cross-process invalidation is not supported yet, so always update the vis rgn */ if (!is_current_process_window( hwnd )) update_vis_rgn = TRUE;
+ /*the Window is not visible but have WS_VISIBLE style, so update the vis rgn */ + if(!is_window_visible( hwnd ) && get_window_long( hwnd, GWL_STYLE ) & WS_VISIBLE) bUpdateVisRgn = TRUE; + if (set_dce_flags( dce->hdc, DCHF_VALIDATEVISRGN )) update_vis_rgn = TRUE; /* DC was dirty */
if (update_vis_rgn) update_visible_region( dce );
From: Jiajin Cui cuijiajin@uniontech.com
see "https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-lim...".
Signed-off-by: Jiajin Cui cuijiajin@uniontech.com --- dlls/ntdll/path.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+)
diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c index 37ad4bbcea2..b844b19ba72 100644 --- a/dlls/ntdll/path.c +++ b/dlls/ntdll/path.c @@ -33,6 +33,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(file);
#define IS_SEPARATOR(ch) ((ch) == '\' || (ch) == '/')
+#define LONGPATH_INIT 0 +#define LONGPATH_ENABLE 1 +#define LONGPATH_DISABLE -1 +static DWORD longpathenable = LONGPATH_INIT; + /*********************************************************************** * RtlDetermineDosPathNameType_U (NTDLL.@) */ @@ -163,6 +168,79 @@ static BOOL is_valid_directory(LPCWSTR path) return TRUE; }
+static NTSTATUS query_dword_option( HANDLE hkey, LPCWSTR name, LONG *value ) +{ + NTSTATUS status; + UNICODE_STRING str; + ULONG size; + WCHAR buffer[64]; + KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)buffer; + + RtlInitUnicodeString( &str, name ); + + size = sizeof(buffer) - sizeof(WCHAR); + if ((status = NtQueryValueKey( hkey, &str, KeyValuePartialInformation, buffer, size, &size ))) + return status; + + if (info->Type != REG_DWORD) + { + buffer[size / sizeof(WCHAR)] = 0; + *value = wcstoul( (WCHAR *)info->Data, 0, 16 ); + } + else memcpy( value, info->Data, sizeof(*value) ); + return status; +} + +static DWORD getLongPathsEnabled() +{ + OBJECT_ATTRIBUTES attr = { sizeof(attr) }; + UNICODE_STRING name; + HANDLE mutex; + static HKEY hklm; + + static WCHAR longpath_mutexW[] = + {'\','B','a','s','e','N','a','m','e','d','O','b','j','e','c','t','s', + '\','_','_','L','O','N','G','_','P','A','T','H','_','M','U','T','E','X','_','_'}; + + attr.Attributes = OBJ_OPENIF; + attr.ObjectName = &name; + name.Buffer = longpath_mutexW; + name.Length = name.MaximumLength = sizeof(longpath_mutexW); + + if (NtCreateMutant( &mutex, MUTEX_ALL_ACCESS, &attr, FALSE ) < 0) return 0; + NtWaitForSingleObject( mutex, FALSE, NULL ); + + if(LONGPATH_INIT == longpathenable) + { + static const WCHAR filesystemW[] = {'\','R','e','g','i','s','t','r','y', + '\','M','a','c','h','i','n','e', + '\','S','y','s','t','e','m', + '\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t', + '\','C','o','n','t','r','o','l', + '\','F','i','l','e','S','y','s','t','e','m',0}; + static const WCHAR longpathenableW[] = {'L','o','n','g','P','a','t','h','s','E','n','a','b','l','e','d',0}; + OBJECT_ATTRIBUTES attr; + UNICODE_STRING nameW; + HANDLE key; + + InitializeObjectAttributes( &attr, &nameW, 0, 0, NULL ); + nameW.Buffer = filesystemW; + nameW.Length = sizeof(filesystemW); + nameW.MaximumLength = nameW.Length; + if (!NtOpenKey( &key, KEY_READ, &attr )) + { + query_dword_option( key, longpathenableW, &longpathenable ); + NtClose( key ); + } + } + + if(LONGPATH_ENABLE != longpathenable) longpathenable = LONGPATH_DISABLE; + + NtReleaseMutant( mutex, NULL ); + + return longpathenable; +} + /************************************************************************** * RtlDosPathNameToNtPathName_U_WithStatus [NTDLL.@] * @@ -196,6 +274,13 @@ NTSTATUS WINAPI RtlDosPathNameToNtPathName_U_WithStatus(const WCHAR *dos_path, U if (!dos_path || !*dos_path) return STATUS_OBJECT_NAME_INVALID;
+ if( LONGPATH_ENABLE != getLongPathsEnabled() + && memcmp(dos_path, global_prefix, sizeof(global_prefix)) + && wcslen(dos_path) > MAX_PATH ) + { + return STATUS_OBJECT_NAME_INVALID; + } + if (!memcmp(dos_path, global_prefix, sizeof(global_prefix)) || (!memcmp(dos_path, global_prefix2, sizeof(global_prefix2)) && dos_path[4]) || !wcsicmp( dos_path, L"\\.\CON" ))
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=125891
Your paranoid android.
=== debian11 (build log) ===
../wine/dlls/win32u/dce.c:1016:87: error: ���bUpdateVisRgn��� undeclared (first use in this function) Task: The win32 Wine build failed
=== debian11b (build log) ===
../wine/dlls/win32u/dce.c:1016:87: error: ���bUpdateVisRgn��� undeclared (first use in this function) Task: The wow64 Wine build failed
Nikolay Sivov (@nsivov) commented about dlls/dwrite/main.c:
}
HRESULT factory_get_cached_fontface(IDWriteFactory7 *iface, IDWriteFontFile * const *font_files, UINT32 index,
DWRITE_FONT_SIMULATIONS simulations, struct list **cached_list, REFIID riid, void **obj)
DWRITE_FONT_SIMULATIONS simulations, const WCHAR *name, struct list **cached_list, REFIID riid, void **obj)
Could you explain what you're fixing with this? Cache entries are identified with a file/face index/simulations, names are stored as font data. Why is it necessary to check that, if we are already checking font files for matching. Test case would be great to see.
This MR should really be three MRs, because all the commits you pushed are unrelated to each other.
On Tue Nov 8 07:36:33 2022 +0000, Nikolay Sivov wrote:
This MR should really be three MRs, because all the commits you pushed are unrelated to each other.
OK,I would revise it to three MRs later.
On Tue Nov 8 07:31:45 2022 +0000, Nikolay Sivov wrote:
Could you explain what you're fixing with this? Cache entries are identified with a file/face index/simulations, names are stored as font data. Why is it necessary to check that, if we are already checking font files for matching. Test case would be great to see.
There are still some issues with this patch, I will submit it after I modify it, thank you!
This merge request was closed by Jiajin Cui.