[PATCH] gdi32: Create the Software\Wine\Fonts keys one at a time.

Gabriel Ivăncescu gabrielopcode at gmail.com
Sat Oct 2 08:15:15 CDT 2021


Fixes a regression introduced by 1cdc74b2d62d1c94005c46f9c8f4b566aa8bdcbd
when creating new prefixes, as NtCreateKey does not recursively create keys.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/gdi32/font.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 98c70a6..31310b1 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -6209,19 +6209,31 @@ UINT font_init(void)
     OBJECT_ATTRIBUTES attr = { sizeof(attr) };
     UNICODE_STRING name;
     HANDLE mutex, hkcu;
+    HKEY key, wine_key;
     DWORD disposition;
     UINT dpi = 0;
 
     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','_','_'};
-    static const WCHAR wine_fonts_keyW[] =
-        {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\','F','o','n','t','s'};
+    static const WCHAR softwareW[] = {'S','o','f','t','w','a','r','e'};
+    static const WCHAR wineW[] = {'W','i','n','e'};
+    static const WCHAR fontsW[] = {'F','o','n','t','s'};
     static const WCHAR cacheW[] = {'C','a','c','h','e'};
 
     if (RtlOpenCurrentUser( MAXIMUM_ALLOWED, &hkcu )) return 0;
-    wine_fonts_key = reg_create_key( hkcu, wine_fonts_keyW, sizeof(wine_fonts_keyW), 0, NULL );
-    if (wine_fonts_key) dpi = init_font_options( hkcu );
+    key = reg_create_key( hkcu, softwareW, sizeof(softwareW), 0, NULL );
+    if (key)
+    {
+        wine_key = reg_create_key( key, wineW, sizeof(wineW), 0, NULL );
+        NtClose( key );
+        if (wine_key)
+        {
+            wine_fonts_key = reg_create_key( wine_key, fontsW, sizeof(fontsW), 0, NULL );
+            NtClose( wine_key );
+            if (wine_fonts_key) dpi = init_font_options( hkcu );
+        }
+    }
     NtClose( hkcu );
     if (!dpi) return 96;
     update_codepage( dpi );
-- 
2.31.1




More information about the wine-devel mailing list