diff options
| author | Rob Mensching <rob@firegiant.com> | 2025-11-01 21:52:31 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2025-11-03 14:49:39 -0800 |
| commit | d2ba0da55725f2908b67e1470afc7cfd71cb3d1f (patch) | |
| tree | c2a1db61c5fac031c698976106bba2c453d85ded /src/libs/dutil/WixToolset.DUtil/thmutil.cpp | |
| parent | 4d626c294c4783d454e27ea4e5614037dac8576e (diff) | |
| download | wix-d2ba0da55725f2908b67e1470afc7cfd71cb3d1f.tar.gz wix-d2ba0da55725f2908b67e1470afc7cfd71cb3d1f.tar.bz2 wix-d2ba0da55725f2908b67e1470afc7cfd71cb3d1f.zip | |
Use CompareStringOrdinal() instead of CompareString() case-sensitive
This commit moves to the modern CompareStringOrdinal() for all case-sensitve
uses of CompareString() with the invariant locale.
Resolves 6947
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/thmutil.cpp')
| -rw-r--r-- | src/libs/dutil/WixToolset.DUtil/thmutil.cpp | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/thmutil.cpp b/src/libs/dutil/WixToolset.DUtil/thmutil.cpp index 36b187a7..a7a7e45b 100644 --- a/src/libs/dutil/WixToolset.DUtil/thmutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/thmutil.cpp | |||
| @@ -1145,7 +1145,7 @@ DAPI_(void) ThemeGetPageIds( | |||
| 1145 | for (DWORD j = 0; j < pTheme->cPages; ++j) | 1145 | for (DWORD j = 0; j < pTheme->cPages; ++j) |
| 1146 | { | 1146 | { |
| 1147 | LPCWSTR wzPageName = pTheme->rgPages[j].sczName; | 1147 | LPCWSTR wzPageName = pTheme->rgPages[j].sczName; |
| 1148 | if (wzPageName && CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, wzPageName, -1, wzFindName, -1)) | 1148 | if (wzPageName && CSTR_EQUAL == ::CompareStringOrdinal(wzPageName, -1, wzFindName, -1, FALSE)) |
| 1149 | { | 1149 | { |
| 1150 | rgdwPageIds[i] = j + 1; // add one to make the page ids 1-based (so zero is invalid). | 1150 | rgdwPageIds[i] = j + 1; // add one to make the page ids 1-based (so zero is invalid). |
| 1151 | break; | 1151 | break; |
| @@ -2082,7 +2082,7 @@ static HRESULT ParseButtonImages( | |||
| 2082 | ThmExitOnFailure(hr, "Null element encountered!"); | 2082 | ThmExitOnFailure(hr, "Null element encountered!"); |
| 2083 | } | 2083 | } |
| 2084 | 2084 | ||
| 2085 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"ButtonFocusImage", -1)) | 2085 | if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"ButtonFocusImage", -1, FALSE)) |
| 2086 | { | 2086 | { |
| 2087 | if (pFocusImageRef) | 2087 | if (pFocusImageRef) |
| 2088 | { | 2088 | { |
| @@ -2091,7 +2091,7 @@ static HRESULT ParseButtonImages( | |||
| 2091 | 2091 | ||
| 2092 | pImageRef = pFocusImageRef = pControl->Button.rgImageRef + 3; | 2092 | pImageRef = pFocusImageRef = pControl->Button.rgImageRef + 3; |
| 2093 | } | 2093 | } |
| 2094 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"ButtonHoverImage", -1)) | 2094 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"ButtonHoverImage", -1, FALSE)) |
| 2095 | { | 2095 | { |
| 2096 | if (pHoverImageRef) | 2096 | if (pHoverImageRef) |
| 2097 | { | 2097 | { |
| @@ -2100,7 +2100,7 @@ static HRESULT ParseButtonImages( | |||
| 2100 | 2100 | ||
| 2101 | pImageRef = pHoverImageRef = pControl->Button.rgImageRef + 1; | 2101 | pImageRef = pHoverImageRef = pControl->Button.rgImageRef + 1; |
| 2102 | } | 2102 | } |
| 2103 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"ButtonSelectedImage", -1)) | 2103 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"ButtonSelectedImage", -1, FALSE)) |
| 2104 | { | 2104 | { |
| 2105 | if (pSelectedImageRef) | 2105 | if (pSelectedImageRef) |
| 2106 | { | 2106 | { |
| @@ -2776,35 +2776,35 @@ static HRESULT GetFontColor( | |||
| 2776 | 2776 | ||
| 2777 | if (pdwSystemColor) | 2777 | if (pdwSystemColor) |
| 2778 | { | 2778 | { |
| 2779 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstr, -1, L"btnface", -1)) | 2779 | if (CSTR_EQUAL == ::CompareStringOrdinal(bstr, -1, L"btnface", -1, FALSE)) |
| 2780 | { | 2780 | { |
| 2781 | *pdwSystemColor = COLOR_BTNFACE; | 2781 | *pdwSystemColor = COLOR_BTNFACE; |
| 2782 | } | 2782 | } |
| 2783 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstr, -1, L"btntext", -1)) | 2783 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstr, -1, L"btntext", -1, FALSE)) |
| 2784 | { | 2784 | { |
| 2785 | *pdwSystemColor = COLOR_BTNTEXT; | 2785 | *pdwSystemColor = COLOR_BTNTEXT; |
| 2786 | } | 2786 | } |
| 2787 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstr, -1, L"graytext", -1)) | 2787 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstr, -1, L"graytext", -1, FALSE)) |
| 2788 | { | 2788 | { |
| 2789 | *pdwSystemColor = COLOR_GRAYTEXT; | 2789 | *pdwSystemColor = COLOR_GRAYTEXT; |
| 2790 | } | 2790 | } |
| 2791 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstr, -1, L"highlight", -1)) | 2791 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstr, -1, L"highlight", -1, FALSE)) |
| 2792 | { | 2792 | { |
| 2793 | *pdwSystemColor = COLOR_HIGHLIGHT; | 2793 | *pdwSystemColor = COLOR_HIGHLIGHT; |
| 2794 | } | 2794 | } |
| 2795 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstr, -1, L"highlighttext", -1)) | 2795 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstr, -1, L"highlighttext", -1, FALSE)) |
| 2796 | { | 2796 | { |
| 2797 | *pdwSystemColor = COLOR_HIGHLIGHTTEXT; | 2797 | *pdwSystemColor = COLOR_HIGHLIGHTTEXT; |
| 2798 | } | 2798 | } |
| 2799 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstr, -1, L"hotlight", -1)) | 2799 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstr, -1, L"hotlight", -1, FALSE)) |
| 2800 | { | 2800 | { |
| 2801 | *pdwSystemColor = COLOR_HOTLIGHT; | 2801 | *pdwSystemColor = COLOR_HOTLIGHT; |
| 2802 | } | 2802 | } |
| 2803 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstr, -1, L"window", -1)) | 2803 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstr, -1, L"window", -1, FALSE)) |
| 2804 | { | 2804 | { |
| 2805 | *pdwSystemColor = COLOR_WINDOW; | 2805 | *pdwSystemColor = COLOR_WINDOW; |
| 2806 | } | 2806 | } |
| 2807 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstr, -1, L"windowtext", -1)) | 2807 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstr, -1, L"windowtext", -1, FALSE)) |
| 2808 | { | 2808 | { |
| 2809 | *pdwSystemColor = COLOR_WINDOWTEXT; | 2809 | *pdwSystemColor = COLOR_WINDOWTEXT; |
| 2810 | } | 2810 | } |
| @@ -3229,71 +3229,71 @@ static HRESULT ParseControls( | |||
| 3229 | ThmExitOnFailure(hr, "Null element encountered!"); | 3229 | ThmExitOnFailure(hr, "Null element encountered!"); |
| 3230 | } | 3230 | } |
| 3231 | 3231 | ||
| 3232 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"Billboard", -1)) | 3232 | if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"Billboard", -1, FALSE)) |
| 3233 | { | 3233 | { |
| 3234 | type = THEME_CONTROL_TYPE_BILLBOARD; | 3234 | type = THEME_CONTROL_TYPE_BILLBOARD; |
| 3235 | } | 3235 | } |
| 3236 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"Button", -1)) | 3236 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"Button", -1, FALSE)) |
| 3237 | { | 3237 | { |
| 3238 | type = THEME_CONTROL_TYPE_BUTTON; | 3238 | type = THEME_CONTROL_TYPE_BUTTON; |
| 3239 | } | 3239 | } |
| 3240 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"Checkbox", -1)) | 3240 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"Checkbox", -1, FALSE)) |
| 3241 | { | 3241 | { |
| 3242 | type = THEME_CONTROL_TYPE_CHECKBOX; | 3242 | type = THEME_CONTROL_TYPE_CHECKBOX; |
| 3243 | } | 3243 | } |
| 3244 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"Combobox", -1)) | 3244 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"Combobox", -1, FALSE)) |
| 3245 | { | 3245 | { |
| 3246 | type = THEME_CONTROL_TYPE_COMBOBOX; | 3246 | type = THEME_CONTROL_TYPE_COMBOBOX; |
| 3247 | } | 3247 | } |
| 3248 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"CommandLink", -1)) | 3248 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"CommandLink", -1, FALSE)) |
| 3249 | { | 3249 | { |
| 3250 | type = THEME_CONTROL_TYPE_COMMANDLINK; | 3250 | type = THEME_CONTROL_TYPE_COMMANDLINK; |
| 3251 | } | 3251 | } |
| 3252 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"Editbox", -1)) | 3252 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"Editbox", -1, FALSE)) |
| 3253 | { | 3253 | { |
| 3254 | type = THEME_CONTROL_TYPE_EDITBOX; | 3254 | type = THEME_CONTROL_TYPE_EDITBOX; |
| 3255 | } | 3255 | } |
| 3256 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"Hyperlink", -1)) | 3256 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"Hyperlink", -1, FALSE)) |
| 3257 | { | 3257 | { |
| 3258 | type = THEME_CONTROL_TYPE_HYPERLINK; | 3258 | type = THEME_CONTROL_TYPE_HYPERLINK; |
| 3259 | } | 3259 | } |
| 3260 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"Hypertext", -1)) | 3260 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"Hypertext", -1, FALSE)) |
| 3261 | { | 3261 | { |
| 3262 | type = THEME_CONTROL_TYPE_HYPERTEXT; | 3262 | type = THEME_CONTROL_TYPE_HYPERTEXT; |
| 3263 | } | 3263 | } |
| 3264 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"ImageControl", -1)) | 3264 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"ImageControl", -1, FALSE)) |
| 3265 | { | 3265 | { |
| 3266 | type = THEME_CONTROL_TYPE_IMAGE; | 3266 | type = THEME_CONTROL_TYPE_IMAGE; |
| 3267 | } | 3267 | } |
| 3268 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"Label", -1)) | 3268 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"Label", -1, FALSE)) |
| 3269 | { | 3269 | { |
| 3270 | type = THEME_CONTROL_TYPE_LABEL; | 3270 | type = THEME_CONTROL_TYPE_LABEL; |
| 3271 | } | 3271 | } |
| 3272 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"ListView", -1)) | 3272 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"ListView", -1, FALSE)) |
| 3273 | { | 3273 | { |
| 3274 | type = THEME_CONTROL_TYPE_LISTVIEW; | 3274 | type = THEME_CONTROL_TYPE_LISTVIEW; |
| 3275 | } | 3275 | } |
| 3276 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"Panel", -1)) | 3276 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"Panel", -1, FALSE)) |
| 3277 | { | 3277 | { |
| 3278 | type = THEME_CONTROL_TYPE_PANEL; | 3278 | type = THEME_CONTROL_TYPE_PANEL; |
| 3279 | } | 3279 | } |
| 3280 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"Progressbar", -1)) | 3280 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"Progressbar", -1, FALSE)) |
| 3281 | { | 3281 | { |
| 3282 | type = THEME_CONTROL_TYPE_PROGRESSBAR; | 3282 | type = THEME_CONTROL_TYPE_PROGRESSBAR; |
| 3283 | } | 3283 | } |
| 3284 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"Richedit", -1)) | 3284 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"Richedit", -1, FALSE)) |
| 3285 | { | 3285 | { |
| 3286 | type = THEME_CONTROL_TYPE_RICHEDIT; | 3286 | type = THEME_CONTROL_TYPE_RICHEDIT; |
| 3287 | } | 3287 | } |
| 3288 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"Static", -1)) | 3288 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"Static", -1, FALSE)) |
| 3289 | { | 3289 | { |
| 3290 | type = THEME_CONTROL_TYPE_STATIC; | 3290 | type = THEME_CONTROL_TYPE_STATIC; |
| 3291 | } | 3291 | } |
| 3292 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"Tabs", -1)) | 3292 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"Tabs", -1, FALSE)) |
| 3293 | { | 3293 | { |
| 3294 | type = THEME_CONTROL_TYPE_TAB; | 3294 | type = THEME_CONTROL_TYPE_TAB; |
| 3295 | } | 3295 | } |
| 3296 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"TreeView", -1)) | 3296 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"TreeView", -1, FALSE)) |
| 3297 | { | 3297 | { |
| 3298 | type = THEME_CONTROL_TYPE_TREEVIEW; | 3298 | type = THEME_CONTROL_TYPE_TREEVIEW; |
| 3299 | } | 3299 | } |
| @@ -3705,14 +3705,14 @@ static HRESULT ParseActions( | |||
| 3705 | 3705 | ||
| 3706 | THEME_ACTION* pAction = pControl->rgActions + i; | 3706 | THEME_ACTION* pAction = pControl->rgActions + i; |
| 3707 | 3707 | ||
| 3708 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"BrowseDirectoryAction", -1)) | 3708 | if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"BrowseDirectoryAction", -1, FALSE)) |
| 3709 | { | 3709 | { |
| 3710 | pAction->type = THEME_ACTION_TYPE_BROWSE_DIRECTORY; | 3710 | pAction->type = THEME_ACTION_TYPE_BROWSE_DIRECTORY; |
| 3711 | 3711 | ||
| 3712 | hr = XmlGetAttributeEx(pixnChild, L"VariableName", &pAction->BrowseDirectory.sczVariableName); | 3712 | hr = XmlGetAttributeEx(pixnChild, L"VariableName", &pAction->BrowseDirectory.sczVariableName); |
| 3713 | ThmExitOnFailure(hr, "Failed when querying BrowseDirectoryAction/@VariableName attribute."); | 3713 | ThmExitOnFailure(hr, "Failed when querying BrowseDirectoryAction/@VariableName attribute."); |
| 3714 | } | 3714 | } |
| 3715 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"ChangePageAction", -1)) | 3715 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"ChangePageAction", -1, FALSE)) |
| 3716 | { | 3716 | { |
| 3717 | pAction->type = THEME_ACTION_TYPE_CHANGE_PAGE; | 3717 | pAction->type = THEME_ACTION_TYPE_CHANGE_PAGE; |
| 3718 | 3718 | ||
| @@ -3725,7 +3725,7 @@ static HRESULT ParseActions( | |||
| 3725 | ThmExitOnFailure(hr, "Failed when querying ChangePageAction/@Cancel attribute."); | 3725 | ThmExitOnFailure(hr, "Failed when querying ChangePageAction/@Cancel attribute."); |
| 3726 | } | 3726 | } |
| 3727 | } | 3727 | } |
| 3728 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"CloseWindowAction", -1)) | 3728 | else if (CSTR_EQUAL == ::CompareStringOrdinal(bstrType, -1, L"CloseWindowAction", -1, FALSE)) |
| 3729 | { | 3729 | { |
| 3730 | pAction->type = THEME_ACTION_TYPE_CLOSE_WINDOW; | 3730 | pAction->type = THEME_ACTION_TYPE_CLOSE_WINDOW; |
| 3731 | } | 3731 | } |
| @@ -4367,7 +4367,7 @@ static HRESULT FindImageList( | |||
| 4367 | 4367 | ||
| 4368 | for (DWORD i = 0; i < pTheme->cImageLists; ++i) | 4368 | for (DWORD i = 0; i < pTheme->cImageLists; ++i) |
| 4369 | { | 4369 | { |
| 4370 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, pTheme->rgImageLists[i].sczName, -1, wzImageListName, -1)) | 4370 | if (CSTR_EQUAL == ::CompareStringOrdinal(pTheme->rgImageLists[i].sczName, -1, wzImageListName, -1, FALSE)) |
| 4371 | { | 4371 | { |
| 4372 | *phImageList = pTheme->rgImageLists[i].hImageList; | 4372 | *phImageList = pTheme->rgImageLists[i].hImageList; |
| 4373 | ExitFunction1(hr = S_OK); | 4373 | ExitFunction1(hr = S_OK); |
| @@ -5027,7 +5027,7 @@ static void OnBrowseDirectory( | |||
| 5027 | THEME_CONTROL* pControl = pTheme->rgControls + i; | 5027 | THEME_CONTROL* pControl = pTheme->rgControls + i; |
| 5028 | 5028 | ||
| 5029 | if ((!pControl->wPageId || pControl->wPageId == pTheme->dwCurrentPageId) && | 5029 | if ((!pControl->wPageId || pControl->wPageId == pTheme->dwCurrentPageId) && |
| 5030 | CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, pControl->sczName, -1, pAction->BrowseDirectory.sczVariableName, -1)) | 5030 | CSTR_EQUAL == ::CompareStringOrdinal(pControl->sczName, -1, pAction->BrowseDirectory.sczVariableName, -1, FALSE)) |
| 5031 | { | 5031 | { |
| 5032 | pTargetControl = pControl; | 5032 | pTargetControl = pControl; |
| 5033 | break; | 5033 | break; |
| @@ -5790,7 +5790,7 @@ static HRESULT ShowControl( | |||
| 5790 | 5790 | ||
| 5791 | hr = S_OK; | 5791 | hr = S_OK; |
| 5792 | 5792 | ||
| 5793 | Button_SetCheck(hWnd, (!sczText && !pControl->sczValue) || (sczText && CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, sczText, -1, pControl->sczValue, -1))); | 5793 | Button_SetCheck(hWnd, (!sczText && !pControl->sczValue) || (sczText && CSTR_EQUAL == ::CompareStringOrdinal(sczText, -1, pControl->sczValue, -1, FALSE))); |
| 5794 | } | 5794 | } |
| 5795 | } | 5795 | } |
| 5796 | 5796 | ||
