Jacek Caban : gdi32: Directly use ntdll in load_gdi_font_replacements.
Alexandre Julliard
julliard at winehq.org
Thu Sep 23 15:35:05 CDT 2021
Module: wine
Branch: master
Commit: e122da03ada632470c45d9d3091fd1983283fd8b
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e122da03ada632470c45d9d3091fd1983283fd8b
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Sep 23 13:44:04 2021 +0100
gdi32: Directly use ntdll in load_gdi_font_replacements.
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 | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 6af91da7869..c91ce3c8792 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -792,21 +792,24 @@ static BOOL add_family_replacement( const WCHAR *new_name, const WCHAR *replace
*/
static void load_gdi_font_replacements(void)
{
+ char buffer[2048];
+ KEY_VALUE_FULL_INFORMATION *info = (KEY_VALUE_FULL_INFORMATION *)buffer;
HKEY hkey;
- DWORD i = 0, type, dlen, vlen;
- WCHAR value[LF_FACESIZE], data[1024];
+ DWORD i = 0;
+ WCHAR value[LF_FACESIZE];
+
+ static const WCHAR replacementsW[] = {'R','e','p','l','a','c','e','m','e','n','t','s'};
/* @@ Wine registry key: HKCU\Software\Wine\Fonts\Replacements */
- if (RegOpenKeyW( wine_fonts_key, L"Replacements", &hkey )) return;
+ if (!(hkey = reg_open_key( wine_fonts_key, replacementsW, sizeof(replacementsW) ))) return;
- dlen = sizeof(data);
- vlen = ARRAY_SIZE(value);
- while (!RegEnumValueW( hkey, i++, value, &vlen, NULL, &type, (BYTE *)data, &dlen ))
+ while (reg_enum_value( hkey, i++, info, sizeof(buffer), value, sizeof(value) ))
{
+ WCHAR *data = (WCHAR *)((char *)info + info->DataOffset);
/* "NewName"="Oldname" */
if (!find_family_from_any_name( value ))
{
- if (type == REG_MULTI_SZ)
+ if (info->Type == REG_MULTI_SZ)
{
WCHAR *replace = data;
while (*replace)
@@ -815,15 +818,11 @@ static void load_gdi_font_replacements(void)
replace += lstrlenW(replace) + 1;
}
}
- else if (type == REG_SZ) add_family_replacement( value, data );
+ else if (info->Type == REG_SZ) add_family_replacement( value, data );
}
else TRACE("%s is available. Skip this replacement.\n", debugstr_w(value));
-
- /* reset dlen and vlen */
- dlen = sizeof(data);
- vlen = ARRAY_SIZE(value);
}
- RegCloseKey( hkey );
+ NtClose( hkey );
}
static void dump_gdi_font_list(void)
More information about the wine-cvs
mailing list