[PATCH] uxtheme: Avoid calling SystemParametersInfo in MSSTYLES_ParseThemeIni unless necessary.

Mark Harmstone mark at harmstone.com
Tue Apr 6 14:50:27 CDT 2021


When setMetrics is FALSE, uxtheme currently gets data from
SystemParametersInfoW only to discard it. This also has the effect of
meaning you can't use uxtheme from user32, as it causes an infinite loop
when wineserver is started.

Signed-off-by: Mark Harmstone <mark at harmstone.com>
---
 dlls/uxtheme/msstyles.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/uxtheme/msstyles.c b/dlls/uxtheme/msstyles.c
index ed22d923250..2cd0c139185 100644
--- a/dlls/uxtheme/msstyles.c
+++ b/dlls/uxtheme/msstyles.c
@@ -870,14 +870,16 @@ static void MSSTYLES_ParseThemeIni(PTHEME_FILE tf, BOOL setMetrics)
             struct PARSECOLORSTATE colorState;
             struct PARSENONCLIENTSTATE nonClientState;
             
-            parse_init_color (&colorState);
-            parse_init_nonclient (&nonClientState);
+            if (setMetrics) {
+                parse_init_color (&colorState);
+                parse_init_nonclient (&nonClientState);
+            }
 
             while((lpName=UXINI_GetNextValue(ini, &dwLen, &lpValue, &dwValueLen))) {
                 lstrcpynW(szPropertyName, lpName, min(dwLen+1, ARRAY_SIZE(szPropertyName)));
                 if(MSSTYLES_LookupProperty(szPropertyName, &iPropertyPrimitive, &iPropertyId)) {
                     if(iPropertyId >= TMT_FIRSTCOLOR && iPropertyId <= TMT_LASTCOLOR) {
-                        if (!parse_handle_color_property (&colorState, iPropertyId, 
+                        if (setMetrics && !parse_handle_color_property (&colorState, iPropertyId,
                             lpValue, dwValueLen))
                             FIXME("Invalid color value for %s\n", 
                                 debugstr_w(szPropertyName)); 
@@ -889,7 +891,7 @@ static void MSSTYLES_ParseThemeIni(PTHEME_FILE tf, BOOL setMetrics)
 		    else if ((iPropertyId >= TMT_FIRSTFONT) 
 			&& (iPropertyId <= TMT_LASTFONT))
 		    {
-		        if (!parse_handle_nonclient_font (&nonClientState,
+                       if (setMetrics && !parse_handle_nonclient_font (&nonClientState,
 		            iPropertyId, lpValue, dwValueLen))
                             FIXME("Invalid font value for %s\n", 
                                 debugstr_w(szPropertyName)); 
@@ -897,7 +899,7 @@ static void MSSTYLES_ParseThemeIni(PTHEME_FILE tf, BOOL setMetrics)
 		    else if ((iPropertyId >= TMT_FIRSTSIZE)
 			&& (iPropertyId <= TMT_LASTSIZE))
 		    {
-		        if (!parse_handle_nonclient_size (&nonClientState,
+                       if (setMetrics && !parse_handle_nonclient_size (&nonClientState,
 		            iPropertyId, lpValue, dwValueLen))
                             FIXME("Invalid size value for %s\n", 
                                 debugstr_w(szPropertyName)); 
-- 
2.26.3




More information about the wine-devel mailing list