From: Rémi Bernon rbernon@codeweavers.com
--- dlls/uxtheme/msstyles.c | 4 ++-- dlls/uxtheme/msstyles.h | 2 +- dlls/uxtheme/stylemap.c | 47 ++++++++++++++++------------------------- dlls/uxtheme/system.c | 5 ++++- 4 files changed, 25 insertions(+), 33 deletions(-)
diff --git a/dlls/uxtheme/msstyles.c b/dlls/uxtheme/msstyles.c index 4dcd87d3d0b..aa1f10949ce 100644 --- a/dlls/uxtheme/msstyles.c +++ b/dlls/uxtheme/msstyles.c @@ -934,7 +934,7 @@ static void MSSTYLES_ParseThemeIni(PTHEME_FILE tf, BOOL setMetrics) parse_init_nonclient (&nonClientState);
while((lpName=UXINI_GetNextValue(ini, &dwLen, &lpValue, &dwValueLen))) { - lstrcpynW(szPropertyName, lpName, min(dwLen+1, ARRAY_SIZE(szPropertyName))); + strupperW(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, @@ -985,7 +985,7 @@ static void MSSTYLES_ParseThemeIni(PTHEME_FILE tf, BOOL setMetrics) ps = MSSTYLES_AddPartState(cls, iPartId, iStateId);
while((lpName=UXINI_GetNextValue(ini, &dwLen, &lpValue, &dwValueLen))) { - lstrcpynW(szPropertyName, lpName, min(dwLen+1, ARRAY_SIZE(szPropertyName))); + strupperW(szPropertyName, lpName, min(dwLen + 1, ARRAY_SIZE(szPropertyName))); if(MSSTYLES_LookupProperty(szPropertyName, &iPropertyPrimitive, &iPropertyId)) { MSSTYLES_AddProperty(ps, iPropertyPrimitive, iPropertyId, lpValue, dwValueLen, isGlobal); } diff --git a/dlls/uxtheme/msstyles.h b/dlls/uxtheme/msstyles.h index 2c75f7b00aa..cbb6b5b467b 100644 --- a/dlls/uxtheme/msstyles.h +++ b/dlls/uxtheme/msstyles.h @@ -94,7 +94,7 @@ void MSSTYLES_CloseThemeFile(PTHEME_FILE tf) DECLSPEC_HIDDEN; HRESULT MSSTYLES_SetActiveTheme(PTHEME_FILE tf, BOOL setMetrics) DECLSPEC_HIDDEN; PTHEME_CLASS MSSTYLES_OpenThemeClass(LPCWSTR pszAppName, LPCWSTR pszClassList, UINT dpi) DECLSPEC_HIDDEN; HRESULT MSSTYLES_CloseThemeClass(PTHEME_CLASS tc) DECLSPEC_HIDDEN; -BOOL MSSTYLES_LookupProperty(LPCWSTR pszPropertyName, int *dwPrimitive, int *dwId) DECLSPEC_HIDDEN; +BOOL MSSTYLES_LookupProperty(const WCHAR *prop_name, int *primitive, int *id) DECLSPEC_HIDDEN; BOOL MSSTYLES_LookupEnum(const WCHAR *enum_name, int enum_type, int *enum_value) DECLSPEC_HIDDEN; BOOL MSSTYLES_LookupPartState(LPCWSTR pszClass, LPCWSTR pszPart, LPCWSTR pszState, int *iPartId, int *iStateId) DECLSPEC_HIDDEN; PUXINI_FILE MSSTYLES_GetThemeIni(PTHEME_FILE tf) DECLSPEC_HIDDEN; diff --git a/dlls/uxtheme/stylemap.c b/dlls/uxtheme/stylemap.c index 6fdf7f894ce..dd54507b5a5 100644 --- a/dlls/uxtheme/stylemap.c +++ b/dlls/uxtheme/stylemap.c @@ -29,11 +29,12 @@ #define TMT_ENUM 200 #define TMT_STOCKIMAGEFILE 3007
-typedef struct _MSSTYLES_PROPERTY_MAP { - WORD dwPrimitiveType; - WORD dwPropertyID; - WCHAR szPropertyName[24]; -} MSSTYLES_PROPERTY_MAP, *PMSSTYLES_PROPERTY_MAP; +struct property_desc +{ + WORD primitive; + WORD id; + WCHAR prop_name[24]; +};
struct enum_desc { @@ -57,7 +58,8 @@ typedef struct _MSSTYLES_CLASS_NAME { * Map property names to IDs & primitive types * PrimitiveType,PropertyID,PropertyName */ -static const MSSTYLES_PROPERTY_MAP mapProperty[] = { +static const struct property_desc property_descs[] = +{ {TMT_STRING, TMT_STRING, L"STRING"}, {TMT_INT, TMT_INT, L"INT"}, {TMT_BOOL, TMT_BOOL, L"BOOL"}, @@ -1487,30 +1489,17 @@ BOOL MSSTYLES_LookupPartState(LPCWSTR pszClass, LPCWSTR pszPart, LPCWSTR pszStat return TRUE; }
-/********************************************************************** - * MSSTYLES_LookupProperty - * - * Find a property ID from name - * - * PARAMS - * pszPropertyName Name of property to lookup - * dwPrimitive Location to store primitive type of property - * dwId Location to store ID of property - * - * RETURNS - * FALSE if value is not found, TRUE otherwise - */ -BOOL MSSTYLES_LookupProperty(LPCWSTR pszPropertyName, int *dwPrimitive, int *dwId) +/* prop_name must be upper case */ +BOOL MSSTYLES_LookupProperty(const WCHAR *prop_name, int *primitive, int *id) { - DWORD item = 0; - do { - if(!lstrcmpiW(mapProperty[item].szPropertyName, pszPropertyName)) { - if(dwPrimitive) *dwPrimitive = mapProperty[item].dwPrimitiveType; - if(dwId) *dwId = mapProperty[item].dwPropertyID; - return TRUE; - } - } while(*mapProperty[++item].szPropertyName); - return FALSE; + const struct property_desc *item = property_descs; + + while (*item->prop_name && wcscmp(item->prop_name, prop_name)) item++; + if (!*item->prop_name) return FALSE; + + if (primitive) *primitive = item->primitive; + if (id) *id = item->id; + return TRUE; }
/* enum_name must be upper case */ diff --git a/dlls/uxtheme/system.c b/dlls/uxtheme/system.c index 25f495d29f3..f8a8848e97a 100644 --- a/dlls/uxtheme/system.c +++ b/dlls/uxtheme/system.c @@ -834,6 +834,7 @@ HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName, TMT_VERSION,5006, TMT_DESCRIPTION,5007 }; + WCHAR buffer[24];
PTHEME_FILE pt; HRESULT hr; @@ -847,7 +848,9 @@ HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName,
/* Try to load from string resources */ hr = E_PROP_ID_UNSUPPORTED; - if(MSSTYLES_LookupProperty(pszPropertyName, NULL, &iDocId)) { + strupperW(buffer, pszPropertyName, ARRAY_SIZE(buffer)); + if (MSSTYLES_LookupProperty(buffer, NULL, &iDocId)) + { for(i=0; i<ARRAY_SIZE(wDocToRes); i+=2) { if(wDocToRes[i] == iDocId) { if(LoadStringW(pt->hTheme, wDocToRes[i+1], pszValueBuff, cchMaxValChars)) {