Commit 1f040d66 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

uxtheme: Use wide-char string literals.

parent e947b081
......@@ -49,7 +49,6 @@ extern ATOM atDialogThemeEnabled;
*/
HRESULT WINAPI EnableThemeDialogTexture(HWND hwnd, DWORD dwFlags)
{
static const WCHAR szTab[] = { 'T','a','b',0 };
BOOL res;
TRACE("(%p,0x%08x\n", hwnd, dwFlags);
......@@ -59,7 +58,7 @@ HRESULT WINAPI EnableThemeDialogTexture(HWND hwnd, DWORD dwFlags)
if (!res)
return HRESULT_FROM_WIN32(GetLastError());
if (dwFlags & ETDT_USETABTEXTURE)
return SetWindowTheme (hwnd, NULL, szTab);
return SetWindowTheme (hwnd, NULL, L"Tab");
else
return SetWindowTheme (hwnd, NULL, NULL);
}
......
......@@ -50,10 +50,6 @@ extern int alphaBlendMode;
#define MSSTYLES_VERSION 0x0003
static const WCHAR szThemesIniResource[] = {
't','h','e','m','e','s','_','i','n','i','\0'
};
static PTHEME_FILE tfActiveTheme;
/***********************************************************************/
......@@ -78,15 +74,6 @@ HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWST
HMODULE hTheme;
HRSRC hrsc;
HRESULT hr = S_OK;
static const WCHAR szPackThemVersionResource[] = {
'P','A','C','K','T','H','E','M','_','V','E','R','S','I','O','N', '\0'
};
static const WCHAR szColorNamesResource[] = {
'C','O','L','O','R','N','A','M','E','S','\0'
};
static const WCHAR szSizeNamesResource[] = {
'S','I','Z','E','N','A','M','E','S','\0'
};
WORD version;
DWORD versize;
......@@ -105,7 +92,7 @@ HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWST
hr = HRESULT_FROM_WIN32(GetLastError());
goto invalid_theme;
}
if(!(hrsc = FindResourceW(hTheme, MAKEINTRESOURCEW(1), szPackThemVersionResource))) {
if(!(hrsc = FindResourceW(hTheme, MAKEINTRESOURCEW(1), L"PACKTHEM_VERSION"))) {
TRACE("No version resource found\n");
hr = HRESULT_FROM_WIN32(ERROR_BAD_FORMAT);
goto invalid_theme;
......@@ -124,14 +111,14 @@ HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWST
goto invalid_theme;
}
if(!(hrsc = FindResourceW(hTheme, MAKEINTRESOURCEW(1), szColorNamesResource))) {
if(!(hrsc = FindResourceW(hTheme, MAKEINTRESOURCEW(1), L"COLORNAMES"))) {
TRACE("Color names resource not found\n");
hr = HRESULT_FROM_WIN32(ERROR_BAD_FORMAT);
goto invalid_theme;
}
pszColors = LoadResource(hTheme, hrsc);
if(!(hrsc = FindResourceW(hTheme, MAKEINTRESOURCEW(1), szSizeNamesResource))) {
if(!(hrsc = FindResourceW(hTheme, MAKEINTRESOURCEW(1), L"SIZENAMES"))) {
TRACE("Size names resource not found\n");
hr = HRESULT_FROM_WIN32(ERROR_BAD_FORMAT);
goto invalid_theme;
......@@ -259,7 +246,7 @@ HRESULT MSSTYLES_SetActiveTheme(PTHEME_FILE tf, BOOL setMetrics)
*/
PUXINI_FILE MSSTYLES_GetThemeIni(PTHEME_FILE tf)
{
return UXINI_LoadINI(tf->hTheme, szThemesIniResource);
return UXINI_LoadINI(tf->hTheme, L"themes_ini");
}
/***********************************************************************
......@@ -269,9 +256,6 @@ PUXINI_FILE MSSTYLES_GetThemeIni(PTHEME_FILE tf)
*/
static PUXINI_FILE MSSTYLES_GetActiveThemeIni(PTHEME_FILE tf)
{
static const WCHAR szFileResNamesResource[] = {
'F','I','L','E','R','E','S','N','A','M','E','S','\0'
};
DWORD dwColorCount = 0;
DWORD dwSizeCount = 0;
DWORD dwColorNum = 0;
......@@ -299,7 +283,7 @@ static PUXINI_FILE MSSTYLES_GetActiveThemeIni(PTHEME_FILE tf)
dwSizeCount++;
}
if(!(hrsc = FindResourceW(tf->hTheme, MAKEINTRESOURCEW(1), szFileResNamesResource))) {
if(!(hrsc = FindResourceW(tf->hTheme, MAKEINTRESOURCEW(1), L"FILERESNAMES"))) {
TRACE("FILERESNAMES map not found\n");
return NULL;
}
......@@ -865,8 +849,6 @@ static void parse_apply_nonclient (struct PARSENONCLIENTSTATE* state)
*/
static void MSSTYLES_ParseThemeIni(PTHEME_FILE tf, BOOL setMetrics)
{
static const WCHAR szSysMetrics[] = {'S','y','s','M','e','t','r','i','c','s','\0'};
static const WCHAR szGlobals[] = {'g','l','o','b','a','l','s','\0'};
PTHEME_CLASS cls;
PTHEME_CLASS globals;
PTHEME_PARTSTATE ps;
......@@ -886,7 +868,7 @@ static void MSSTYLES_ParseThemeIni(PTHEME_FILE tf, BOOL setMetrics)
ini = MSSTYLES_GetActiveThemeIni(tf);
while((lpName=UXINI_GetNextSection(ini, &dwLen))) {
if(CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, lpName, dwLen, szSysMetrics, -1) == CSTR_EQUAL) {
if(CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, lpName, dwLen, L"SysMetrics", -1) == CSTR_EQUAL) {
struct PARSECOLORSTATE colorState;
struct PARSENONCLIENTSTATE nonClientState;
......@@ -938,7 +920,7 @@ static void MSSTYLES_ParseThemeIni(PTHEME_FILE tf, BOOL setMetrics)
}
if(MSSTYLES_ParseIniSectionName(lpName, dwLen, szAppName, szClassName, &iPartId, &iStateId)) {
BOOL isGlobal = FALSE;
if(!lstrcmpiW(szClassName, szGlobals)) {
if(!lstrcmpiW(szClassName, L"globals")) {
isGlobal = TRUE;
}
cls = MSSTYLES_AddClass(tf, szAppName, szClassName);
......@@ -957,7 +939,7 @@ static void MSSTYLES_ParseThemeIni(PTHEME_FILE tf, BOOL setMetrics)
}
/* App/Class combos override values defined by the base class, map these overrides */
globals = MSSTYLES_FindClass(tf, NULL, szGlobals);
globals = MSSTYLES_FindClass(tf, NULL, L"globals");
cls = tf->classes;
while(cls) {
if(*cls->szAppName) {
......@@ -1250,10 +1232,6 @@ HRESULT MSSTYLES_GetPropertyColor(PTHEME_PROPERTY tp, COLORREF *pColor)
static HRESULT MSSTYLES_GetFont (LPCWSTR lpCur, LPCWSTR lpEnd,
LPCWSTR *lpValEnd, LOGFONTW* pFont)
{
static const WCHAR szBold[] = {'b','o','l','d','\0'};
static const WCHAR szItalic[] = {'i','t','a','l','i','c','\0'};
static const WCHAR szUnderline[] = {'u','n','d','e','r','l','i','n','e','\0'};
static const WCHAR szStrikeOut[] = {'s','t','r','i','k','e','o','u','t','\0'};
int pointSize;
WCHAR attr[32];
......@@ -1271,10 +1249,10 @@ static HRESULT MSSTYLES_GetFont (LPCWSTR lpCur, LPCWSTR lpEnd,
pFont->lfWeight = FW_REGULAR;
pFont->lfCharSet = DEFAULT_CHARSET;
while(MSSTYLES_GetNextToken(lpCur, lpEnd, &lpCur, attr, ARRAY_SIZE(attr))) {
if(!lstrcmpiW(szBold, attr)) pFont->lfWeight = FW_BOLD;
else if(!lstrcmpiW(szItalic, attr)) pFont->lfItalic = TRUE;
else if(!lstrcmpiW(szUnderline, attr)) pFont->lfUnderline = TRUE;
else if(!lstrcmpiW(szStrikeOut, attr)) pFont->lfStrikeOut = TRUE;
if(!lstrcmpiW(L"bold", attr)) pFont->lfWeight = FW_BOLD;
else if(!lstrcmpiW(L"italic", attr)) pFont->lfItalic = TRUE;
else if(!lstrcmpiW(L"underline", attr)) pFont->lfUnderline = TRUE;
else if(!lstrcmpiW(L"strikeout", attr)) pFont->lfStrikeOut = TRUE;
}
*lpValEnd = lpCur;
return S_OK;
......
......@@ -41,19 +41,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
* Defines and global variables
*/
static const WCHAR szThemeManager[] = {
'S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\',
'W','i','n','d','o','w','s','\\',
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
'T','h','e','m','e','M','a','n','a','g','e','r','\0'
};
static const WCHAR szThemeActive[] = {'T','h','e','m','e','A','c','t','i','v','e','\0'};
static const WCHAR szSizeName[] = {'S','i','z','e','N','a','m','e','\0'};
static const WCHAR szColorName[] = {'C','o','l','o','r','N','a','m','e','\0'};
static const WCHAR szDllName[] = {'D','l','l','N','a','m','e','\0'};
static const WCHAR szIniDocumentation[] = {'d','o','c','u','m','e','n','t','a','t','i','o','n','\0'};
static const WCHAR szThemeManager[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\ThemeManager";
DECLSPEC_HIDDEN ATOM atDialogThemeEnabled;
......@@ -116,12 +104,12 @@ static DWORD query_reg_path (HKEY hKey, LPCWSTR lpszValue,
*/
if (dwRet == ERROR_MORE_DATA)
{
WCHAR cNull = '\0';
WCHAR emptyW[] = L"";
nBytesToAlloc = dwUnExpDataLen;
szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
RegQueryValueExW (hKey, lpszValue, 0, NULL, (LPBYTE)szData, &nBytesToAlloc);
dwExpDataLen = ExpandEnvironmentStringsW(szData, &cNull, 1);
dwExpDataLen = ExpandEnvironmentStringsW(szData, emptyW, 1);
dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
LocalFree(szData);
}
......@@ -158,7 +146,7 @@ static void UXTHEME_LoadTheme(void)
if(!RegOpenKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) {
TRACE("Loading theme config\n");
buffsize = ARRAY_SIZE(tmp);
if(!RegQueryValueExW(hKey, szThemeActive, NULL, NULL, (LPBYTE)tmp, &buffsize)) {
if (!RegQueryValueExW(hKey, L"ThemeActive", NULL, NULL, (BYTE*)tmp, &buffsize)) {
bThemeActive = (tmp[0] != '0');
}
else {
......@@ -166,12 +154,12 @@ static void UXTHEME_LoadTheme(void)
TRACE("Failed to get ThemeActive: %d\n", GetLastError());
}
buffsize = ARRAY_SIZE(szCurrentColor);
if(RegQueryValueExW(hKey, szColorName, NULL, NULL, (LPBYTE)szCurrentColor, &buffsize))
if (RegQueryValueExW(hKey, L"ColorName", NULL, NULL, (BYTE*)szCurrentColor, &buffsize))
szCurrentColor[0] = '\0';
buffsize = ARRAY_SIZE(szCurrentSize);
if(RegQueryValueExW(hKey, szSizeName, NULL, NULL, (LPBYTE)szCurrentSize, &buffsize))
if (RegQueryValueExW(hKey, L"SizeName", NULL, NULL, (BYTE*)szCurrentSize, &buffsize))
szCurrentSize[0] = '\0';
if (query_reg_path (hKey, szDllName, szCurrentTheme))
if (query_reg_path (hKey, L"DllName", szCurrentTheme))
szCurrentTheme[0] = '\0';
RegCloseKey(hKey);
}
......@@ -243,16 +231,8 @@ static const char * const SysColorsNames[] =
"MenuHilight", /* COLOR_MENUHILIGHT */
"MenuBar", /* COLOR_MENUBAR */
};
static const WCHAR strColorKey[] =
{ 'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
'C','o','l','o','r','s',0 };
static const WCHAR keyFlatMenus[] = { 'F','l','a','t','M','e','n','u', 0};
static const WCHAR keyGradientCaption[] = { 'G','r','a','d','i','e','n','t',
'C','a','p','t','i','o','n', 0 };
static const WCHAR keyNonClientMetrics[] = { 'N','o','n','C','l','i','e','n','t',
'M','e','t','r','i','c','s',0 };
static const WCHAR keyIconTitleFont[] = { 'I','c','o','n','T','i','t','l','e',
'F','o','n','t',0 };
static const WCHAR strColorKey[] = L"Control Panel\\Colors";
static const struct BackupSysParam
{
......@@ -260,8 +240,8 @@ static const struct BackupSysParam
const WCHAR* keyName;
} backupSysParams[] =
{
{SPI_GETFLATMENU, SPI_SETFLATMENU, keyFlatMenus},
{SPI_GETGRADIENTCAPTIONS, SPI_SETGRADIENTCAPTIONS, keyGradientCaption},
{SPI_GETFLATMENU, SPI_SETFLATMENU, L"FlatMenu"},
{SPI_GETGRADIENTCAPTIONS, SPI_SETGRADIENTCAPTIONS, L"GradientCaption"},
{-1, -1, 0}
};
......@@ -325,12 +305,12 @@ static void UXTHEME_BackupSystemMetrics(void)
memset (&ncm, 0, sizeof (ncm));
ncm.cbSize = sizeof (ncm);
SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, sizeof (ncm), &ncm, 0);
RegSetValueExW (hKey, keyNonClientMetrics, 0, REG_BINARY, (LPBYTE)&ncm,
RegSetValueExW (hKey, L"NonClientMetrics", 0, REG_BINARY, (BYTE*)&ncm,
sizeof (ncm));
memset (&iconTitleFont, 0, sizeof (iconTitleFont));
SystemParametersInfoW (SPI_GETICONTITLELOGFONT, sizeof (iconTitleFont),
&iconTitleFont, 0);
RegSetValueExW (hKey, keyIconTitleFont, 0, REG_BINARY,
RegSetValueExW (hKey, L"IconTitleFont", 0, REG_BINARY,
(LPBYTE)&iconTitleFont, sizeof (iconTitleFont));
RegCloseKey (hKey);
......@@ -403,7 +383,7 @@ static void UXTHEME_RestoreSystemMetrics(void)
DWORD count = sizeof(ncm);
DWORD type;
if (RegQueryValueExW (hKey, keyNonClientMetrics, 0,
if (RegQueryValueExW (hKey, L"NonClientMetrics", 0,
&type, (LPBYTE)&ncm, &count) == ERROR_SUCCESS)
{
SystemParametersInfoW (SPI_SETNONCLIENTMETRICS,
......@@ -412,7 +392,7 @@ static void UXTHEME_RestoreSystemMetrics(void)
count = sizeof(iconTitleFont);
if (RegQueryValueExW (hKey, keyIconTitleFont, 0,
if (RegQueryValueExW (hKey, L"IconTitleFont", 0,
&type, (LPBYTE)&iconTitleFont, &count) == ERROR_SUCCESS)
{
SystemParametersInfoW (SPI_SETICONTITLELOGFONT,
......@@ -491,19 +471,19 @@ static HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf)
if(!RegCreateKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) {
tmp[0] = bThemeActive?'1':'0';
tmp[1] = '\0';
RegSetValueExW(hKey, szThemeActive, 0, REG_SZ, (const BYTE*)tmp, sizeof(WCHAR)*2);
RegSetValueExW(hKey, L"ThemeActive", 0, REG_SZ, (const BYTE*)tmp, sizeof(WCHAR)*2);
if(bThemeActive) {
RegSetValueExW(hKey, szColorName, 0, REG_SZ, (const BYTE*)szCurrentColor,
RegSetValueExW(hKey, L"ColorName", 0, REG_SZ, (const BYTE*)szCurrentColor,
(lstrlenW(szCurrentColor)+1)*sizeof(WCHAR));
RegSetValueExW(hKey, szSizeName, 0, REG_SZ, (const BYTE*)szCurrentSize,
RegSetValueExW(hKey, L"SizeName", 0, REG_SZ, (const BYTE*)szCurrentSize,
(lstrlenW(szCurrentSize)+1)*sizeof(WCHAR));
RegSetValueExW(hKey, szDllName, 0, REG_SZ, (const BYTE*)szCurrentTheme,
RegSetValueExW(hKey, L"DllName", 0, REG_SZ, (const BYTE*)szCurrentTheme,
(lstrlenW(szCurrentTheme)+1)*sizeof(WCHAR));
}
else {
RegDeleteValueW(hKey, szColorName);
RegDeleteValueW(hKey, szSizeName);
RegDeleteValueW(hKey, szDllName);
RegDeleteValueW(hKey, L"ColorName");
RegDeleteValueW(hKey, L"SizeName");
RegDeleteValueW(hKey, L"DllName");
}
RegCloseKey(hKey);
......@@ -521,23 +501,10 @@ static HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf)
*/
void UXTHEME_InitSystem(HINSTANCE hInst)
{
static const WCHAR szWindowTheme[] = {
'u','x','_','t','h','e','m','e','\0'
};
static const WCHAR szSubAppName[] = {
'u','x','_','s','u','b','a','p','p','\0'
};
static const WCHAR szSubIdList[] = {
'u','x','_','s','u','b','i','d','l','s','t','\0'
};
static const WCHAR szDialogThemeEnabled[] = {
'u','x','_','d','i','a','l','o','g','t','h','e','m','e','\0'
};
atWindowTheme = GlobalAddAtomW(szWindowTheme);
atSubAppName = GlobalAddAtomW(szSubAppName);
atSubIdList = GlobalAddAtomW(szSubIdList);
atDialogThemeEnabled = GlobalAddAtomW(szDialogThemeEnabled);
atWindowTheme = GlobalAddAtomW(L"ux_theme");
atSubAppName = GlobalAddAtomW(L"ux_subapp");
atSubIdList = GlobalAddAtomW(L"ux_subidlst");
atDialogThemeEnabled = GlobalAddAtomW(L"ux_dialogtheme");
UXTHEME_LoadTheme();
}
......@@ -581,7 +548,7 @@ BOOL WINAPI IsCompositionActive(void)
HRESULT WINAPI EnableTheming(BOOL fEnable)
{
HKEY hKey;
WCHAR szEnabled[] = {'0','\0'};
WCHAR szEnabled[] = L"0";
TRACE("(%d)\n", fEnable);
......@@ -594,7 +561,7 @@ HRESULT WINAPI EnableTheming(BOOL fEnable)
bThemeActive = fEnable;
if(bThemeActive) szEnabled[0] = '1';
if(!RegOpenKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) {
RegSetValueExW(hKey, szThemeActive, 0, REG_SZ, (LPBYTE)szEnabled, sizeof(WCHAR));
RegSetValueExW(hKey, L"ThemeActive", 0, REG_SZ, (BYTE*)szEnabled, sizeof(WCHAR));
RegCloseKey(hKey);
}
UXTHEME_broadcast_msg (NULL, WM_THEMECHANGED);
......@@ -847,7 +814,7 @@ HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName,
/* If loading from string resource failed, try getting it from the theme.ini */
if(FAILED(hr)) {
PUXINI_FILE uf = MSSTYLES_GetThemeIni(pt);
if(UXINI_FindSection(uf, szIniDocumentation)) {
if(UXINI_FindSection(uf, L"documentation")) {
LPCWSTR lpValue;
DWORD dwLen;
if(UXINI_FindValue(uf, pszPropertyName, &lpValue, &dwLen)) {
......@@ -1012,10 +979,6 @@ HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback,
{
WCHAR szDir[MAX_PATH];
WCHAR szPath[MAX_PATH];
static const WCHAR szStar[] = {'*','.','*','\0'};
static const WCHAR szFormat[] = {'%','s','%','s','\\','%','s','.','m','s','s','t','y','l','e','s','\0'};
static const WCHAR szDisplayName[] = {'d','i','s','p','l','a','y','n','a','m','e','\0'};
static const WCHAR szTooltip[] = {'t','o','o','l','t','i','p','\0'};
WCHAR szName[60];
WCHAR szTip[60];
HANDLE hFind;
......@@ -1037,7 +1000,7 @@ HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback,
}
lstrcpyW(szPath, szDir);
lstrcatW(szPath, szStar);
lstrcatW(szPath, L"*.*");
TRACE("searching %s\n", debugstr_w(szPath));
hFind = FindFirstFileW(szPath, &wfd);
......@@ -1045,11 +1008,11 @@ HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback,
do {
if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY
&& !(wfd.cFileName[0] == '.' && ((wfd.cFileName[1] == '.' && wfd.cFileName[2] == 0) || wfd.cFileName[1] == 0))) {
wsprintfW(szPath, szFormat, szDir, wfd.cFileName, wfd.cFileName);
wsprintfW(szPath, L"%s%s\\%s.msstyles", szDir, wfd.cFileName, wfd.cFileName);
hr = GetThemeDocumentationProperty(szPath, szDisplayName, szName, ARRAY_SIZE(szName));
hr = GetThemeDocumentationProperty(szPath, L"displayname", szName, ARRAY_SIZE(szName));
if(SUCCEEDED(hr))
hr = GetThemeDocumentationProperty(szPath, szTooltip, szTip, ARRAY_SIZE(szTip));
hr = GetThemeDocumentationProperty(szPath, L"tooltip", szTip, ARRAY_SIZE(szTip));
if(SUCCEEDED(hr)) {
TRACE("callback(%s,%s,%s,%p)\n", debugstr_w(szPath), debugstr_w(szName), debugstr_w(szTip), lpData);
if(!callback(NULL, szPath, szName, szTip, NULL, lpData)) {
......
......@@ -33,10 +33,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
* Defines and global variables
*/
static const WCHAR szTextFileResource[] = {
'T','E','X','T','F','I','L','E','\0'
};
typedef struct _UXINI_FILE {
LPCWSTR lpIni;
LPCWSTR lpCurLoc;
......@@ -66,7 +62,7 @@ PUXINI_FILE UXINI_LoadINI(HMODULE hTheme, LPCWSTR lpName) {
TRACE("Loading resource INI %s\n", debugstr_w(lpName));
if((hrsc = FindResourceW(hTheme, lpName, szTextFileResource))) {
if((hrsc = FindResourceW(hTheme, lpName, L"TEXTFILE"))) {
if(!(lpThemesIni = LoadResource(hTheme, hrsc))) {
TRACE("%s resource not found\n", debugstr_w(lpName));
return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment