ReactOS  0.4.14-dev-49-gfb4591c
system.c File Reference
#include "uxthemep.h"
#include <stdio.h>
#include <winreg.h>
#include <uxundoc.h>
Include dependency graph for system.c:

Go to the source code of this file.

Classes

struct  BackupSysParam
 

Macros

#define NUM_SYS_COLORS   (COLOR_MENUBAR+1)
 

Functions

static BOOL CALLBACK UXTHEME_send_theme_changed (HWND hWnd, LPARAM enable)
 
BOOL CALLBACK UXTHEME_broadcast_theme_changed (HWND hWnd, LPARAM enable)
 
static DWORD query_reg_path (HKEY hKey, LPCWSTR lpszValue, LPVOID pvData)
 
static HRESULT UXTHEME_SetActiveTheme (PTHEME_FILE tf)
 
static BOOL bIsThemeActive (LPCWSTR pszTheme, LPCWSTR pszColor, LPCWSTR pszSize)
 
void UXTHEME_LoadTheme (BOOL bLoad)
 
static void save_sys_colors (HKEY baseKey)
 
static void UXTHEME_BackupSystemMetrics (void)
 
static void UXTHEME_RestoreSystemMetrics (void)
 
static void UXTHEME_SaveSystemMetrics (void)
 
static HRESULT UXTHEME_ApplyTheme (PTHEME_FILE tf)
 
void UXTHEME_InitSystem (HINSTANCE hInst)
 
BOOL WINAPI IsAppThemed (void)
 
BOOL WINAPI IsThemeActive (void)
 
HRESULT WINAPI EnableTheming (BOOL fEnable)
 
static HRESULT UXTHEME_SetWindowProperty (HWND hwnd, ATOM aProp, LPCWSTR pszValue)
 
static LPWSTR UXTHEME_GetWindowProperty (HWND hwnd, ATOM aProp, LPWSTR pszBuffer, int dwLen)
 
PTHEME_CLASS ValidateHandle (HTHEME hTheme)
 
static HTHEME WINAPI OpenThemeDataInternal (PTHEME_FILE ThemeFile, HWND hwnd, LPCWSTR pszClassList, DWORD flags)
 
HTHEME WINAPI OpenThemeDataEx (HWND hwnd, LPCWSTR pszClassList, DWORD flags)
 
HTHEME WINAPI OpenThemeDataFromFile (HTHEMEFILE hThemeFile, HWND hwnd, LPCWSTR pszClassList, DWORD flags)
 
HTHEME WINAPI OpenThemeData (HWND hwnd, LPCWSTR classlist)
 
HTHEME WINAPI GetWindowTheme (HWND hwnd)
 
HRESULT WINAPI SetWindowTheme (HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList)
 
HRESULT WINAPI GetCurrentThemeName (LPWSTR pszThemeFileName, int dwMaxNameChars, LPWSTR pszColorBuff, int cchMaxColorChars, LPWSTR pszSizeBuff, int cchMaxSizeChars)
 
DWORD WINAPI GetThemeAppProperties (void)
 
void WINAPI SetThemeAppProperties (DWORD dwFlags)
 
HRESULT WINAPI CloseThemeData (HTHEME hTheme)
 
HRESULT WINAPI HitTestThemeBackground (HTHEME hTheme, HDC hdc, int iPartId, int iStateId, DWORD dwOptions, const RECT *pRect, HRGN hrgn, POINT ptTest, WORD *pwHitTestCode)
 
BOOL WINAPI IsThemePartDefined (HTHEME hTheme, int iPartId, int iStateId)
 
HRESULT WINAPI GetThemeDocumentationProperty (LPCWSTR pszThemeName, LPCWSTR pszPropertyName, LPWSTR pszValueBuff, int cchMaxValChars)
 
DWORD WINAPI QueryThemeServices (void)
 
HRESULT WINAPI OpenThemeFile (LPCWSTR pszThemeFileName, LPCWSTR pszColorName, LPCWSTR pszSizeName, HTHEMEFILE *hThemeFile, DWORD unknown)
 
HRESULT WINAPI CloseThemeFile (HTHEMEFILE hThemeFile)
 
HRESULT WINAPI ApplyTheme (HTHEMEFILE hThemeFile, char *unknown, HWND hWnd)
 
HRESULT WINAPI GetThemeDefaults (LPCWSTR pszThemeFileName, LPWSTR pszColorName, DWORD dwColorNameLen, LPWSTR pszSizeName, DWORD dwSizeNameLen)
 
HRESULT WINAPI EnumThemes (LPCWSTR pszThemePath, ENUMTHEMEPROC callback, LPVOID lpData)
 
HRESULT WINAPI EnumThemeColors (LPWSTR pszThemeFileName, LPWSTR pszSizeName, DWORD dwColorNum, PTHEMENAMES pszColorNames)
 
HRESULT WINAPI EnumThemeSizes (LPWSTR pszThemeFileName, LPWSTR pszColorName, DWORD dwSizeNum, PTHEMENAMES pszSizeNames)
 
HRESULT WINAPI ParseThemeIniFile (LPCWSTR pszIniFileName, LPWSTR pszUnknown, PARSETHEMEINIFILEPROC callback, LPVOID lpData)
 
HRESULT WINAPI CheckThemeSignature (LPCWSTR pszThemeFileName)
 

Variables

static const WCHAR szThemeManager []
 
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'}
 
HINSTANCE hDllInst
 
ATOM atDialogThemeEnabled
 
static DWORD dwThemeAppProperties = STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS
 
ATOM atWindowTheme
 
static ATOM atSubAppName
 
static ATOM atSubIdList
 
ATOM atWndContext
 
PTHEME_FILE g_ActiveThemeFile
 
RTL_HANDLE_TABLE g_UxThemeHandleTable
 
int g_cHandles
 
static const char *const SysColorsNames []
 
static const WCHAR strColorKey []
 
static const WCHAR keyFlatMenus [] = { 'F','l','a','t','M','e','n','u', 0}
 
static const WCHAR keyGradientCaption []
 
static const WCHAR keyNonClientMetrics []
 
static const WCHAR keyIconTitleFont []
 
static const struct BackupSysParam backupSysParams []
 

Macro Definition Documentation

◆ NUM_SYS_COLORS

#define NUM_SYS_COLORS   (COLOR_MENUBAR+1)

Definition at line 314 of file system.c.

Function Documentation

◆ ApplyTheme()

HRESULT WINAPI ApplyTheme ( HTHEMEFILE  hThemeFile,
char unknown,
HWND  hWnd 
)

Definition at line 1158 of file system.c.

1159 {
1160  HRESULT hr;
1161  TRACE("(%p,%s,%p)\n", hThemeFile, unknown, hWnd);
1162  hr = UXTHEME_ApplyTheme(hThemeFile);
1164  return hr;
1165 }
HRESULT hr
Definition: shlfolder.c:183
HWND hWnd
Definition: settings.c:17
smooth NULL
Definition: ftsmooth.c:416
PTHEME_FILE g_ActiveThemeFile
Definition: system.c:54
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
Definition: id3.c:18
static HRESULT UXTHEME_ApplyTheme(PTHEME_FILE tf)
Definition: system.c:512
BOOL CALLBACK UXTHEME_broadcast_theme_changed(HWND hWnd, LPARAM enable)
Definition: system.c:68

Referenced by ActivateTheme().

◆ bIsThemeActive()

static BOOL bIsThemeActive ( LPCWSTR  pszTheme,
LPCWSTR  pszColor,
LPCWSTR  pszSize 
)
static

Definition at line 145 of file system.c.

146 {
147  if (g_ActiveThemeFile == NULL)
148  return FALSE;
149 
150  if (wcscmp(pszTheme, g_ActiveThemeFile->szThemeFile) != 0)
151  return FALSE;
152 
153  if (!pszColor[0])
154  {
156  return FALSE;
157  }
158  else
159  {
160  if (wcscmp(pszColor, g_ActiveThemeFile->pszSelectedColor) != 0)
161  return FALSE;
162  }
163 
164  if (!pszSize[0])
165  {
167  return FALSE;
168  }
169  else
170  {
171  if (wcscmp(pszSize, g_ActiveThemeFile->pszSelectedSize) != 0)
172  return FALSE;
173  }
174 
175  return TRUE;
176 }
#define TRUE
Definition: types.h:120
LPWSTR pszAvailColors
Definition: uxthemep.h:80
smooth NULL
Definition: ftsmooth.c:416
LPWSTR pszSelectedSize
Definition: uxthemep.h:84
PTHEME_FILE g_ActiveThemeFile
Definition: system.c:54
LPWSTR pszAvailSizes
Definition: uxthemep.h:81
LPWSTR pszSelectedColor
Definition: uxthemep.h:83
WCHAR szThemeFile[MAX_PATH]
Definition: uxthemep.h:79
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by UXTHEME_LoadTheme().

◆ CheckThemeSignature()

HRESULT WINAPI CheckThemeSignature ( LPCWSTR  pszThemeFileName)

Definition at line 1449 of file system.c.

1450 {
1451  PTHEME_FILE pt;
1452  HRESULT hr;
1453  TRACE("(%s)\n", debugstr_w(pszThemeFileName));
1454 
1455  if (!g_bThemeHooksActive)
1456  return E_FAIL;
1457 
1458  hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, NULL, &pt);
1459  if(FAILED(hr))
1460  return hr;
1462  return S_OK;
1463 }
HRESULT hr
Definition: shlfolder.c:183
#define pt(x, y)
Definition: drawing.c:79
#define E_FAIL
Definition: ddrawi.h:102
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWSTR pszSizeName, PTHEME_FILE *tf)
Definition: msstyles.c:54
#define S_OK
Definition: intsafe.h:59
BOOL g_bThemeHooksActive
Definition: themehooks.c:15
void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
Definition: msstyles.c:179

◆ CloseThemeData()

HRESULT WINAPI CloseThemeData ( HTHEME  hTheme)

Definition at line 950 of file system.c.

951 {
952  PUXTHEME_HANDLE pHandle = hTheme;
953  HRESULT hr;
954 
955  TRACE("(%p)\n", hTheme);
956 
958  return E_HANDLE;
959 
960  hr = MSSTYLES_CloseThemeClass(pHandle->pClass);
961  if (SUCCEEDED(hr))
962  {
964  g_cHandles--;
965  TRACE("Destroying handle 0x%x for class 0x%x. Count: %d\n", pHandle, pHandle->pClass, g_cHandles);
966  }
967  return hr;
968 }
int g_cHandles
Definition: system.c:57
#define E_HANDLE
Definition: winerror.h:2850
HRESULT hr
Definition: shlfolder.c:183
HRESULT MSSTYLES_CloseThemeClass(PTHEME_CLASS tc)
Definition: msstyles.c:822
NTSYSAPI BOOLEAN NTAPI RtlFreeHandle(_In_ PRTL_HANDLE_TABLE HandleTable, _In_ PRTL_HANDLE_TABLE_ENTRY Handle)
#define TRACE(s)
Definition: solgame.cpp:4
RTL_HANDLE_TABLE g_UxThemeHandleTable
Definition: system.c:56
LONG HRESULT
Definition: typedefs.h:77
NTSYSAPI BOOLEAN NTAPI RtlIsValidHandle(_In_ PRTL_HANDLE_TABLE HandleTable, _In_ PRTL_HANDLE_TABLE_ENTRY Handle)
Definition: rtltypes.h:1240
PTHEME_CLASS pClass
Definition: uxthemep.h:96
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by BUTTON_WindowProc(), CheckListWndProc(), COMBO_WindowProc(), DrawNCPreview(), EDIT_WindowProc(), EDIT_WM_NCDestroy(), GetNCCaptionTheme(), GetNCScrollbarTheme(), HEADER_Destroy(), HEADER_ThemeChanged(), IPADDRESS_Draw(), LISTBOX_Destroy(), LISTBOX_WindowProc(), LISTVIEW_Destroy(), LISTVIEW_ThemeChanged(), LoadSchemeFromTheme(), main(), MONTHCAL_Destroy(), CTaskSwitchWnd::OnDestroy(), CTrayNotifyWnd::OnThemeChanged(), CTrayClockWnd::OnThemeChanged(), CTaskSwitchWnd::OnThemeChanged(), CTrayWindow::OnThemeChanged(), ProgressWindowProc(), REBAR_Destroy(), START_TEST(), STATUSBAR_WMDestroy(), TAB_Destroy(), test_CloseThemeData(), test_OpenThemeData(), theme_changed(), Theme_Start(), ThemeDestroyWndData(), ThemePreWindowProc(), THEMING_ScrollbarSubclassProc(), TOOLBAR_Destroy(), TRACKBAR_Destroy(), TREEVIEW_Destroy(), TREEVIEW_ThemeChanged(), UpDownWindowProc(), and CTrayWindow::~CTrayWindow().

◆ CloseThemeFile()

HRESULT WINAPI CloseThemeFile ( HTHEMEFILE  hThemeFile)

Definition at line 1127 of file system.c.

1128 {
1129  TRACE("(%p)\n", hThemeFile);
1130  MSSTYLES_CloseThemeFile(hThemeFile);
1131  return S_OK;
1132 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
Definition: msstyles.c:179

Referenced by ActivateTheme().

◆ EnableTheming()

HRESULT WINAPI EnableTheming ( BOOL  fEnable)

Definition at line 642 of file system.c.

643 {
644  HKEY hKey;
645  WCHAR szEnabled[] = {'0','\0'};
646 
647  TRACE("(%d)\n", fEnable);
648 
649  if (fEnable != (g_ActiveThemeFile != NULL)) {
650  if(fEnable)
652  else
655 
656  if (fEnable) szEnabled[0] = '1';
658  RegSetValueExW(hKey, szThemeActive, 0, REG_SZ, (LPBYTE)szEnabled, sizeof(WCHAR));
659  RegCloseKey(hKey);
660  }
662  }
663  return S_OK;
664 }
static void UXTHEME_SaveSystemMetrics(void)
Definition: system.c:477
static void UXTHEME_BackupSystemMetrics(void)
Definition: system.c:343
static const WCHAR szThemeManager[]
Definition: system.c:31
#define HKEY_CURRENT_USER
Definition: winreg.h:11
static const WCHAR szThemeActive[]
Definition: system.c:38
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
smooth NULL
Definition: ftsmooth.c:416
PTHEME_FILE g_ActiveThemeFile
Definition: system.c:54
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define S_OK
Definition: intsafe.h:59
BOOL CALLBACK UXTHEME_broadcast_theme_changed(HWND hWnd, LPARAM enable)
Definition: system.c:68
static void UXTHEME_RestoreSystemMetrics(void)
Definition: system.c:387
#define REG_SZ
Definition: layer.c:22

◆ EnumThemeColors()

HRESULT WINAPI EnumThemeColors ( LPWSTR  pszThemeFileName,
LPWSTR  pszSizeName,
DWORD  dwColorNum,
PTHEMENAMES  pszColorNames 
)

Definition at line 1310 of file system.c.

1312 {
1313  PTHEME_FILE pt;
1314  HRESULT hr;
1315  LPWSTR tmp;
1316  UINT resourceId = dwColorNum + 1000;
1317  TRACE("(%s,%s,%d)\n", debugstr_w(pszThemeFileName),
1318  debugstr_w(pszSizeName), dwColorNum);
1319 
1320  if (!g_bThemeHooksActive)
1321  return E_FAIL;
1322 
1323  hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, pszSizeName, &pt);
1324  if(FAILED(hr)) return hr;
1325 
1326  tmp = pt->pszAvailColors;
1327  while(dwColorNum && *tmp) {
1328  dwColorNum--;
1329  tmp += lstrlenW(tmp)+1;
1330  }
1331  if(!dwColorNum && *tmp) {
1332  TRACE("%s\n", debugstr_w(tmp));
1333  lstrcpyW(pszColorNames->szName, tmp);
1334  LoadStringW (pt->hTheme, resourceId,
1335  pszColorNames->szDisplayName,
1336  sizeof (pszColorNames->szDisplayName) / sizeof (WCHAR));
1337  LoadStringW (pt->hTheme, resourceId+1000,
1338  pszColorNames->szTooltip,
1339  sizeof (pszColorNames->szTooltip) / sizeof (WCHAR));
1340  }
1341  else
1343 
1345  return hr;
1346 }
WCHAR szDisplayName[MAX_PATH+1]
Definition: uxundoc.h:53
HRESULT hr
Definition: shlfolder.c:183
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define pt(x, y)
Definition: drawing.c:79
WCHAR szName[MAX_PATH+1]
Definition: uxundoc.h:52
#define lstrlenW
Definition: compat.h:407
#define E_FAIL
Definition: ddrawi.h:102
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWSTR pszSizeName, PTHEME_FILE *tf)
Definition: msstyles.c:54
WCHAR szTooltip[MAX_PATH+1]
Definition: uxundoc.h:54
#define lstrcpyW
Definition: compat.h:406
unsigned int UINT
Definition: ndis.h:50
BOOL g_bThemeHooksActive
Definition: themehooks.c:15
WCHAR * LPWSTR
Definition: xmlstorage.h:184
void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
Definition: msstyles.c:179

Referenced by LoadTheme().

◆ EnumThemes()

HRESULT WINAPI EnumThemes ( LPCWSTR  pszThemePath,
ENUMTHEMEPROC  callback,
LPVOID  lpData 
)

Definition at line 1221 of file system.c.

1223 {
1224  WCHAR szDir[MAX_PATH];
1226  static const WCHAR szStar[] = {'*','.','*','\0'};
1227  static const WCHAR szFormat[] = {'%','s','%','s','\\','%','s','.','m','s','s','t','y','l','e','s','\0'};
1228  static const WCHAR szDisplayName[] = {'d','i','s','p','l','a','y','n','a','m','e','\0'};
1229  static const WCHAR szTooltip[] = {'t','o','o','l','t','i','p','\0'};
1230  WCHAR szName[60];
1231  WCHAR szTip[60];
1232  HANDLE hFind;
1233  WIN32_FIND_DATAW wfd;
1234  HRESULT hr;
1235  size_t pathLen;
1236 
1237  TRACE("(%s,%p,%p)\n", debugstr_w(pszThemePath), callback, lpData);
1238 
1239  if(!pszThemePath || !callback)
1240  return E_POINTER;
1241 
1242  lstrcpyW(szDir, pszThemePath);
1243  pathLen = lstrlenW (szDir);
1244  if ((pathLen > 0) && (pathLen < MAX_PATH-1) && (szDir[pathLen - 1] != '\\'))
1245  {
1246  szDir[pathLen] = '\\';
1247  szDir[pathLen+1] = 0;
1248  }
1249 
1250  lstrcpyW(szPath, szDir);
1251  lstrcatW(szPath, szStar);
1252  TRACE("searching %s\n", debugstr_w(szPath));
1253 
1254  hFind = FindFirstFileW(szPath, &wfd);
1255  if(hFind != INVALID_HANDLE_VALUE) {
1256  do {
1257  if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY
1258  && !(wfd.cFileName[0] == '.' && ((wfd.cFileName[1] == '.' && wfd.cFileName[2] == 0) || wfd.cFileName[1] == 0))) {
1259  wsprintfW(szPath, szFormat, szDir, wfd.cFileName, wfd.cFileName);
1260 
1261  hr = GetThemeDocumentationProperty(szPath, szDisplayName, szName, sizeof(szName)/sizeof(szName[0]));
1262  if(FAILED(hr))
1263  {
1264  ERR("Failed to get theme name from %S\n", szPath);
1265  continue;
1266  }
1267 
1268  hr = GetThemeDocumentationProperty(szPath, szTooltip, szTip, sizeof(szTip)/sizeof(szTip[0]));
1269  if (FAILED(hr))
1270  szTip[0] = 0;
1271 
1272  TRACE("callback(%s,%s,%s,%p)\n", debugstr_w(szPath), debugstr_w(szName), debugstr_w(szTip), lpData);
1273  if(!callback(NULL, szPath, szName, szTip, NULL, lpData)) {
1274  TRACE("callback ended enum\n");
1275  break;
1276  }
1277  }
1278  } while(FindNextFileW(hFind, &wfd));
1279  FindClose(hFind);
1280  }
1281  return S_OK;
1282 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
HRESULT hr
Definition: shlfolder.c:183
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName, LPCWSTR pszPropertyName, LPWSTR pszValueBuff, int cchMaxValChars)
Definition: system.c:1010
#define lstrlenW
Definition: compat.h:407
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:406
LPCWSTR szPath
Definition: env.c:35
static const WCHAR szName[]
Definition: msipriv.h:1194
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define E_POINTER
Definition: winerror.h:2365
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

Referenced by LoadThemes().

◆ EnumThemeSizes()

HRESULT WINAPI EnumThemeSizes ( LPWSTR  pszThemeFileName,
LPWSTR  pszColorName,
DWORD  dwSizeNum,
PTHEMENAMES  pszSizeNames 
)

Definition at line 1373 of file system.c.

1375 {
1376  PTHEME_FILE pt;
1377  HRESULT hr;
1378  LPWSTR tmp;
1379  UINT resourceId = dwSizeNum + 3000;
1380  TRACE("(%s,%s,%d)\n", debugstr_w(pszThemeFileName),
1381  debugstr_w(pszColorName), dwSizeNum);
1382 
1383  if (!g_bThemeHooksActive)
1384  return E_FAIL;
1385 
1386  hr = MSSTYLES_OpenThemeFile(pszThemeFileName, pszColorName, NULL, &pt);
1387  if(FAILED(hr)) return hr;
1388 
1389  tmp = pt->pszAvailSizes;
1390  while(dwSizeNum && *tmp) {
1391  dwSizeNum--;
1392  tmp += lstrlenW(tmp)+1;
1393  }
1394  if(!dwSizeNum && *tmp) {
1395  TRACE("%s\n", debugstr_w(tmp));
1396  lstrcpyW(pszSizeNames->szName, tmp);
1397  LoadStringW (pt->hTheme, resourceId,
1398  pszSizeNames->szDisplayName,
1399  sizeof (pszSizeNames->szDisplayName) / sizeof (WCHAR));
1400  LoadStringW (pt->hTheme, resourceId+1000,
1401  pszSizeNames->szTooltip,
1402  sizeof (pszSizeNames->szTooltip) / sizeof (WCHAR));
1403  }
1404  else
1406 
1408  return hr;
1409 }
WCHAR szDisplayName[MAX_PATH+1]
Definition: uxundoc.h:53
HRESULT hr
Definition: shlfolder.c:183
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define pt(x, y)
Definition: drawing.c:79
WCHAR szName[MAX_PATH+1]
Definition: uxundoc.h:52
#define lstrlenW
Definition: compat.h:407
#define E_FAIL
Definition: ddrawi.h:102
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWSTR pszSizeName, PTHEME_FILE *tf)
Definition: msstyles.c:54
WCHAR szTooltip[MAX_PATH+1]
Definition: uxundoc.h:54
#define lstrcpyW
Definition: compat.h:406
unsigned int UINT
Definition: ndis.h:50
BOOL g_bThemeHooksActive
Definition: themehooks.c:15
WCHAR * LPWSTR
Definition: xmlstorage.h:184
void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
Definition: msstyles.c:179

Referenced by LoadTheme().

◆ GetCurrentThemeName()

HRESULT WINAPI GetCurrentThemeName ( LPWSTR  pszThemeFileName,
int  dwMaxNameChars,
LPWSTR  pszColorBuff,
int  cchMaxColorChars,
LPWSTR  pszSizeBuff,
int  cchMaxSizeChars 
)

Definition at line 894 of file system.c.

897 {
898  int cchar;
899 
900  if(g_ActiveThemeFile == NULL)
901  return E_PROP_ID_UNSUPPORTED;
902 
903  if (pszThemeFileName && dwMaxNameChars)
904  {
905  cchar = lstrlenW(g_ActiveThemeFile->szThemeFile) + 1;
906  if(cchar > dwMaxNameChars)
908  lstrcpynW(pszThemeFileName, g_ActiveThemeFile->szThemeFile, cchar);
909  }
910 
911  if (pszColorBuff && cchMaxColorChars)
912  {
914  if(cchar > cchMaxColorChars)
916  lstrcpynW(pszColorBuff, g_ActiveThemeFile->pszSelectedColor, cchar);
917  }
918 
919  if (pszSizeBuff && cchMaxSizeChars)
920  {
922  if(cchar > cchMaxSizeChars)
924  lstrcpynW(pszSizeBuff, g_ActiveThemeFile->pszSelectedSize, cchar);
925  }
926 
927  return S_OK;
928 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define lstrlenW
Definition: compat.h:407
#define lstrcpynW
Definition: compat.h:397
smooth NULL
Definition: ftsmooth.c:416
LPWSTR pszSelectedSize
Definition: uxthemep.h:84
PTHEME_FILE g_ActiveThemeFile
Definition: system.c:54
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
LPWSTR pszSelectedColor
Definition: uxthemep.h:83
WCHAR szThemeFile[MAX_PATH]
Definition: uxthemep.h:79
#define S_OK
Definition: intsafe.h:59
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by GetActiveTheme(), and test_GetCurrentThemeName().

◆ GetThemeAppProperties()

DWORD WINAPI GetThemeAppProperties ( void  )

◆ GetThemeDefaults()

HRESULT WINAPI GetThemeDefaults ( LPCWSTR  pszThemeFileName,
LPWSTR  pszColorName,
DWORD  dwColorNameLen,
LPWSTR  pszSizeName,
DWORD  dwSizeNameLen 
)

Definition at line 1183 of file system.c.

1186 {
1187  PTHEME_FILE pt;
1188  HRESULT hr;
1189  TRACE("(%s,%p,%d,%p,%d)\n", debugstr_w(pszThemeFileName),
1190  pszColorName, dwColorNameLen,
1191  pszSizeName, dwSizeNameLen);
1192 
1193  if (!g_bThemeHooksActive)
1194  return E_FAIL;
1195 
1196  hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, NULL, &pt);
1197  if(FAILED(hr)) return hr;
1198 
1199  lstrcpynW(pszColorName, pt->pszSelectedColor, dwColorNameLen);
1200  lstrcpynW(pszSizeName, pt->pszSelectedSize, dwSizeNameLen);
1201 
1203  return S_OK;
1204 }
HRESULT hr
Definition: shlfolder.c:183
#define pt(x, y)
Definition: drawing.c:79
#define E_FAIL
Definition: ddrawi.h:102
#define lstrcpynW
Definition: compat.h:397
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWSTR pszSizeName, PTHEME_FILE *tf)
Definition: msstyles.c:54
#define S_OK
Definition: intsafe.h:59
BOOL g_bThemeHooksActive
Definition: themehooks.c:15
void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
Definition: msstyles.c:179

◆ GetThemeDocumentationProperty()

HRESULT WINAPI GetThemeDocumentationProperty ( LPCWSTR  pszThemeName,
LPCWSTR  pszPropertyName,
LPWSTR  pszValueBuff,
int  cchMaxValChars 
)

Definition at line 1010 of file system.c.

1014 {
1015  const WORD wDocToRes[] = {
1016  TMT_DISPLAYNAME,5000,
1017  TMT_TOOLTIP,5001,
1018  TMT_COMPANY,5002,
1019  TMT_AUTHOR,5003,
1020  TMT_COPYRIGHT,5004,
1021  TMT_URL,5005,
1022  TMT_VERSION,5006,
1023  TMT_DESCRIPTION,5007
1024  };
1025 
1026  PTHEME_FILE pt;
1027  HRESULT hr;
1028  unsigned int i;
1029  int iDocId;
1030  TRACE("(%s,%s,%p,%d)\n", debugstr_w(pszThemeName), debugstr_w(pszPropertyName),
1031  pszValueBuff, cchMaxValChars);
1032 
1033  if (!g_bThemeHooksActive)
1034  return E_FAIL;
1035 
1036  hr = MSSTYLES_OpenThemeFile(pszThemeName, NULL, NULL, &pt);
1037  if(FAILED(hr)) return hr;
1038 
1039  /* Try to load from string resources */
1041  if(MSSTYLES_LookupProperty(pszPropertyName, NULL, &iDocId)) {
1042  for(i=0; i<sizeof(wDocToRes)/sizeof(wDocToRes[0]); i+=2) {
1043  if(wDocToRes[i] == iDocId) {
1044  if(LoadStringW(pt->hTheme, wDocToRes[i+1], pszValueBuff, cchMaxValChars)) {
1045  hr = S_OK;
1046  break;
1047  }
1048  }
1049  }
1050  }
1051  /* If loading from string resource failed, try getting it from the theme.ini */
1052  if(FAILED(hr)) {
1055  LPCWSTR lpValue;
1056  DWORD dwLen;
1057  if(UXINI_FindValue(uf, pszPropertyName, &lpValue, &dwLen)) {
1058  lstrcpynW(pszValueBuff, lpValue, min(dwLen+1,cchMaxValChars));
1059  hr = S_OK;
1060  }
1061  }
1062  UXINI_CloseINI(uf);
1063  }
1064 
1066  return hr;
1067 }
#define TMT_COMPANY
Definition: vssym32.h:156
#define TMT_VERSION
Definition: vssym32.h:160
HRESULT hr
Definition: shlfolder.c:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BOOL UXINI_FindValue(PUXINI_FILE uf, LPCWSTR lpName, LPCWSTR *lpValue, DWORD *dwValueLen)
Definition: uxini.c:280
#define pt(x, y)
Definition: drawing.c:79
#define TMT_DESCRIPTION
Definition: vssym32.h:161
#define E_FAIL
Definition: ddrawi.h:102
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define lstrcpynW
Definition: compat.h:397
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TMT_DISPLAYNAME
Definition: vssym32.h:154
BOOL MSSTYLES_LookupProperty(LPCWSTR pszPropertyName, int *dwPrimitive, int *dwId)
Definition: stylemap.c:1100
#define TRACE(s)
Definition: solgame.cpp:4
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
void UXINI_CloseINI(PUXINI_FILE uf)
Definition: uxini.c:83
LONG HRESULT
Definition: typedefs.h:77
HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWSTR pszSizeName, PTHEME_FILE *tf)
Definition: msstyles.c:54
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
PUXINI_FILE MSSTYLES_GetThemeIni(PTHEME_FILE tf)
Definition: msstyles.c:236
static const WCHAR szIniDocumentation[]
Definition: system.c:43
#define TMT_AUTHOR
Definition: vssym32.h:157
BOOL UXINI_FindSection(PUXINI_FILE uf, LPCWSTR lpName)
Definition: uxini.c:200
#define TMT_TOOLTIP
Definition: vssym32.h:155
#define S_OK
Definition: intsafe.h:59
#define TMT_URL
Definition: vssym32.h:159
#define min(a, b)
Definition: monoChain.cc:55
BOOL g_bThemeHooksActive
Definition: themehooks.c:15
#define TMT_COPYRIGHT
Definition: vssym32.h:158
void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
Definition: msstyles.c:179

Referenced by EnumThemes().

◆ GetWindowTheme()

HTHEME WINAPI GetWindowTheme ( HWND  hwnd)

Definition at line 851 of file system.c.

852 {
853  TRACE("(%p)\n", hwnd);
854 
855  if(!IsWindow(hwnd))
856  {
858  return NULL;
859  }
860 
862 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define E_HANDLE
Definition: winerror.h:2850
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BOOL WINAPI IsWindow(_In_opt_ HWND)
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define SetLastError(x)
Definition: compat.h:409
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
#define MAKEINTATOM(i)
Definition: winbase.h:1416
ATOM atWindowTheme
Definition: system.c:49

Referenced by BUTTON_WindowProc(), COMBO_WindowProc(), EDIT_WindowProc(), EDIT_WM_NCDestroy(), EDIT_WM_NCPaint(), get_client_rect(), get_led_gap(), get_led_size(), HEADER_Destroy(), HEADER_DrawItem(), HEADER_DrawItemFrame(), HEADER_FillItemFrame(), HEADER_MouseMove(), HEADER_Refresh(), HEADER_ThemeChanged(), hottrack_refresh(), LISTBOX_Destroy(), LISTBOX_NCPaint(), LISTBOX_WindowProc(), LISTVIEW_Destroy(), LISTVIEW_NCPaint(), LISTVIEW_ThemeChanged(), MONTHCAL_Destroy(), MONTHCAL_PaintButton(), OSK_ThemeHandler(), PROGRESS_Draw(), PROGRESS_UpdateMarquee(), ProgressWindowProc(), REBAR_Destroy(), REBAR_DrawBand(), REBAR_EraseBkGnd(), REBAR_NCCalcSize(), REBAR_NCPaint(), REBAR_StyleChanged(), STATUSBAR_ComputeHeight(), STATUSBAR_DrawPart(), STATUSBAR_Refresh(), STATUSBAR_RefreshPart(), STATUSBAR_WMDestroy(), TAB_Destroy(), TAB_DrawBorder(), TAB_DrawItem(), TAB_DrawItemInterior(), TAB_EraseTabInterior(), TAB_RecalcHotTrack(), test_GetWindowTheme(), test_OpenThemeData(), theme_changed(), ThemeDestroyWndData(), ThemeDlgPostWindowProc(), THEMING_ScrollbarSubclassProc(), TOOLBAR_Destroy(), TOOLBAR_DrawButton(), TOOLBAR_DrawImage(), TOOLBAR_DrawString(), TOOLBAR_EraseBackground(), TOOLBAR_GetHotItem(), TOOLBAR_MouseMove(), TOOLBAR_NCCreate(), TRACKBAR_Destroy(), TRACKBAR_DrawChannel(), TRACKBAR_DrawThumb(), TRACKBAR_DrawTics(), TRACKBAR_MouseMove(), TRACKBAR_Refresh(), TREEVIEW_Destroy(), TREEVIEW_DrawItemLines(), TREEVIEW_NCPaint(), TREEVIEW_ThemeChanged(), UPDOWN_Draw(), UPDOWN_DrawBuddyBackground(), UPDOWN_GetArrowRect(), and UpDownWindowProc().

◆ HitTestThemeBackground()

HRESULT WINAPI HitTestThemeBackground ( HTHEME  hTheme,
HDC  hdc,
int  iPartId,
int  iStateId,
DWORD  dwOptions,
const RECT pRect,
HRGN  hrgn,
POINT  ptTest,
WORD pwHitTestCode 
)

Definition at line 973 of file system.c.

977 {
978  FIXME("%d %d 0x%08x: stub\n", iPartId, iStateId, dwOptions);
979  if (!ValidateHandle(hTheme))
980  return E_HANDLE;
981  return E_NOTIMPL;
982 }
DWORD dwOptions
Definition: solitaire.cpp:23
#define E_HANDLE
Definition: winerror.h:2850
#define FIXME(fmt,...)
Definition: debug.h:110
PTHEME_CLASS ValidateHandle(HTHEME hTheme)
Definition: system.c:717
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ IsAppThemed()

◆ IsThemeActive()

BOOL WINAPI IsThemeActive ( void  )

Definition at line 606 of file system.c.

607 {
608  BOOL bActive;
609  LRESULT Result;
610  HKEY hKey;
611  WCHAR tmp[10];
612  DWORD buffsize;
613 
614  TRACE("IsThemeActive\n");
616 
617  if (g_ActiveThemeFile)
618  return TRUE;
619 
621  return FALSE;
622 
623  bActive = FALSE;
625  if (Result == ERROR_SUCCESS)
626  {
627  buffsize = sizeof(tmp);
628  if (!RegQueryValueExW(hKey, szThemeActive, NULL, NULL, (LPBYTE)tmp, &buffsize))
629  bActive = (tmp[0] != '0');
630  RegCloseKey(hKey);
631  }
632 
633  return bActive;
634 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR szThemeManager[]
Definition: system.c:31
#define HKEY_CURRENT_USER
Definition: winreg.h:11
static const WCHAR szThemeActive[]
Definition: system.c:38
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
PTHEME_FILE g_ActiveThemeFile
Definition: system.c:54
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
BOOL g_bThemeHooksActive
Definition: themehooks.c:15
LONG_PTR LRESULT
Definition: windef.h:209

Referenced by CTrayNotifyWnd::OnThemeChanged(), CTaskSwitchWnd::OnThemeChanged(), START_TEST(), test_GetCurrentThemeName(), test_IsThemed(), test_OpenThemeData(), test_OpenThemeDataEx(), Theme_Start(), and THEMING_Initialize().

◆ IsThemePartDefined()

BOOL WINAPI IsThemePartDefined ( HTHEME  hTheme,
int  iPartId,
int  iStateId 
)

Definition at line 987 of file system.c.

988 {
989  PTHEME_CLASS pClass;
990 
991  TRACE("(%p,%d,%d)\n", hTheme, iPartId, iStateId);
992 
993  pClass = ValidateHandle(hTheme);
994  if (!pClass)
995  {
997  return FALSE;
998  }
999  if(MSSTYLES_FindPartState(pClass, iPartId, iStateId, NULL))
1000  return TRUE;
1001  return FALSE;
1002 }
#define TRUE
Definition: types.h:120
#define E_HANDLE
Definition: winerror.h:2850
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define SetLastError(x)
Definition: compat.h:409
PTHEME_CLASS ValidateHandle(HTHEME hTheme)
Definition: system.c:717
PTHEME_PARTSTATE MSSTYLES_FindPartState(PTHEME_CLASS tc, int iPartId, int iStateId, PTHEME_CLASS *tcNext)
Definition: msstyles.c:452

Referenced by test_IsThemed(), and test_OpenThemeData().

◆ OpenThemeData()

◆ OpenThemeDataEx()

HTHEME WINAPI OpenThemeDataEx ( HWND  hwnd,
LPCWSTR  pszClassList,
DWORD  flags 
)

Definition at line 819 of file system.c.

820 {
821  return OpenThemeDataInternal(g_ActiveThemeFile, hwnd, pszClassList, flags);
822 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
PTHEME_FILE g_ActiveThemeFile
Definition: system.c:54
GLbitfield flags
Definition: glext.h:7161
static HTHEME WINAPI OpenThemeDataInternal(PTHEME_FILE ThemeFile, HWND hwnd, LPCWSTR pszClassList, DWORD flags)
Definition: system.c:735

Referenced by GetNCCaptionTheme(), GetNCScrollbarTheme(), init_funcs(), and START_TEST().

◆ OpenThemeDataFromFile()

HTHEME WINAPI OpenThemeDataFromFile ( HTHEMEFILE  hThemeFile,
HWND  hwnd,
LPCWSTR  pszClassList,
DWORD  flags 
)

Definition at line 827 of file system.c.

828 {
829  return OpenThemeDataInternal((PTHEME_FILE)hThemeFile, hwnd, pszClassList, flags);
830 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
GLbitfield flags
Definition: glext.h:7161
static HTHEME WINAPI OpenThemeDataInternal(PTHEME_FILE ThemeFile, HWND hwnd, LPCWSTR pszClassList, DWORD flags)
Definition: system.c:735

Referenced by DrawNCPreview(), and LoadSchemeFromTheme().

◆ OpenThemeDataInternal()

static HTHEME WINAPI OpenThemeDataInternal ( PTHEME_FILE  ThemeFile,
HWND  hwnd,
LPCWSTR  pszClassList,
DWORD  flags 
)
static

Definition at line 735 of file system.c.

736 {
737  WCHAR szAppBuff[256];
738  WCHAR szClassBuff[256];
739  LPCWSTR pszAppName;
740  LPCWSTR pszUseClassList;
741  HTHEME hTheme = NULL;
742  TRACE("(%p,%s, %x)\n", hwnd, debugstr_w(pszClassList), flags);
743 
744  if(!pszClassList)
745  {
747  return NULL;
748  }
749 
750  if ((flags & OTD_NONCLIENT) && !(dwThemeAppProperties & STAP_ALLOW_NONCLIENT))
751  {
753  return NULL;
754  }
755 
756  if (!(flags & OTD_NONCLIENT) && !(dwThemeAppProperties & STAP_ALLOW_CONTROLS))
757  {
759  return NULL;
760  }
761 
762  if (ThemeFile)
763  {
764  pszAppName = UXTHEME_GetWindowProperty(hwnd, atSubAppName, szAppBuff, sizeof(szAppBuff)/sizeof(szAppBuff[0]));
765  /* If SetWindowTheme was used on the window, that overrides the class list passed to this function */
766  pszUseClassList = UXTHEME_GetWindowProperty(hwnd, atSubIdList, szClassBuff, sizeof(szClassBuff)/sizeof(szClassBuff[0]));
767  if(!pszUseClassList)
768  pszUseClassList = pszClassList;
769 
770  if (pszUseClassList)
771  {
772  PTHEME_CLASS pClass;
773  PUXTHEME_HANDLE pHandle;
774 
775  if (!ThemeFile->classes)
776  MSSTYLES_ParseThemeIni(ThemeFile);
777  pClass = MSSTYLES_OpenThemeClass(ThemeFile, pszAppName, pszUseClassList);
778 
779  if (pClass)
780  {
782  if (pHandle)
783  {
784  g_cHandles++;
785  TRACE("Created handle 0x%x for class 0x%x, app %S, class %S. Count: %d\n", pHandle, pClass, pszAppName, pszUseClassList, g_cHandles);
786  pHandle->pClass = pClass;
787  pHandle->Handle.Flags = RTL_HANDLE_VALID;
788  hTheme = pHandle;
789  }
790  else
791  {
792  MSSTYLES_CloseThemeClass(pClass);
793  }
794  }
795  }
796  }
797 
798  if(IsWindow(hwnd))
799  {
800  if ((flags & OTD_NONCLIENT) == 0)
801  {
803  }
804  }
805  else
806  {
808  }
809 
811 
812  TRACE(" = %p\n", hTheme);
813  return hTheme;
814 }
int g_cHandles
Definition: system.c:57
#define RTL_HANDLE_VALID
Definition: rtltypes.h:372
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BOOL WINAPI IsWindow(_In_opt_ HWND)
static LPWSTR UXTHEME_GetWindowProperty(HWND hwnd, ATOM aProp, LPWSTR pszBuffer, int dwLen)
Definition: system.c:706
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
HRESULT MSSTYLES_CloseThemeClass(PTHEME_CLASS tc)
Definition: msstyles.c:822
RTL_HANDLE_TABLE_ENTRY Handle
Definition: uxthemep.h:95
static DWORD dwThemeAppProperties
Definition: system.c:48
#define debugstr_w
Definition: kernel32.h:32
PTHEME_CLASS classes
Definition: uxthemep.h:86
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI PRTL_HANDLE_TABLE_ENTRY NTAPI RtlAllocateHandle(_In_ PRTL_HANDLE_TABLE HandleTable, _Inout_ PULONG Index)
PTHEME_CLASS MSSTYLES_OpenThemeClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassList)
Definition: msstyles.c:756
static ATOM atSubAppName
Definition: system.c:50
#define TRACE(s)
Definition: solgame.cpp:4
RTL_HANDLE_TABLE g_UxThemeHandleTable
Definition: system.c:56
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SetLastError(x)
Definition: compat.h:409
GLbitfield flags
Definition: glext.h:7161
void MSSTYLES_ParseThemeIni(PTHEME_FILE tf)
Definition: msstyles.c:644
struct _UXTHEME_HANDLE * PUXTHEME_HANDLE
ULONG Flags
Definition: rtltypes.h:1244
PTHEME_CLASS pClass
Definition: uxthemep.h:96
#define E_POINTER
Definition: winerror.h:2365
static ATOM atSubIdList
Definition: system.c:51
#define MAKEINTATOM(i)
Definition: winbase.h:1416
ATOM atWindowTheme
Definition: system.c:49

Referenced by OpenThemeData(), OpenThemeDataEx(), and OpenThemeDataFromFile().

◆ OpenThemeFile()

HRESULT WINAPI OpenThemeFile ( LPCWSTR  pszThemeFileName,
LPCWSTR  pszColorName,
LPCWSTR  pszSizeName,
HTHEMEFILE hThemeFile,
DWORD  unknown 
)

Definition at line 1101 of file system.c.

1104 {
1105  TRACE("(%s,%s,%s,%p,%d)\n", debugstr_w(pszThemeFileName),
1106  debugstr_w(pszColorName), debugstr_w(pszSizeName),
1107  hThemeFile, unknown);
1108 
1109  if (!g_bThemeHooksActive)
1110  return E_FAIL;
1111 
1112  return MSSTYLES_OpenThemeFile(pszThemeFileName, pszColorName, pszSizeName, (PTHEME_FILE*)hThemeFile);
1113 }
#define E_FAIL
Definition: ddrawi.h:102
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWSTR pszSizeName, PTHEME_FILE *tf)
Definition: msstyles.c:54
Definition: id3.c:18
BOOL g_bThemeHooksActive
Definition: themehooks.c:15

Referenced by ActivateTheme(), DrawNCPreview(), and LoadSchemeFromTheme().

◆ ParseThemeIniFile()

HRESULT WINAPI ParseThemeIniFile ( LPCWSTR  pszIniFileName,
LPWSTR  pszUnknown,
PARSETHEMEINIFILEPROC  callback,
LPVOID  lpData 
)

Definition at line 1430 of file system.c.

1432 {
1433  FIXME("%s %s: stub\n", debugstr_w(pszIniFileName), debugstr_w(pszUnknown));
1434  return E_NOTIMPL;
1435 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ query_reg_path()

static DWORD query_reg_path ( HKEY  hKey,
LPCWSTR  lpszValue,
LPVOID  pvData 
)
static

Definition at line 84 of file system.c.

86 {
87  DWORD dwRet, dwType, dwUnExpDataLen = MAX_PATH * sizeof(WCHAR), dwExpDataLen;
88 
89  TRACE("(hkey=%p,%s,%p)\n", hKey, debugstr_w(lpszValue),
90  pvData);
91 
92  dwRet = RegQueryValueExW(hKey, lpszValue, 0, &dwType, pvData, &dwUnExpDataLen);
93  if (dwRet!=ERROR_SUCCESS && dwRet!=ERROR_MORE_DATA)
94  return dwRet;
95 
96  if (dwType == REG_EXPAND_SZ)
97  {
98  DWORD nBytesToAlloc;
99 
100  /* Expand type REG_EXPAND_SZ into REG_SZ */
101  LPWSTR szData;
102 
103  /* If the caller didn't supply a buffer or the buffer is too small we have
104  * to allocate our own
105  */
106  if (dwRet == ERROR_MORE_DATA)
107  {
108  WCHAR cNull = '\0';
109  nBytesToAlloc = dwUnExpDataLen;
110 
111  szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
112  RegQueryValueExW (hKey, lpszValue, 0, NULL, (LPBYTE)szData, &nBytesToAlloc);
113  dwExpDataLen = ExpandEnvironmentStringsW(szData, &cNull, 1);
114  dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
115  LocalFree(szData);
116  }
117  else
118  {
119  nBytesToAlloc = (lstrlenW(pvData) + 1) * sizeof(WCHAR);
120  szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc );
122  dwExpDataLen = ExpandEnvironmentStringsW(szData, pvData, MAX_PATH );
123  if (dwExpDataLen > MAX_PATH) dwRet = ERROR_MORE_DATA;
124  dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
125  LocalFree(szData);
126  }
127  }
128 
129  return dwRet;
130 }
#define max(a, b)
Definition: svc.c:63
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR szData[]
Definition: msipriv.h:1195
#define lstrlenW
Definition: compat.h:407
unsigned char * LPBYTE
Definition: typedefs.h:52
#define debugstr_w
Definition: kernel32.h:32
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3748
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
#define LMEM_ZEROINIT
Definition: winbase.h:356
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define lstrcpyW
Definition: compat.h:406
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by UXTHEME_LoadTheme().

◆ QueryThemeServices()

DWORD WINAPI QueryThemeServices ( void  )

Definition at line 1079 of file system.c.

1080 {
1081  FIXME("stub\n");
1082  return 3; /* This is what is returned under XP in most cases */
1083 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ save_sys_colors()

static void save_sys_colors ( HKEY  baseKey)
static

Definition at line 316 of file system.c.

317 {
318  char colorStr[13];
319  HKEY hKey;
320  int i;
321 
322  if (RegCreateKeyExW( baseKey, strColorKey,
323  0, 0, 0, KEY_ALL_ACCESS,
324  0, &hKey, 0 ) == ERROR_SUCCESS)
325  {
326  for (i = 0; i < NUM_SYS_COLORS; i++)
327  {
328  COLORREF col = GetSysColor (i);
329 
330  sprintf (colorStr, "%d %d %d",
331  GetRValue (col), GetGValue (col), GetBValue (col));
332 
333  RegSetValueExA (hKey, SysColorsNames[i], 0, REG_SZ,
334  (BYTE*)colorStr, strlen (colorStr)+1);
335  }
336  RegCloseKey (hKey);
337  }
338 }
#define ERROR_SUCCESS
Definition: deptool.c:10
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define GetRValue(rgb)
Definition: wingdi.h:2930
DWORD WINAPI GetSysColor(_In_ int)
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define GetGValue(rgb)
Definition: wingdi.h:2931
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define NUM_SYS_COLORS
Definition: system.c:314
DWORD COLORREF
Definition: windef.h:285
static const char *const SysColorsNames[]
Definition: system.c:258
unsigned char BYTE
Definition: mem.h:68
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
static const WCHAR strColorKey[]
Definition: system.c:292
#define GetBValue(rgb)
Definition: wingdi.h:2932
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4812
#define REG_SZ
Definition: layer.c:22

Referenced by UXTHEME_BackupSystemMetrics(), and UXTHEME_SaveSystemMetrics().

◆ SetThemeAppProperties()

void WINAPI SetThemeAppProperties ( DWORD  dwFlags)

Definition at line 941 of file system.c.

942 {
943  TRACE("(0x%08x)\n", dwFlags);
945 }
static DWORD dwThemeAppProperties
Definition: system.c:48
#define TRACE(s)
Definition: solgame.cpp:4
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

Referenced by main(), Notify(), and START_TEST().

◆ SetWindowTheme()

HRESULT WINAPI SetWindowTheme ( HWND  hwnd,
LPCWSTR  pszSubAppName,
LPCWSTR  pszSubIdList 
)

Definition at line 869 of file system.c.

871 {
872  HRESULT hr;
873  TRACE("(%p,%s,%s)\n", hwnd, debugstr_w(pszSubAppName),
874  debugstr_w(pszSubIdList));
875 
876  if(!IsWindow(hwnd))
877  return E_HANDLE;
878 
879  hr = UXTHEME_SetWindowProperty(hwnd, atSubAppName, pszSubAppName);
880  if (!SUCCEEDED(hr))
881  return hr;
882 
883  hr = UXTHEME_SetWindowProperty(hwnd, atSubIdList, pszSubIdList);
884  if (!SUCCEEDED(hr))
885  return hr;
886 
888  return hr;
889 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define E_HANDLE
Definition: winerror.h:2850
HRESULT hr
Definition: shlfolder.c:183
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define debugstr_w
Definition: kernel32.h:32
static ATOM atSubAppName
Definition: system.c:50
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static HRESULT UXTHEME_SetWindowProperty(HWND hwnd, ATOM aProp, LPCWSTR pszValue)
Definition: system.c:672
BOOL CALLBACK UXTHEME_broadcast_theme_changed(HWND hWnd, LPARAM enable)
Definition: system.c:68
static ATOM atSubIdList
Definition: system.c:51
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by test_SetWindowTheme().

◆ UXTHEME_ApplyTheme()

static HRESULT UXTHEME_ApplyTheme ( PTHEME_FILE  tf)
static

Definition at line 512 of file system.c.

513 {
514  HKEY hKey;
515  WCHAR tmp[2];
516  HRESULT hr;
517 
518  TRACE("UXTHEME_ApplyTheme\n");
519 
520  if (tf && !g_ActiveThemeFile)
521  {
523  }
524 
526  if (FAILED(hr))
527  return hr;
528 
529  if (!tf)
530  {
532  }
533 
534  TRACE("Writing theme config to registry\n");
536  tmp[0] = g_ActiveThemeFile ? '1' : '0';
537  tmp[1] = '\0';
538  RegSetValueExW(hKey, szThemeActive, 0, REG_SZ, (const BYTE*)tmp, sizeof(WCHAR)*2);
539  if (g_ActiveThemeFile) {
540  RegSetValueExW(hKey, szColorName, 0, REG_SZ, (const BYTE*)tf->pszSelectedColor,
541  (lstrlenW(tf->pszSelectedColor)+1)*sizeof(WCHAR));
542  RegSetValueExW(hKey, szSizeName, 0, REG_SZ, (const BYTE*)tf->pszSelectedSize,
543  (lstrlenW(tf->pszSelectedSize)+1)*sizeof(WCHAR));
544  RegSetValueExW(hKey, szDllName, 0, REG_SZ, (const BYTE*)tf->szThemeFile,
545  (lstrlenW(tf->szThemeFile)+1)*sizeof(WCHAR));
546  }
547  else {
550  RegDeleteValueW(hKey, szDllName);
551 
552  }
553  RegCloseKey(hKey);
554  }
555  else
556  TRACE("Failed to open theme registry key\n");
557 
559 
560  return hr;
561 }
static void UXTHEME_SaveSystemMetrics(void)
Definition: system.c:477
static const WCHAR szSizeName[]
Definition: system.c:39
HRESULT hr
Definition: shlfolder.c:183
static void UXTHEME_BackupSystemMetrics(void)
Definition: system.c:343
static const WCHAR szThemeManager[]
Definition: system.c:31
#define HKEY_CURRENT_USER
Definition: winreg.h:11
static const WCHAR szThemeActive[]
Definition: system.c:38
HFONT tf
Definition: icontest.c:17
static const WCHAR szColorName[]
Definition: system.c:40
static HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf)
Definition: system.c:132
#define lstrlenW
Definition: compat.h:407
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
PTHEME_FILE g_ActiveThemeFile
Definition: system.c:54
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
unsigned char BYTE
Definition: mem.h:68
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2355
static const WCHAR szDllName[]
Definition: system.c:41
static void UXTHEME_RestoreSystemMetrics(void)
Definition: system.c:387
#define REG_SZ
Definition: layer.c:22

Referenced by ApplyTheme().

◆ UXTHEME_BackupSystemMetrics()

static void UXTHEME_BackupSystemMetrics ( void  )
static

Definition at line 343 of file system.c.

344 {
345  HKEY hKey;
346  const struct BackupSysParam* bsp = backupSysParams;
347 
349  0, 0, 0, KEY_ALL_ACCESS,
350  0, &hKey, 0) == ERROR_SUCCESS)
351  {
352  NONCLIENTMETRICSW ncm;
353  LOGFONTW iconTitleFont;
354 
355  /* back up colors */
356  save_sys_colors (hKey);
357 
358  /* back up "other" settings */
359  while (bsp->spiGet >= 0)
360  {
361  DWORD value;
362 
363  SystemParametersInfoW (bsp->spiGet, 0, &value, 0);
364  RegSetValueExW (hKey, bsp->keyName, 0, REG_DWORD,
365  (LPBYTE)&value, sizeof (value));
366 
367  bsp++;
368  }
369 
370  /* back up non-client metrics */
371  memset (&ncm, 0, sizeof (ncm));
372  ncm.cbSize = sizeof (ncm);
373  SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, sizeof (ncm), &ncm, 0);
375  sizeof (ncm));
376  memset (&iconTitleFont, 0, sizeof (iconTitleFont));
377  SystemParametersInfoW (SPI_GETICONTITLELOGFONT, sizeof (iconTitleFont),
378  &iconTitleFont, 0);
380  (LPBYTE)&iconTitleFont, sizeof (iconTitleFont));
381 
382  RegCloseKey (hKey);
383  }
384 }
#define ERROR_SUCCESS
Definition: deptool.c:10
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define REG_BINARY
Definition: nt_native.h:1496
static const WCHAR szThemeManager[]
Definition: system.c:31
#define HKEY_CURRENT_USER
Definition: winreg.h:11
static const struct BackupSysParam backupSysParams[]
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei const GLfloat * value
Definition: glext.h:6069
static const WCHAR keyNonClientMetrics[]
Definition: system.c:298
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
const WCHAR * keyName
Definition: system.c:306
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1362
static void save_sys_colors(HKEY baseKey)
Definition: system.c:316
#define memset(x, y, z)
Definition: compat.h:39
#define REG_DWORD
Definition: sdbapi.c:596
static const WCHAR keyIconTitleFont[]
Definition: system.c:300

Referenced by EnableTheming(), and UXTHEME_ApplyTheme().

◆ UXTHEME_broadcast_theme_changed()

BOOL CALLBACK UXTHEME_broadcast_theme_changed ( HWND  hWnd,
LPARAM  enable 
)

Definition at line 68 of file system.c.

69 {
70  if (hWnd == NULL)
71  {
73  }
74  else
75  {
78  }
79  return TRUE;
80 }
BOOL WINAPI EnumChildWindows(_In_opt_ HWND, _In_ WNDENUMPROC, _In_ LPARAM)
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
static BOOL CALLBACK UXTHEME_send_theme_changed(HWND hWnd, LPARAM enable)
Definition: system.c:61
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC, _In_ LPARAM)
GLboolean enable
Definition: glext.h:11120
BOOL CALLBACK UXTHEME_broadcast_theme_changed(HWND hWnd, LPARAM enable)
Definition: system.c:68

Referenced by ApplyTheme(), EnableTheming(), SetWindowTheme(), ThemeHooksInstall(), ThemeHooksRemove(), and UXTHEME_broadcast_theme_changed().

◆ UXTHEME_GetWindowProperty()

static LPWSTR UXTHEME_GetWindowProperty ( HWND  hwnd,
ATOM  aProp,
LPWSTR  pszBuffer,
int  dwLen 
)
static

Definition at line 706 of file system.c.

707 {
708  ATOM atValue = (ATOM)(size_t)GetPropW(hwnd, (LPCWSTR)MAKEINTATOM(aProp));
709  if(atValue) {
710  if(GetAtomNameW(atValue, pszBuffer, dwLen))
711  return pszBuffer;
712  TRACE("property defined, but unable to get value\n");
713  }
714  return NULL;
715 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
WORD ATOM
Definition: dimm.idl:113
UINT WINAPI GetAtomNameW(ATOM nAtom, LPWSTR lpBuffer, int nSize)
Definition: atom.c:589
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
#define MAKEINTATOM(i)
Definition: winbase.h:1416

Referenced by OpenThemeDataInternal().

◆ UXTHEME_InitSystem()

void UXTHEME_InitSystem ( HINSTANCE  hInst)

Definition at line 566 of file system.c.

567 {
568  static const WCHAR szWindowTheme[] = {
569  'u','x','_','t','h','e','m','e','\0'
570  };
571  static const WCHAR szSubAppName[] = {
572  'u','x','_','s','u','b','a','p','p','\0'
573  };
574  static const WCHAR szSubIdList[] = {
575  'u','x','_','s','u','b','i','d','l','s','t','\0'
576  };
577  static const WCHAR szDialogThemeEnabled[] = {
578  'u','x','_','d','i','a','l','o','g','t','h','e','m','e','\0'
579  };
580 
581  hDllInst = hInst;
582 
583  atWindowTheme = GlobalAddAtomW(szWindowTheme);
584  atSubAppName = GlobalAddAtomW(szSubAppName);
585  atSubIdList = GlobalAddAtomW(szSubIdList);
586  atDialogThemeEnabled = GlobalAddAtomW(szDialogThemeEnabled);
587  atWndContext = GlobalAddAtomW(L"ux_WndContext");
588 
590  g_cHandles = 0;
591 }
int g_cHandles
Definition: system.c:57
ATOM atDialogThemeEnabled
Definition: system.c:46
HINSTANCE hDllInst
Definition: system.c:45
NTSYSAPI VOID NTAPI RtlInitializeHandleTable(_In_ ULONG TableSize, _In_ ULONG HandleSize, _In_ PRTL_HANDLE_TABLE HandleTable)
ATOM atWndContext
Definition: system.c:52
static ATOM atSubAppName
Definition: system.c:50
RTL_HANDLE_TABLE g_UxThemeHandleTable
Definition: system.c:56
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR L[]
Definition: oid.c:1250
HINSTANCE hInst
Definition: dxdiag.c:13
ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString)
Definition: atom.c:444
static ATOM atSubIdList
Definition: system.c:51
ATOM atWindowTheme
Definition: system.c:49

Referenced by DllMain().

◆ UXTHEME_LoadTheme()

void UXTHEME_LoadTheme ( BOOL  bLoad)

Definition at line 183 of file system.c.

184 {
185  HKEY hKey;
186  DWORD buffsize;
187  HRESULT hr;
188  WCHAR tmp[10];
189  PTHEME_FILE pt;
190  WCHAR szCurrentTheme[MAX_PATH];
191  WCHAR szCurrentColor[64];
192  WCHAR szCurrentSize[64];
194 
195  if ((bLoad != FALSE) && g_bThemeHooksActive)
196  {
197  /* Get current theme configuration */
199  TRACE("Loading theme config\n");
200  buffsize = sizeof(tmp);
201  if(!RegQueryValueExW(hKey, szThemeActive, NULL, NULL, (LPBYTE)tmp, &buffsize)) {
202  bThemeActive = (tmp[0] != '0');
203  }
204  else {
206  TRACE("Failed to get ThemeActive: %d\n", GetLastError());
207  }
208  buffsize = sizeof(szCurrentColor);
209  if(RegQueryValueExW(hKey, szColorName, NULL, NULL, (LPBYTE)szCurrentColor, &buffsize))
210  szCurrentColor[0] = '\0';
211  buffsize = sizeof(szCurrentSize);
212  if(RegQueryValueExW(hKey, szSizeName, NULL, NULL, (LPBYTE)szCurrentSize, &buffsize))
213  szCurrentSize[0] = '\0';
214  if (query_reg_path (hKey, szDllName, szCurrentTheme))
215  szCurrentTheme[0] = '\0';
216  RegCloseKey(hKey);
217  }
218  else
219  TRACE("Failed to open theme registry key\n");
220  }
221  else
222  {
224  }
225 
226  if(bThemeActive)
227  {
228  if( bIsThemeActive(szCurrentTheme, szCurrentColor, szCurrentSize) )
229  {
230  TRACE("Tried to load active theme again\n");
231  return;
232  }
233 
234  /* Make sure the theme requested is actually valid */
235  hr = MSSTYLES_OpenThemeFile(szCurrentTheme,
236  szCurrentColor[0]?szCurrentColor:NULL,
237  szCurrentSize[0]?szCurrentSize:NULL,
238  &pt);
239  if(FAILED(hr)) {
241  }
242  else {
243  TRACE("Theme active: %s %s %s\n", debugstr_w(szCurrentTheme),
244  debugstr_w(szCurrentColor), debugstr_w(szCurrentSize));
245 
248  }
249  }
250  if(!bThemeActive) {
252  TRACE("Theming not active\n");
253  }
254 }
static const WCHAR szSizeName[]
Definition: system.c:39
HRESULT hr
Definition: shlfolder.c:183
#define pt(x, y)
Definition: drawing.c:79
static const WCHAR szThemeManager[]
Definition: system.c:31
#define HKEY_CURRENT_USER
Definition: winreg.h:11
static const WCHAR szThemeActive[]
Definition: system.c:38
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static const WCHAR szColorName[]
Definition: system.c:40
static HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf)
Definition: system.c:132
static DWORD query_reg_path(HKEY hKey, LPCWSTR lpszValue, LPVOID pvData)
Definition: system.c:84
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
static BOOL bIsThemeActive(LPCWSTR pszTheme, LPCWSTR pszColor, LPCWSTR pszSize)
Definition: system.c:145
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWSTR pszSizeName, PTHEME_FILE *tf)
Definition: msstyles.c:54
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR szDllName[]
Definition: system.c:41
BOOL g_bThemeHooksActive
Definition: themehooks.c:15
void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
Definition: msstyles.c:179
static BOOL bThemeActive
Definition: scroll.c:29

Referenced by ThemeInitApiHook(), and ThemePreWindowProc().

◆ UXTHEME_RestoreSystemMetrics()

static void UXTHEME_RestoreSystemMetrics ( void  )
static

Definition at line 387 of file system.c.

388 {
389  HKEY hKey;
390  const struct BackupSysParam* bsp = backupSysParams;
391 
393  0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS)
394  {
395  HKEY colorKey;
396 
397  /* read backed-up colors */
398  if (RegOpenKeyExW (hKey, strColorKey,
399  0, KEY_QUERY_VALUE, &colorKey) == ERROR_SUCCESS)
400  {
401  int i;
402  COLORREF sysCols[NUM_SYS_COLORS];
403  int sysColsIndices[NUM_SYS_COLORS];
404  int sysColCount = 0;
405 
406  for (i = 0; i < NUM_SYS_COLORS; i++)
407  {
408  DWORD type;
409  char colorStr[13];
410  DWORD count = sizeof(colorStr);
411 
412  if (RegQueryValueExA (colorKey, SysColorsNames[i], 0,
413  &type, (LPBYTE) colorStr, &count) == ERROR_SUCCESS)
414  {
415  int r, g, b;
416  if (sscanf (colorStr, "%d %d %d", &r, &g, &b) == 3)
417  {
418  sysColsIndices[sysColCount] = i;
419  sysCols[sysColCount] = RGB(r, g, b);
420  sysColCount++;
421  }
422  }
423  }
424  RegCloseKey (colorKey);
425 
426  SetSysColors (sysColCount, sysColsIndices, sysCols);
427  }
428 
429  /* read backed-up other settings */
430  while (bsp->spiGet >= 0)
431  {
432  DWORD value;
433  DWORD count = sizeof(value);
434  DWORD type;
435 
436  if (RegQueryValueExW (hKey, bsp->keyName, 0,
437  &type, (LPBYTE)&value, &count) == ERROR_SUCCESS)
438  {
440  }
441 
442  bsp++;
443  }
444 
445  /* read backed-up non-client metrics */
446  {
447  NONCLIENTMETRICSW ncm;
448  LOGFONTW iconTitleFont;
449  DWORD count = sizeof(ncm);
450  DWORD type;
451 
453  &type, (LPBYTE)&ncm, &count) == ERROR_SUCCESS)
454  {
455  SystemParametersInfoW (SPI_SETNONCLIENTMETRICS,
456  count, &ncm, SPIF_UPDATEINIFILE);
457  }
458 
459  count = sizeof(iconTitleFont);
460 
461  if (RegQueryValueExW (hKey, keyIconTitleFont, 0,
462  &type, (LPBYTE)&iconTitleFont, &count) == ERROR_SUCCESS)
463  {
465  count, &iconTitleFont, SPIF_UPDATEINIFILE);
466  }
467  }
468 
469  RegCloseKey (hKey);
470  }
471 }
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4023
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static const WCHAR szThemeManager[]
Definition: system.c:31
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define HKEY_CURRENT_USER
Definition: winreg.h:11
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static const struct BackupSysParam backupSysParams[]
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
#define NUM_SYS_COLORS
Definition: system.c:314
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
#define UlongToPtr(u)
Definition: config.h:106
#define b
Definition: ke_i.h:79
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
DWORD COLORREF
Definition: windef.h:285
#define RGB(r, g, b)
Definition: wingdi.h:2935
unsigned long DWORD
Definition: ntddk_ex.h:95
static const char *const SysColorsNames[]
Definition: system.c:258
BOOL WINAPI SetSysColors(_In_ int cElements, _In_reads_(cElements) CONST INT *lpaElements, _In_reads_(cElements) CONST COLORREF *lpaRgbValues)
GLsizei const GLfloat * value
Definition: glext.h:6069
#define SPI_SETICONTITLELOGFONT
Definition: winuser.h:1365
#define SPIF_UPDATEINIFILE
Definition: winuser.h:1553
static const WCHAR keyNonClientMetrics[]
Definition: system.c:298
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
const WCHAR * keyName
Definition: system.c:306
static const WCHAR strColorKey[]
Definition: system.c:292
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
static const WCHAR keyIconTitleFont[]
Definition: system.c:300

Referenced by EnableTheming(), and UXTHEME_ApplyTheme().

◆ UXTHEME_SaveSystemMetrics()

static void UXTHEME_SaveSystemMetrics ( void  )
static

Definition at line 477 of file system.c.

478 {
479  const struct BackupSysParam* bsp = backupSysParams;
480  NONCLIENTMETRICSW ncm;
481  LOGFONTW iconTitleFont;
482 
484 
485  while (bsp->spiGet >= 0)
486  {
487  DWORD value;
488 
489  SystemParametersInfoW (bsp->spiGet, 0, &value, 0);
491  bsp++;
492  }
493 
494  memset (&ncm, 0, sizeof (ncm));
495  ncm.cbSize = sizeof (ncm);
496  SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, sizeof (ncm), &ncm, 0);
497  SystemParametersInfoW (SPI_SETNONCLIENTMETRICS, sizeof (ncm), &ncm,
499 
500  memset (&iconTitleFont, 0, sizeof (iconTitleFont));
501  SystemParametersInfoW (SPI_GETICONTITLELOGFONT, sizeof (iconTitleFont),
502  &iconTitleFont, 0);
503  SystemParametersInfoW (SPI_SETICONTITLELOGFONT, sizeof (iconTitleFont),
504  &iconTitleFont, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
505 }
#define HKEY_CURRENT_USER
Definition: winreg.h:11
static const struct BackupSysParam backupSysParams[]
#define UlongToPtr(u)
Definition: config.h:106
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei const GLfloat * value
Definition: glext.h:6069
#define SPI_SETICONTITLELOGFONT
Definition: winuser.h:1365
#define SPIF_UPDATEINIFILE
Definition: winuser.h:1553
#define SPIF_SENDCHANGE
Definition: winuser.h:1554
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1362
static void save_sys_colors(HKEY baseKey)
Definition: system.c:316
#define memset(x, y, z)
Definition: compat.h:39

Referenced by EnableTheming(), and UXTHEME_ApplyTheme().

◆ UXTHEME_send_theme_changed()

static BOOL CALLBACK UXTHEME_send_theme_changed ( HWND  hWnd,
LPARAM  enable 
)
static

Definition at line 61 of file system.c.

62 {
63  SendMessageW(hWnd, WM_THEMECHANGED, enable, 0);
64  return TRUE;
65 }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
GLboolean enable
Definition: glext.h:11120
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by UXTHEME_broadcast_theme_changed().

◆ UXTHEME_SetActiveTheme()

static HRESULT UXTHEME_SetActiveTheme ( PTHEME_FILE  tf)
static

Definition at line 132 of file system.c.

133 {
137  if (g_ActiveThemeFile)
138  {
141  }
142  return S_OK;
143 }
HFONT tf
Definition: icontest.c:17
HRESULT MSSTYLES_ReferenceTheme(PTHEME_FILE tf)
Definition: msstyles.c:224
PTHEME_FILE g_ActiveThemeFile
Definition: system.c:54
void MSSTYLES_ParseThemeIni(PTHEME_FILE tf)
Definition: msstyles.c:644
#define S_OK
Definition: intsafe.h:59
void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
Definition: msstyles.c:179

Referenced by UXTHEME_ApplyTheme(), and UXTHEME_LoadTheme().

◆ UXTHEME_SetWindowProperty()

static HRESULT UXTHEME_SetWindowProperty ( HWND  hwnd,
ATOM  aProp,
LPCWSTR  pszValue 
)
static

Definition at line 672 of file system.c.

673 {
674  ATOM oldValue = (ATOM)(size_t)RemovePropW(hwnd, (LPCWSTR)MAKEINTATOM(aProp));
675  if(oldValue)
676  {
677  DeleteAtom(oldValue);
678  }
679 
680  if(pszValue)
681  {
682  ATOM atValue;
683 
684  /* A string with zero lenght is not acceptatble in AddAtomW but we want to support
685  users passing an empty string meaning they want no theme for the specified window */
686  if(!pszValue[0])
687  pszValue = L"0";
688 
689  atValue = AddAtomW(pszValue);
690  if (!atValue)
691  {
692  ERR("AddAtomW for %S failed with last error %d!\n", pszValue, GetLastError());
694  }
695 
696  if (!SetPropW(hwnd, (LPCWSTR)MAKEINTATOM(aProp), (LPWSTR)MAKEINTATOM(atValue)))
697  {
698  ERR("SetPropW for atom %d failed with last error %d\n", aProp, GetLastError());
699  if(atValue) DeleteAtom(atValue);
701  }
702  }
703  return S_OK;
704 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
WORD ATOM
Definition: dimm.idl:113
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HANDLE WINAPI RemovePropW(_In_ HWND, _In_ LPCWSTR)
ATOM WINAPI DeleteAtom(ATOM nAtom)
Definition: atom.c:546
ATOM WINAPI AddAtomW(LPCWSTR lpString)
Definition: atom.c:536
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
static const WCHAR L[]
Definition: oid.c:1250
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define MAKEINTATOM(i)
Definition: winbase.h:1416

Referenced by SetWindowTheme().

◆ ValidateHandle()

PTHEME_CLASS ValidateHandle ( HTHEME  hTheme)

Definition at line 717 of file system.c.

718 {
719  PUXTHEME_HANDLE pHandle;
720 
721  if (!g_bThemeHooksActive || !hTheme || hTheme == INVALID_HANDLE_VALUE)
722  return NULL;
723 
725  {
726  ERR("Invalid handle 0x%x!\n", hTheme);
727  return NULL;
728  }
729 
730  pHandle = hTheme;
731  return pHandle->pClass;
732 }
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
smooth NULL
Definition: ftsmooth.c:416
RTL_HANDLE_TABLE g_UxThemeHandleTable
Definition: system.c:56
NTSYSAPI BOOLEAN NTAPI RtlIsValidHandle(_In_ PRTL_HANDLE_TABLE HandleTable, _In_ PRTL_HANDLE_TABLE_ENTRY Handle)
#define ERR(fmt,...)
Definition: debug.h:109
BOOL g_bThemeHooksActive
Definition: themehooks.c:15
Definition: rtltypes.h:1240
PTHEME_CLASS pClass
Definition: uxthemep.h:96

Referenced by CheckMenuItem(), GetMenuContextHelpId(), GetMenuDefaultItem(), GetMenuInfo(), GetMenuItemCount(), GetThemeBool(), GetThemeColor(), GetThemeEnumValue(), GetThemeFilename(), GetThemeFont(), GetThemeInt(), GetThemeIntList(), GetThemeMargins(), GetThemeMetric(), GetThemePosition(), GetThemePropertyOrigin(), GetThemeRect(), GetThemeString(), GetThemeSysBool(), GetThemeSysColor(), GetThemeSysFont(), GetThemeSysInt(), GetThemeSysSize(), GetThemeSysString(), HitTestThemeBackground(), IsMenu(), IsThemePartDefined(), UXTHEME_LoadImage(), and UXTHEME_SelectImage().

Variable Documentation

◆ atDialogThemeEnabled

ATOM atDialogThemeEnabled

◆ atSubAppName

ATOM atSubAppName
static

Definition at line 50 of file system.c.

Referenced by OpenThemeDataInternal(), SetWindowTheme(), and UXTHEME_InitSystem().

◆ atSubIdList

ATOM atSubIdList
static

Definition at line 51 of file system.c.

Referenced by OpenThemeDataInternal(), SetWindowTheme(), and UXTHEME_InitSystem().

◆ atWindowTheme

ATOM atWindowTheme

Definition at line 49 of file system.c.

Referenced by GetWindowTheme(), OpenThemeDataInternal(), and UXTHEME_InitSystem().

◆ atWndContext

◆ backupSysParams

const struct BackupSysParam backupSysParams[]
static
Initial value:
=
{
{SPI_GETFLATMENU, SPI_SETFLATMENU, keyFlatMenus},
{SPI_GETGRADIENTCAPTIONS, SPI_SETGRADIENTCAPTIONS, keyGradientCaption},
{-1, -1, 0}
}
static const WCHAR keyFlatMenus[]
Definition: system.c:295
static const WCHAR keyGradientCaption[]
Definition: system.c:296

Referenced by UXTHEME_BackupSystemMetrics(), UXTHEME_RestoreSystemMetrics(), and UXTHEME_SaveSystemMetrics().

◆ dwThemeAppProperties

DWORD dwThemeAppProperties = STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS
static

Definition at line 48 of file system.c.

Referenced by GetThemeAppProperties(), OpenThemeDataInternal(), and SetThemeAppProperties().

◆ g_ActiveThemeFile

◆ g_cHandles

int g_cHandles

Definition at line 57 of file system.c.

Referenced by CloseThemeData(), OpenThemeDataInternal(), and UXTHEME_InitSystem().

◆ g_UxThemeHandleTable

RTL_HANDLE_TABLE g_UxThemeHandleTable

Definition at line 56 of file system.c.

Referenced by CloseThemeData(), OpenThemeDataInternal(), UXTHEME_InitSystem(), and ValidateHandle().

◆ hDllInst

HINSTANCE hDllInst

Definition at line 45 of file system.c.

Referenced by DrawNCPreview(), ThemeHooksInstall(), and UXTHEME_InitSystem().

◆ keyFlatMenus

const WCHAR keyFlatMenus[] = { 'F','l','a','t','M','e','n','u', 0}
static

Definition at line 295 of file system.c.

◆ keyGradientCaption

const WCHAR keyGradientCaption[]
static
Initial value:
= { 'G','r','a','d','i','e','n','t',
'C','a','p','t','i','o','n', 0 }

Definition at line 296 of file system.c.

◆ keyIconTitleFont

const WCHAR keyIconTitleFont[]
static
Initial value:
= { 'I','c','o','n','T','i','t','l','e',
'F','o','n','t',0 }

Definition at line 300 of file system.c.

Referenced by UXTHEME_BackupSystemMetrics(), and UXTHEME_RestoreSystemMetrics().

◆ keyNonClientMetrics

const WCHAR keyNonClientMetrics[]
static
Initial value:
= { 'N','o','n','C','l','i','e','n','t',
'M','e','t','r','i','c','s',0 }

Definition at line 298 of file system.c.

Referenced by UXTHEME_BackupSystemMetrics(), and UXTHEME_RestoreSystemMetrics().

◆ strColorKey

const WCHAR strColorKey[]
static
Initial value:
=
{ 'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
'C','o','l','o','r','s',0 }

Definition at line 292 of file system.c.

Referenced by save_sys_colors(), and UXTHEME_RestoreSystemMetrics().

◆ SysColorsNames

const char* const SysColorsNames[]
static

Definition at line 258 of file system.c.

Referenced by save_sys_colors(), and UXTHEME_RestoreSystemMetrics().

◆ szColorName

const WCHAR szColorName[] = {'C','o','l','o','r','N','a','m','e','\0'}
static

Definition at line 40 of file system.c.

Referenced by UXTHEME_ApplyTheme(), and UXTHEME_LoadTheme().

◆ szDllName

const WCHAR szDllName[] = {'D','l','l','N','a','m','e','\0'}
static

Definition at line 41 of file system.c.

Referenced by UXTHEME_ApplyTheme(), and UXTHEME_LoadTheme().

◆ szIniDocumentation

const WCHAR szIniDocumentation[] = {'d','o','c','u','m','e','n','t','a','t','i','o','n','\0'}
static

Definition at line 43 of file system.c.

Referenced by GetThemeDocumentationProperty().

◆ szSizeName

const WCHAR szSizeName[] = {'S','i','z','e','N','a','m','e','\0'}
static

Definition at line 39 of file system.c.

Referenced by UXTHEME_ApplyTheme(), and UXTHEME_LoadTheme().

◆ szThemeActive

const WCHAR szThemeActive[] = {'T','h','e','m','e','A','c','t','i','v','e','\0'}
static

Definition at line 38 of file system.c.

Referenced by EnableTheming(), IsThemeActive(), UXTHEME_ApplyTheme(), and UXTHEME_LoadTheme().

◆ szThemeManager

const WCHAR szThemeManager[]
static
Initial value:
= {
'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'
}

Definition at line 31 of file system.c.

Referenced by EnableTheming(), IsThemeActive(), UXTHEME_ApplyTheme(), UXTHEME_BackupSystemMetrics(), UXTHEME_LoadTheme(), and UXTHEME_RestoreSystemMetrics().