Jacek Caban : gdi32: Directly use ntdll in update_font_association_info.

Alexandre Julliard julliard at winehq.org
Thu Sep 23 15:35:06 CDT 2021


Module: wine
Branch: master
Commit: b645d4f5b3d1b66b81b6ae4cd77fc3800a4adade
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b645d4f5b3d1b66b81b6ae4cd77fc3800a4adade

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Sep 23 13:44:11 2021 +0100

gdi32: Directly use ntdll in update_font_association_info.

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 | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 4b3c93d9853..274c1d83aba 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -2481,20 +2481,28 @@ static void add_font_list(HKEY hkey, const struct nls_update_font_list *fl, int
 static void set_value_key(HKEY hkey, const char *name, const char *value)
 {
     if (value)
-        RegSetValueExA(hkey, name, 0, REG_SZ, (const BYTE *)value, strlen(value) + 1);
+        set_reg_ascii_value( hkey, name, value );
     else if (name)
-        RegDeleteValueA(hkey, name);
+    {
+        WCHAR nameW[64];
+        asciiz_to_unicode( nameW, name );
+        reg_delete_value( hkey, nameW );
+    }
 }
 
 static void update_font_association_info(UINT current_ansi_codepage)
 {
+    static const WCHAR associated_charsetW[] =
+        { 'A','s','s','o','c','i','a','t','e','d',' ','C','h','a','r','s','e','t' };
+
     if (is_dbcs_ansi_cp(current_ansi_codepage))
     {
         HKEY hkey;
-        if (RegCreateKeyW(HKEY_LOCAL_MACHINE, L"System\\CurrentControlSet\\Control\\FontAssoc", &hkey) == ERROR_SUCCESS)
+        if ((hkey = reg_create_key( NULL, font_assoc_keyW, sizeof(font_assoc_keyW), 0, NULL )))
         {
             HKEY hsubkey;
-            if (RegCreateKeyW(hkey, L"Associated Charset", &hsubkey) == ERROR_SUCCESS)
+            if ((hsubkey = reg_create_key( hkey, associated_charsetW, sizeof(associated_charsetW),
+                                           0, NULL )))
             {
                 switch (current_ansi_codepage)
                 {
@@ -2511,12 +2519,12 @@ static void update_font_association_info(UINT current_ansi_codepage)
                     set_value_key(hsubkey, "SYMBOL(02)", "NO");
                     break;
                 }
-                RegCloseKey(hsubkey);
+                NtClose( hsubkey );
             }
 
             /* TODO: Associated DefaultFonts */
 
-            RegCloseKey(hkey);
+            NtClose( hkey );
         }
     }
     else




More information about the wine-cvs mailing list