uxtheme: Use wide character string literals.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2021-09-22 10:22:33 +08:00 committed by Alexandre Julliard
parent a622753186
commit af48d90a6f
1 changed files with 43 additions and 44 deletions

View File

@ -199,39 +199,39 @@ static void UXTHEME_LoadTheme(void)
/***********************************************************************/ /***********************************************************************/
static const char * const SysColorsNames[] = static const WCHAR * const SysColorsNames[] =
{ {
"Scrollbar", /* COLOR_SCROLLBAR */ L"Scrollbar", /* COLOR_SCROLLBAR */
"Background", /* COLOR_BACKGROUND */ L"Background", /* COLOR_BACKGROUND */
"ActiveTitle", /* COLOR_ACTIVECAPTION */ L"ActiveTitle", /* COLOR_ACTIVECAPTION */
"InactiveTitle", /* COLOR_INACTIVECAPTION */ L"InactiveTitle", /* COLOR_INACTIVECAPTION */
"Menu", /* COLOR_MENU */ L"Menu", /* COLOR_MENU */
"Window", /* COLOR_WINDOW */ L"Window", /* COLOR_WINDOW */
"WindowFrame", /* COLOR_WINDOWFRAME */ L"WindowFrame", /* COLOR_WINDOWFRAME */
"MenuText", /* COLOR_MENUTEXT */ L"MenuText", /* COLOR_MENUTEXT */
"WindowText", /* COLOR_WINDOWTEXT */ L"WindowText", /* COLOR_WINDOWTEXT */
"TitleText", /* COLOR_CAPTIONTEXT */ L"TitleText", /* COLOR_CAPTIONTEXT */
"ActiveBorder", /* COLOR_ACTIVEBORDER */ L"ActiveBorder", /* COLOR_ACTIVEBORDER */
"InactiveBorder", /* COLOR_INACTIVEBORDER */ L"InactiveBorder", /* COLOR_INACTIVEBORDER */
"AppWorkSpace", /* COLOR_APPWORKSPACE */ L"AppWorkSpace", /* COLOR_APPWORKSPACE */
"Hilight", /* COLOR_HIGHLIGHT */ L"Hilight", /* COLOR_HIGHLIGHT */
"HilightText", /* COLOR_HIGHLIGHTTEXT */ L"HilightText", /* COLOR_HIGHLIGHTTEXT */
"ButtonFace", /* COLOR_BTNFACE */ L"ButtonFace", /* COLOR_BTNFACE */
"ButtonShadow", /* COLOR_BTNSHADOW */ L"ButtonShadow", /* COLOR_BTNSHADOW */
"GrayText", /* COLOR_GRAYTEXT */ L"GrayText", /* COLOR_GRAYTEXT */
"ButtonText", /* COLOR_BTNTEXT */ L"ButtonText", /* COLOR_BTNTEXT */
"InactiveTitleText", /* COLOR_INACTIVECAPTIONTEXT */ L"InactiveTitleText", /* COLOR_INACTIVECAPTIONTEXT */
"ButtonHilight", /* COLOR_BTNHIGHLIGHT */ L"ButtonHilight", /* COLOR_BTNHIGHLIGHT */
"ButtonDkShadow", /* COLOR_3DDKSHADOW */ L"ButtonDkShadow", /* COLOR_3DDKSHADOW */
"ButtonLight", /* COLOR_3DLIGHT */ L"ButtonLight", /* COLOR_3DLIGHT */
"InfoText", /* COLOR_INFOTEXT */ L"InfoText", /* COLOR_INFOTEXT */
"InfoWindow", /* COLOR_INFOBK */ L"InfoWindow", /* COLOR_INFOBK */
"ButtonAlternateFace", /* COLOR_ALTERNATEBTNFACE */ L"ButtonAlternateFace", /* COLOR_ALTERNATEBTNFACE */
"HotTrackingColor", /* COLOR_HOTLIGHT */ L"HotTrackingColor", /* COLOR_HOTLIGHT */
"GradientActiveTitle", /* COLOR_GRADIENTACTIVECAPTION */ L"GradientActiveTitle", /* COLOR_GRADIENTACTIVECAPTION */
"GradientInactiveTitle", /* COLOR_GRADIENTINACTIVECAPTION */ L"GradientInactiveTitle", /* COLOR_GRADIENTINACTIVECAPTION */
"MenuHilight", /* COLOR_MENUHILIGHT */ L"MenuHilight", /* COLOR_MENUHILIGHT */
"MenuBar", /* COLOR_MENUBAR */ L"MenuBar", /* COLOR_MENUBAR */
}; };
static const WCHAR strColorKey[] = L"Control Panel\\Colors"; static const WCHAR strColorKey[] = L"Control Panel\\Colors";
@ -251,9 +251,9 @@ static const struct BackupSysParam
static void save_sys_colors (HKEY baseKey) static void save_sys_colors (HKEY baseKey)
{ {
char colorStr[13]; WCHAR colorStr[13];
HKEY hKey; HKEY hKey;
int i; int i, length;
if (RegCreateKeyExW( baseKey, strColorKey, if (RegCreateKeyExW( baseKey, strColorKey,
0, 0, 0, KEY_ALL_ACCESS, 0, 0, 0, KEY_ALL_ACCESS,
@ -262,12 +262,11 @@ static void save_sys_colors (HKEY baseKey)
for (i = 0; i < NUM_SYS_COLORS; i++) for (i = 0; i < NUM_SYS_COLORS; i++)
{ {
COLORREF col = GetSysColor (i); COLORREF col = GetSysColor (i);
sprintf (colorStr, "%d %d %d",
GetRValue (col), GetGValue (col), GetBValue (col));
RegSetValueExA (hKey, SysColorsNames[i], 0, REG_SZ, length = swprintf(colorStr, ARRAY_SIZE(colorStr), L"%d %d %d", GetRValue(col),
(BYTE*)colorStr, strlen (colorStr)+1); GetGValue(col), GetBValue(col));
RegSetValueExW(hKey, SysColorsNames[i], 0, REG_SZ, (BYTE *)colorStr,
(length + 1) * sizeof(WCHAR));
} }
RegCloseKey (hKey); RegCloseKey (hKey);
} }
@ -350,14 +349,14 @@ static void UXTHEME_RestoreSystemMetrics(void)
for (i = 0; i < NUM_SYS_COLORS; i++) for (i = 0; i < NUM_SYS_COLORS; i++)
{ {
DWORD type; DWORD type;
char colorStr[13]; WCHAR colorStr[13];
DWORD count = sizeof(colorStr); DWORD count = sizeof(colorStr);
if (RegQueryValueExA (colorKey, SysColorsNames[i], 0, if (RegQueryValueExW(colorKey, SysColorsNames[i], 0, &type, (LPBYTE)colorStr,
&type, (LPBYTE) colorStr, &count) == ERROR_SUCCESS) &count) == ERROR_SUCCESS)
{ {
int r, g, b; int r, g, b;
if (sscanf (colorStr, "%d %d %d", &r, &g, &b) == 3) if (swscanf(colorStr, L"%d %d %d", &r, &g, &b) == 3)
{ {
sysColsIndices[sysColCount] = i; sysColsIndices[sysColCount] = i;
sysCols[sysColCount] = RGB(r, g, b); sysCols[sysColCount] = RGB(r, g, b);