Jacek Caban : gdi32: Directly use ntdll for font mutex.
Alexandre Julliard
julliard at winehq.org
Tue Sep 21 15:59:03 CDT 2021
Module: wine
Branch: master
Commit: 57767a9af85d6d9759eb458b0d3695901ee50a0f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=57767a9af85d6d9759eb458b0d3695901ee50a0f
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Sep 21 15:54:17 2021 +0200
gdi32: Directly use ntdll for font mutex.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/font.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index e5e294435e9..f916ed97f01 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -5889,9 +5889,15 @@ static const struct font_callback_funcs callback_funcs = { add_gdi_face };
*/
void font_init(void)
{
+ OBJECT_ATTRIBUTES attr = { sizeof(attr) };
+ UNICODE_STRING name;
HANDLE mutex;
DWORD disposition;
+ static WCHAR wine_font_mutexW[] =
+ {'\\','B','a','s','e','N','a','m','e','d','O','b','j','e','c','t','s',
+ '\\','_','_','W','I','N','E','_','F','O','N','T','_','M','U','T','E','X','_','_'};
+
if (RegCreateKeyExW( HKEY_CURRENT_USER, L"Software\\Wine\\Fonts", 0, NULL, 0,
KEY_ALL_ACCESS, NULL, &wine_fonts_key, NULL ))
return;
@@ -5904,8 +5910,13 @@ void font_init(void)
load_file_system_fonts();
font_funcs->load_fonts();
- if (!(mutex = CreateMutexW( NULL, FALSE, L"__WINE_FONT_MUTEX__" ))) return;
- WaitForSingleObject( mutex, INFINITE );
+ attr.Attributes = OBJ_OPENIF;
+ attr.ObjectName = &name;
+ name.Buffer = wine_font_mutexW;
+ name.Length = name.MaximumLength = sizeof(wine_font_mutexW);
+
+ if (NtCreateMutant( &mutex, MUTEX_ALL_ACCESS, &attr, FALSE ) < 0) return;
+ NtWaitForSingleObject( mutex, FALSE, NULL );
RegCreateKeyExW( wine_fonts_key, L"Cache", 0, NULL, REG_OPTION_VOLATILE,
KEY_ALL_ACCESS, NULL, &wine_fonts_cache_key, &disposition );
@@ -5916,7 +5927,7 @@ void font_init(void)
update_external_font_keys();
}
- ReleaseMutex( mutex );
+ NtReleaseMutant( mutex, NULL );
if (disposition != REG_CREATED_NEW_KEY)
{
More information about the wine-cvs
mailing list