ReactOS 0.4.16-dev-197-g92996da
system.c
Go to the documentation of this file.
1/*
2 * Win32 5.1 Theme system
3 *
4 * Copyright (C) 2003 Kevin Koltzau
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include "uxthemep.h"
22
23#include <stdio.h>
24#include <winreg.h>
25#include <uxundoc.h>
26
27/***********************************************************************
28 * Defines and global variables
29 */
30
31static const WCHAR szThemeManager[] = {
32 'S','o','f','t','w','a','r','e','\\',
33 'M','i','c','r','o','s','o','f','t','\\',
34 'W','i','n','d','o','w','s','\\',
35 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
36 'T','h','e','m','e','M','a','n','a','g','e','r','\0'
37};
38static const WCHAR szThemeActive[] = {'T','h','e','m','e','A','c','t','i','v','e','\0'};
39static const WCHAR szSizeName[] = {'S','i','z','e','N','a','m','e','\0'};
40static const WCHAR szColorName[] = {'C','o','l','o','r','N','a','m','e','\0'};
41static const WCHAR szDllName[] = {'D','l','l','N','a','m','e','\0'};
42
43static const WCHAR szIniDocumentation[] = {'d','o','c','u','m','e','n','t','a','t','i','o','n','\0'};
44
47
48static DWORD dwThemeAppProperties = STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS;
53
55
58
59/***********************************************************************/
60
62{
63 SendMessageW(hWnd, WM_THEMECHANGED, enable, 0);
64 return TRUE;
65}
66
67/* Broadcast WM_THEMECHANGED to *all* windows, including children */
69{
70 if (hWnd == NULL)
71 {
73 }
74 else
75 {
78 }
79 return TRUE;
80}
81
82/* At the end of the day this is a subset of what SHRegGetPath() does - copied
83 * here to avoid linking against shlwapi. */
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 );
121 lstrcpyW(szData, pvData);
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}
131
133{
138 {
141 }
142 return S_OK;
143}
144
145static BOOL bIsThemeActive(LPCWSTR pszTheme, LPCWSTR pszColor, LPCWSTR pszSize)
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}
177
178/***********************************************************************
179 * UXTHEME_LoadTheme
180 *
181 * Set the current active theme from the registry
182 */
184{
185 HKEY hKey;
186 DWORD buffsize;
187 HRESULT hr;
188 WCHAR tmp[10];
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';
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}
255
256/***********************************************************************/
257
258static const char * const SysColorsNames[] =
259{
260 "Scrollbar", /* COLOR_SCROLLBAR */
261 "Background", /* COLOR_BACKGROUND */
262 "ActiveTitle", /* COLOR_ACTIVECAPTION */
263 "InactiveTitle", /* COLOR_INACTIVECAPTION */
264 "Menu", /* COLOR_MENU */
265 "Window", /* COLOR_WINDOW */
266 "WindowFrame", /* COLOR_WINDOWFRAME */
267 "MenuText", /* COLOR_MENUTEXT */
268 "WindowText", /* COLOR_WINDOWTEXT */
269 "TitleText", /* COLOR_CAPTIONTEXT */
270 "ActiveBorder", /* COLOR_ACTIVEBORDER */
271 "InactiveBorder", /* COLOR_INACTIVEBORDER */
272 "AppWorkSpace", /* COLOR_APPWORKSPACE */
273 "Hilight", /* COLOR_HIGHLIGHT */
274 "HilightText", /* COLOR_HIGHLIGHTTEXT */
275 "ButtonFace", /* COLOR_BTNFACE */
276 "ButtonShadow", /* COLOR_BTNSHADOW */
277 "GrayText", /* COLOR_GRAYTEXT */
278 "ButtonText", /* COLOR_BTNTEXT */
279 "InactiveTitleText", /* COLOR_INACTIVECAPTIONTEXT */
280 "ButtonHilight", /* COLOR_BTNHIGHLIGHT */
281 "ButtonDkShadow", /* COLOR_3DDKSHADOW */
282 "ButtonLight", /* COLOR_3DLIGHT */
283 "InfoText", /* COLOR_INFOTEXT */
284 "InfoWindow", /* COLOR_INFOBK */
285 "ButtonAlternateFace", /* COLOR_ALTERNATEBTNFACE */
286 "HotTrackingColor", /* COLOR_HOTLIGHT */
287 "GradientActiveTitle", /* COLOR_GRADIENTACTIVECAPTION */
288 "GradientInactiveTitle", /* COLOR_GRADIENTINACTIVECAPTION */
289 "MenuHilight", /* COLOR_MENUHILIGHT */
290 "MenuBar", /* COLOR_MENUBAR */
291};
292static const WCHAR strColorKey[] =
293 { 'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
294 'C','o','l','o','r','s',0 };
295static const WCHAR keyFlatMenus[] = { 'F','l','a','t','M','e','n','u', 0};
296static const WCHAR keyGradientCaption[] = { 'G','r','a','d','i','e','n','t',
297 'C','a','p','t','i','o','n', 0 };
298static const WCHAR keyNonClientMetrics[] = { 'N','o','n','C','l','i','e','n','t',
299 'M','e','t','r','i','c','s',0 };
300static const WCHAR keyIconTitleFont[] = { 'I','c','o','n','T','i','t','l','e',
301 'F','o','n','t',0 };
302
303static const struct BackupSysParam
304{
307} backupSysParams[] =
308{
309 {SPI_GETFLATMENU, SPI_SETFLATMENU, keyFlatMenus},
310 {SPI_GETGRADIENTCAPTIONS, SPI_SETGRADIENTCAPTIONS, keyGradientCaption},
311 {-1, -1, 0}
313
314#define NUM_SYS_COLORS (COLOR_MENUBAR+1)
315
316static void save_sys_colors (HKEY baseKey)
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
334 (BYTE*)colorStr, strlen (colorStr)+1);
335 }
337 }
338}
339
340/* Before activating a theme, query current system colors, certain settings
341 * and backup them in the registry, so they can be restored when the theme
342 * is deactivated */
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 */
357
358 /* back up "other" settings */
359 while (bsp->spiGet >= 0)
360 {
361 DWORD value;
362
363 SystemParametersInfoW (bsp->spiGet, 0, &value, 0);
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
383 }
384}
385
386/* Read back old settings after a theme was deactivated */
388{
389 HKEY hKey;
390 const struct BackupSysParam* bsp = backupSysParams;
391
394 {
395 HKEY colorKey;
396
397 /* read backed-up colors */
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,
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,
457 }
458
459 count = sizeof(iconTitleFont);
460
462 &type, (LPBYTE)&iconTitleFont, &count) == ERROR_SUCCESS)
463 {
465 count, &iconTitleFont, SPIF_UPDATEINIFILE);
466 }
467 }
468
470 }
471}
472
473/* Make system settings persistent, so they're in effect even w/o uxtheme
474 * loaded.
475 * For efficiency reasons, only the last SystemParametersInfoW sets
476 * SPIF_SENDCHANGE */
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}
506
507/***********************************************************************
508 * UXTHEME_ApplyTheme
509 *
510 * Change the current active theme
511 */
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 {
551
552 }
554 }
555 else
556 TRACE("Failed to open theme registry key\n");
557
559
560 return hr;
561}
562
563/***********************************************************************
564 * UXTHEME_InitSystem
565 */
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}
592
593/***********************************************************************
594 * IsAppThemed (UXTHEME.@)
595 */
597{
598 TRACE("\n");
600 return (g_ActiveThemeFile != NULL);
601}
602
603/***********************************************************************
604 * IsThemeActive (UXTHEME.@)
605 */
607{
608 BOOL bActive;
610 HKEY hKey;
611 WCHAR tmp[10];
612 DWORD buffsize;
613
614 TRACE("IsThemeActive\n");
616
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');
631 }
632
633 return bActive;
634}
635
636/***********************************************************************
637 * EnableTheming (UXTHEME.@)
638 *
639 * NOTES
640 * This is a global and persistent change
641 */
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));
660 }
662 }
663 return S_OK;
664}
665
666/***********************************************************************
667 * UXTHEME_SetWindowProperty
668 *
669 * I'm using atoms as there may be large numbers of duplicated strings
670 * and they do the work of keeping memory down as a cause of that quite nicely
671 */
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}
705
706static LPWSTR UXTHEME_GetWindowProperty(HWND hwnd, ATOM aProp, LPWSTR pszBuffer, int dwLen)
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}
716
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}
733
734static HTHEME WINAPI
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 {
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}
815
816/***********************************************************************
817 * OpenThemeDataEx (UXTHEME.61)
818 */
820{
821 return OpenThemeDataInternal(g_ActiveThemeFile, hwnd, pszClassList, flags);
822}
823
824/***********************************************************************
825 * OpenThemeDataFromFile (UXTHEME.16)
826 */
828{
829 return OpenThemeDataInternal((PTHEME_FILE)hThemeFile, hwnd, pszClassList, flags);
830}
831
832/***********************************************************************
833 * OpenThemeData (UXTHEME.@)
834 */
836{
837 return OpenThemeDataInternal(g_ActiveThemeFile, hwnd, classlist, 0);
838}
839
840/***********************************************************************
841 * GetWindowTheme (UXTHEME.@)
842 *
843 * Retrieve the last theme opened for a window.
844 *
845 * PARAMS
846 * hwnd [I] window to retrieve the theme for
847 *
848 * RETURNS
849 * The most recent theme.
850 */
852{
853 TRACE("(%p)\n", hwnd);
854
855 if(!IsWindow(hwnd))
856 {
858 return NULL;
859 }
860
862}
863
864/***********************************************************************
865 * SetWindowTheme (UXTHEME.@)
866 *
867 * Persistent through the life of the window, even after themes change
868 */
870 LPCWSTR pszSubIdList)
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
880 if (!SUCCEEDED(hr))
881 return hr;
882
884 if (!SUCCEEDED(hr))
885 return hr;
886
888 return hr;
889}
890
891/***********************************************************************
892 * GetCurrentThemeName (UXTHEME.@)
893 */
894HRESULT WINAPI GetCurrentThemeName(LPWSTR pszThemeFileName, int dwMaxNameChars,
895 LPWSTR pszColorBuff, int cchMaxColorChars,
896 LPWSTR pszSizeBuff, int cchMaxSizeChars)
897{
898 int cchar;
899
902
903 if (pszThemeFileName && dwMaxNameChars)
904 {
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}
929
930/***********************************************************************
931 * GetThemeAppProperties (UXTHEME.@)
932 */
934{
936}
937
938/***********************************************************************
939 * SetThemeAppProperties (UXTHEME.@)
940 */
942{
943 TRACE("(0x%08x)\n", dwFlags);
945}
946
947/***********************************************************************
948 * CloseThemeData (UXTHEME.@)
949 */
951{
952 PUXTHEME_HANDLE pHandle = hTheme;
953 HRESULT hr;
954
955 TRACE("(%p)\n", hTheme);
956
958 return E_HANDLE;
959
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}
969
970/***********************************************************************
971 * HitTestThemeBackground (UXTHEME.@)
972 */
974 int iStateId, DWORD dwOptions,
975 const RECT *pRect, HRGN hrgn,
976 POINT ptTest, WORD *pwHitTestCode)
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}
983
984/***********************************************************************
985 * IsThemePartDefined (UXTHEME.@)
986 */
987BOOL WINAPI IsThemePartDefined(HTHEME hTheme, int iPartId, int iStateId)
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}
1003
1004/***********************************************************************
1005 * GetThemeDocumentationProperty (UXTHEME.@)
1006 *
1007 * Try and retrieve the documentation property from string resources
1008 * if that fails, get it from the [documentation] section of themes.ini
1009 */
1011 LPCWSTR pszPropertyName,
1012 LPWSTR pszValueBuff,
1013 int cchMaxValChars)
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
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
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}
1068
1069/**********************************************************************
1070 * Undocumented functions
1071 */
1072
1073/**********************************************************************
1074 * QueryThemeServices (UXTHEME.1)
1075 *
1076 * RETURNS
1077 * some kind of status flag
1078 */
1080{
1081 FIXME("stub\n");
1082 return 3; /* This is what is returned under XP in most cases */
1083}
1084
1085
1086/**********************************************************************
1087 * OpenThemeFile (UXTHEME.2)
1088 *
1089 * Opens a theme file, which can be used to change the current theme, etc
1090 *
1091 * PARAMS
1092 * pszThemeFileName Path to a msstyles theme file
1093 * pszColorName Color defined in the theme, eg. NormalColor
1094 * pszSizeName Size defined in the theme, eg. NormalSize
1095 * hThemeFile Handle to theme file
1096 *
1097 * RETURNS
1098 * Success: S_OK
1099 * Failure: HRESULT error-code
1100 */
1101HRESULT WINAPI OpenThemeFile(LPCWSTR pszThemeFileName, LPCWSTR pszColorName,
1102 LPCWSTR pszSizeName, HTHEMEFILE *hThemeFile,
1103 DWORD unknown)
1104{
1105 TRACE("(%s,%s,%s,%p,%d)\n", debugstr_w(pszThemeFileName),
1106 debugstr_w(pszColorName), debugstr_w(pszSizeName),
1107 hThemeFile, unknown);
1108
1110 return E_FAIL;
1111
1112 return MSSTYLES_OpenThemeFile(pszThemeFileName, pszColorName, pszSizeName, (PTHEME_FILE*)hThemeFile);
1113}
1114
1115/**********************************************************************
1116 * CloseThemeFile (UXTHEME.3)
1117 *
1118 * Releases theme file handle returned by OpenThemeFile
1119 *
1120 * PARAMS
1121 * hThemeFile Handle to theme file
1122 *
1123 * RETURNS
1124 * Success: S_OK
1125 * Failure: HRESULT error-code
1126 */
1128{
1129 TRACE("(%p)\n", hThemeFile);
1130 MSSTYLES_CloseThemeFile(hThemeFile);
1131 return S_OK;
1132}
1133
1134/**********************************************************************
1135 * ApplyTheme (UXTHEME.4)
1136 *
1137 * Set a theme file to be the currently active theme
1138 *
1139 * PARAMS
1140 * hThemeFile Handle to theme file
1141 * unknown See notes
1142 * hWnd Window requesting the theme change
1143 *
1144 * RETURNS
1145 * Success: S_OK
1146 * Failure: HRESULT error-code
1147 *
1148 * NOTES
1149 * I'm not sure what the second parameter is (the datatype is likely wrong), other then this:
1150 * Under XP if I pass
1151 * char b[] = "";
1152 * the theme is applied with the screen redrawing really badly (flickers)
1153 * char b[] = "\0"; where \0 can be one or more of any character, makes no difference
1154 * the theme is applied smoothly (screen does not flicker)
1155 * char *b = "\0" or NULL; where \0 can be zero or more of any character, makes no difference
1156 * the function fails returning invalid parameter... very strange
1157 */
1159{
1160 HRESULT hr;
1161 TRACE("(%p,%s,%p)\n", hThemeFile, unknown, hWnd);
1162 hr = UXTHEME_ApplyTheme(hThemeFile);
1164 return hr;
1165}
1166
1167/**********************************************************************
1168 * GetThemeDefaults (UXTHEME.7)
1169 *
1170 * Get the default color & size for a theme
1171 *
1172 * PARAMS
1173 * pszThemeFileName Path to a msstyles theme file
1174 * pszColorName Buffer to receive the default color name
1175 * dwColorNameLen Length, in characters, of color name buffer
1176 * pszSizeName Buffer to receive the default size name
1177 * dwSizeNameLen Length, in characters, of size name buffer
1178 *
1179 * RETURNS
1180 * Success: S_OK
1181 * Failure: HRESULT error-code
1182 */
1183HRESULT WINAPI GetThemeDefaults(LPCWSTR pszThemeFileName, LPWSTR pszColorName,
1184 DWORD dwColorNameLen, LPWSTR pszSizeName,
1185 DWORD dwSizeNameLen)
1186{
1188 HRESULT hr;
1189 TRACE("(%s,%p,%d,%p,%d)\n", debugstr_w(pszThemeFileName),
1190 pszColorName, dwColorNameLen,
1191 pszSizeName, dwSizeNameLen);
1192
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}
1205
1206/**********************************************************************
1207 * EnumThemes (UXTHEME.8)
1208 *
1209 * Enumerate available themes, calls specified EnumThemeProc for each
1210 * theme found. Passes lpData through to callback function.
1211 *
1212 * PARAMS
1213 * pszThemePath Path containing themes
1214 * callback Called for each theme found in path
1215 * lpData Passed through to callback
1216 *
1217 * RETURNS
1218 * Success: S_OK
1219 * Failure: HRESULT error-code
1220 */
1222 LPVOID lpData)
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}
1283
1284
1285/**********************************************************************
1286 * EnumThemeColors (UXTHEME.9)
1287 *
1288 * Enumerate theme colors available with a particular size
1289 *
1290 * PARAMS
1291 * pszThemeFileName Path to a msstyles theme file
1292 * pszSizeName Theme size to enumerate available colors
1293 * If NULL the default theme size is used
1294 * dwColorNum Color index to retrieve, increment from 0
1295 * pszColorNames Output color names
1296 *
1297 * RETURNS
1298 * S_OK on success
1299 * E_PROP_ID_UNSUPPORTED when dwColorName does not refer to a color
1300 * or when pszSizeName does not refer to a valid size
1301 *
1302 * NOTES
1303 * XP fails with E_POINTER when pszColorNames points to a buffer smaller than
1304 * sizeof(THEMENAMES).
1305 *
1306 * Not very efficient that I'm opening & validating the theme every call, but
1307 * this is undocumented and almost never called..
1308 * (and this is how windows works too)
1309 */
1310HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName,
1311 DWORD dwColorNum, PTHEMENAMES pszColorNames)
1312{
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
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}
1347
1348/**********************************************************************
1349 * EnumThemeSizes (UXTHEME.10)
1350 *
1351 * Enumerate theme colors available with a particular size
1352 *
1353 * PARAMS
1354 * pszThemeFileName Path to a msstyles theme file
1355 * pszColorName Theme color to enumerate available sizes
1356 * If NULL the default theme color is used
1357 * dwSizeNum Size index to retrieve, increment from 0
1358 * pszSizeNames Output size names
1359 *
1360 * RETURNS
1361 * S_OK on success
1362 * E_PROP_ID_UNSUPPORTED when dwSizeName does not refer to a size
1363 * or when pszColorName does not refer to a valid color
1364 *
1365 * NOTES
1366 * XP fails with E_POINTER when pszSizeNames points to a buffer smaller than
1367 * sizeof(THEMENAMES).
1368 *
1369 * Not very efficient that I'm opening & validating the theme every call, but
1370 * this is undocumented and almost never called..
1371 * (and this is how windows works too)
1372 */
1373HRESULT WINAPI EnumThemeSizes(LPWSTR pszThemeFileName, LPWSTR pszColorName,
1374 DWORD dwSizeNum, PTHEMENAMES pszSizeNames)
1375{
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
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}
1410
1411/**********************************************************************
1412 * ParseThemeIniFile (UXTHEME.11)
1413 *
1414 * Enumerate data in a theme INI file.
1415 *
1416 * PARAMS
1417 * pszIniFileName Path to a theme ini file
1418 * pszUnknown Cannot be NULL, L"" is valid
1419 * callback Called for each found entry
1420 * lpData Passed through to callback
1421 *
1422 * RETURNS
1423 * S_OK on success
1424 * 0x800706488 (Unknown property) when enumeration is canceled from callback
1425 *
1426 * NOTES
1427 * When pszUnknown is NULL the callback is never called, the value does not seem to serve
1428 * any other purpose
1429 */
1430HRESULT WINAPI ParseThemeIniFile(LPCWSTR pszIniFileName, LPWSTR pszUnknown,
1432{
1433 FIXME("%s %s: stub\n", debugstr_w(pszIniFileName), debugstr_w(pszUnknown));
1434 return E_NOTIMPL;
1435}
1436
1437/**********************************************************************
1438 * CheckThemeSignature (UXTHEME.29)
1439 *
1440 * Validates the signature of a theme file
1441 *
1442 * PARAMS
1443 * pszIniFileName Path to a theme file
1444 *
1445 * RETURNS
1446 * Success: S_OK
1447 * Failure: HRESULT error-code
1448 */
1450{
1452 HRESULT hr;
1453 TRACE("(%s)\n", debugstr_w(pszThemeFileName));
1454
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}
static HRGN hrgn
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
HWND hWnd
Definition: settings.c:17
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERR(fmt,...)
Definition: precomp.h:57
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define ERROR_SUCCESS
Definition: deptool.c:10
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
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:1096
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4799
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
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:4882
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2330
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:4009
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1201
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
#define CALLBACK
Definition: compat.h:35
#define lstrcpyW
Definition: compat.h:749
#define lstrcpynW
Definition: compat.h:738
#define lstrlenW
Definition: compat.h:750
UINT WINAPI GetAtomNameW(ATOM nAtom, LPWSTR lpBuffer, int nSize)
Definition: atom.c:589
ATOM WINAPI DeleteAtom(ATOM nAtom)
Definition: atom.c:546
ATOM WINAPI AddAtomW(LPCWSTR lpString)
Definition: atom.c:536
ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString)
Definition: atom.c:444
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName, LPCWSTR pszPropertyName, LPWSTR pszValueBuff, int cchMaxValChars)
Definition: system.c:1010
void UXTHEME_LoadTheme(BOOL bLoad)
Definition: system.c:183
void WINAPI SetThemeAppProperties(DWORD dwFlags)
Definition: system.c:941
HRESULT WINAPI EnableTheming(BOOL fEnable)
Definition: system.c:642
static BOOL bIsThemeActive(LPCWSTR pszTheme, LPCWSTR pszColor, LPCWSTR pszSize)
Definition: system.c:145
static const WCHAR strColorKey[]
Definition: system.c:292
static const WCHAR keyIconTitleFont[]
Definition: system.c:300
HRESULT WINAPI ParseThemeIniFile(LPCWSTR pszIniFileName, LPWSTR pszUnknown, PARSETHEMEINIFILEPROC callback, LPVOID lpData)
Definition: system.c:1430
DWORD WINAPI GetThemeAppProperties(void)
Definition: system.c:933
#define NUM_SYS_COLORS
Definition: system.c:314
static void UXTHEME_SaveSystemMetrics(void)
Definition: system.c:477
static const WCHAR szSizeName[]
Definition: system.c:39
static const WCHAR keyNonClientMetrics[]
Definition: system.c:298
static const struct BackupSysParam backupSysParams[]
static LPWSTR UXTHEME_GetWindowProperty(HWND hwnd, ATOM aProp, LPWSTR pszBuffer, int dwLen)
Definition: system.c:706
HTHEME WINAPI OpenThemeDataEx(HWND hwnd, LPCWSTR pszClassList, DWORD flags)
Definition: system.c:819
static const WCHAR szThemeManager[]
Definition: system.c:31
static HTHEME WINAPI OpenThemeDataInternal(PTHEME_FILE ThemeFile, HWND hwnd, LPCWSTR pszClassList, DWORD flags)
Definition: system.c:735
HINSTANCE hDllInst
Definition: system.c:45
BOOL CALLBACK UXTHEME_broadcast_theme_changed(HWND hWnd, LPARAM enable)
Definition: system.c:68
static const WCHAR szDllName[]
Definition: system.c:41
int g_cHandles
Definition: system.c:57
HTHEME WINAPI OpenThemeDataFromFile(HTHEMEFILE hThemeFile, HWND hwnd, LPCWSTR pszClassList, DWORD flags)
Definition: system.c:827
HRESULT WINAPI SetWindowTheme(HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList)
Definition: system.c:869
HRESULT WINAPI GetCurrentThemeName(LPWSTR pszThemeFileName, int dwMaxNameChars, LPWSTR pszColorBuff, int cchMaxColorChars, LPWSTR pszSizeBuff, int cchMaxSizeChars)
Definition: system.c:894
RTL_HANDLE_TABLE g_UxThemeHandleTable
Definition: system.c:56
static ATOM atSubIdList
Definition: system.c:51
ATOM atWndContext
Definition: system.c:52
DWORD WINAPI QueryThemeServices(void)
Definition: system.c:1079
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
static HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf)
Definition: system.c:132
HRESULT WINAPI ApplyTheme(HTHEMEFILE hThemeFile, char *unknown, HWND hWnd)
Definition: system.c:1158
static void UXTHEME_RestoreSystemMetrics(void)
Definition: system.c:387
BOOL WINAPI IsThemePartDefined(HTHEME hTheme, int iPartId, int iStateId)
Definition: system.c:987
static const WCHAR szIniDocumentation[]
Definition: system.c:43
static HRESULT UXTHEME_SetWindowProperty(HWND hwnd, ATOM aProp, LPCWSTR pszValue)
Definition: system.c:672
HRESULT WINAPI OpenThemeFile(LPCWSTR pszThemeFileName, LPCWSTR pszColorName, LPCWSTR pszSizeName, HTHEMEFILE *hThemeFile, DWORD unknown)
Definition: system.c:1101
static BOOL CALLBACK UXTHEME_send_theme_changed(HWND hWnd, LPARAM enable)
Definition: system.c:61
HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName, DWORD dwColorNum, PTHEMENAMES pszColorNames)
Definition: system.c:1310
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
HRESULT WINAPI EnumThemeSizes(LPWSTR pszThemeFileName, LPWSTR pszColorName, DWORD dwSizeNum, PTHEMENAMES pszSizeNames)
Definition: system.c:1373
static const WCHAR keyGradientCaption[]
Definition: system.c:296
HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, ENUMTHEMEPROC callback, LPVOID lpData)
Definition: system.c:1221
void UXTHEME_InitSystem(HINSTANCE hInst)
Definition: system.c:566
static const WCHAR szThemeActive[]
Definition: system.c:38
HRESULT WINAPI CloseThemeFile(HTHEMEFILE hThemeFile)
Definition: system.c:1127
ATOM atWindowTheme
Definition: system.c:49
PTHEME_FILE g_ActiveThemeFile
Definition: system.c:54
static ATOM atSubAppName
Definition: system.c:50
static DWORD dwThemeAppProperties
Definition: system.c:48
ATOM atDialogThemeEnabled
Definition: system.c:46
static HRESULT UXTHEME_ApplyTheme(PTHEME_FILE tf)
Definition: system.c:512
static void UXTHEME_BackupSystemMetrics(void)
Definition: system.c:343
static const char *const SysColorsNames[]
Definition: system.c:258
BOOL WINAPI IsThemeActive(void)
Definition: system.c:606
HRESULT WINAPI HitTestThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, DWORD dwOptions, const RECT *pRect, HRGN hrgn, POINT ptTest, WORD *pwHitTestCode)
Definition: system.c:973
static DWORD query_reg_path(HKEY hKey, LPCWSTR lpszValue, LPVOID pvData)
Definition: system.c:84
PTHEME_CLASS ValidateHandle(HTHEME hTheme)
Definition: system.c:717
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
static const WCHAR keyFlatMenus[]
Definition: system.c:295
static void save_sys_colors(HKEY baseKey)
Definition: system.c:316
BOOL WINAPI IsAppThemed(void)
Definition: system.c:596
static const WCHAR szColorName[]
Definition: system.c:40
HRESULT WINAPI GetThemeDefaults(LPCWSTR pszThemeFileName, LPWSTR pszColorName, DWORD dwColorNameLen, LPWSTR pszSizeName, DWORD dwSizeNameLen)
Definition: system.c:1183
HRESULT WINAPI CheckThemeSignature(LPCWSTR pszThemeFileName)
Definition: system.c:1449
#define pt(x, y)
Definition: drawing.c:79
#define RGB(r, g, b)
Definition: precomp.h:71
#define GetBValue(quad)
Definition: precomp.h:75
#define GetGValue(quad)
Definition: precomp.h:74
#define GetRValue(quad)
Definition: precomp.h:73
#define UlongToPtr(u)
Definition: config.h:106
HINSTANCE hInst
Definition: dxdiag.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
FxAutoRegKey hKey
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLbitfield flags
Definition: glext.h:7161
GLboolean GLboolean g
Definition: glext.h:6204
GLboolean enable
Definition: glext.h:11120
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
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
HFONT tf
Definition: icontest.c:17
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define b
Definition: ke_i.h:79
#define debugstr_w
Definition: kernel32.h:32
#define REG_SZ
Definition: layer.c:22
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
LPCWSTR szPath
Definition: env.c:37
#define sprintf(buf, format,...)
Definition: sprintf.c:55
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
static IPrintDialogCallback callback
Definition: printdlg.c:326
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
#define min(a, b)
Definition: monoChain.cc:55
PTHEME_PARTSTATE MSSTYLES_FindPartState(PTHEME_CLASS tc, int iPartId, int iStateId, PTHEME_CLASS *tcNext)
Definition: msstyles.c:452
PUXINI_FILE MSSTYLES_GetThemeIni(PTHEME_FILE tf)
Definition: msstyles.c:236
HRESULT MSSTYLES_ReferenceTheme(PTHEME_FILE tf)
Definition: msstyles.c:224
PTHEME_CLASS MSSTYLES_OpenThemeClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassList)
Definition: msstyles.c:756
void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
Definition: msstyles.c:179
HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWSTR pszSizeName, PTHEME_FILE *tf)
Definition: msstyles.c:54
HRESULT MSSTYLES_CloseThemeClass(PTHEME_CLASS tc)
Definition: msstyles.c:822
void MSSTYLES_ParseThemeIni(PTHEME_FILE tf)
Definition: msstyles.c:644
unsigned int UINT
Definition: ndis.h:50
NTSYSAPI VOID NTAPI RtlInitializeHandleTable(_In_ ULONG TableSize, _In_ ULONG HandleSize, _In_ PRTL_HANDLE_TABLE HandleTable)
NTSYSAPI BOOLEAN NTAPI RtlFreeHandle(_In_ PRTL_HANDLE_TABLE HandleTable, _In_ PRTL_HANDLE_TABLE_ENTRY Handle)
NTSYSAPI PRTL_HANDLE_TABLE_ENTRY NTAPI RtlAllocateHandle(_In_ PRTL_HANDLE_TABLE HandleTable, _Inout_ PULONG Index)
NTSYSAPI BOOLEAN NTAPI RtlIsValidHandle(_In_ PRTL_HANDLE_TABLE HandleTable, _In_ PRTL_HANDLE_TABLE_ENTRY Handle)
#define RTL_HANDLE_VALID
Definition: rtltypes.h:376
#define REG_BINARY
Definition: nt_native.h:1496
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define L(x)
Definition: ntvdm.h:50
static const WCHAR szName[]
Definition: powrprof.c:45
static BOOL bThemeActive
Definition: scroll.c:29
#define REG_DWORD
Definition: sdbapi.c:596
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define memset(x, y, z)
Definition: compat.h:39
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwOptions
Definition: solitaire.cpp:25
const WCHAR * keyName
Definition: system.c:306
Definition: rtltypes.h:1247
ULONG Flags
Definition: rtltypes.h:1250
WCHAR szThemeFile[MAX_PATH]
Definition: uxthemep.h:81
LPWSTR pszAvailColors
Definition: uxthemep.h:82
LPWSTR pszSelectedSize
Definition: uxthemep.h:86
PTHEME_CLASS classes
Definition: uxthemep.h:88
LPWSTR pszAvailSizes
Definition: uxthemep.h:83
LPWSTR pszSelectedColor
Definition: uxthemep.h:85
RTL_HANDLE_TABLE_ENTRY Handle
Definition: uxthemep.h:97
PTHEME_CLASS pClass
Definition: uxthemep.h:98
WCHAR szDisplayName[MAX_PATH+1]
Definition: uxundoc.h:53
WCHAR szName[MAX_PATH+1]
Definition: uxundoc.h:52
WCHAR szTooltip[MAX_PATH+1]
Definition: uxundoc.h:54
BOOL MSSTYLES_LookupProperty(LPCWSTR pszPropertyName, int *dwPrimitive, int *dwId)
Definition: stylemap.c:1100
#define max(a, b)
Definition: svc.c:63
BOOL g_bThemeHooksActive
Definition: themehooks.c:15
unsigned char * LPBYTE
Definition: typedefs.h:53
Definition: pdh_main.c:94
BOOL UXINI_FindSection(PUXINI_FILE uf, LPCWSTR lpName)
Definition: uxini.c:200
BOOL UXINI_FindValue(PUXINI_FILE uf, LPCWSTR lpName, LPCWSTR *lpValue, DWORD *dwValueLen)
Definition: uxini.c:280
void UXINI_CloseINI(PUXINI_FILE uf)
Definition: uxini.c:83
struct _UXTHEME_HANDLE * PUXTHEME_HANDLE
BOOL(CALLBACK * ENUMTHEMEPROC)(LPVOID lpReserved, LPCWSTR pszThemeFileName, LPCWSTR pszThemeName, LPCWSTR pszToolTip, LPVOID lpReserved2, LPVOID lpData)
Definition: uxundoc.h:21
BOOL(CALLBACK * PARSETHEMEINIFILEPROC)(DWORD dwType, LPWSTR pszParam1, LPWSTR pszParam2, LPWSTR pszParam3, DWORD dwParam, LPVOID lpData)
Definition: uxundoc.h:44
#define E_PROP_ID_UNSUPPORTED
Definition: vfwmsgs.h:173
#define TMT_COMPANY
Definition: vssym32.h:156
#define TMT_DESCRIPTION
Definition: vssym32.h:161
#define TMT_TOOLTIP
Definition: vssym32.h:155
#define TMT_URL
Definition: vssym32.h:159
#define TMT_VERSION
Definition: vssym32.h:160
#define TMT_DISPLAYNAME
Definition: vssym32.h:154
#define TMT_AUTHOR
Definition: vssym32.h:157
#define TMT_COPYRIGHT
Definition: vssym32.h:158
#define LMEM_ZEROINIT
Definition: winbase.h:400
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define MAKEINTATOM(i)
Definition: winbase.h:1487
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
_In_ ULONG _In_opt_ PVOID pvData
Definition: winddi.h:3749
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
DWORD COLORREF
Definition: windef.h:300
#define WINAPI
Definition: msvc.h:6
#define E_HANDLE
Definition: winerror.h:2850
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define E_POINTER
Definition: winerror.h:2365
#define HKEY_CURRENT_USER
Definition: winreg.h:11
DWORD WINAPI GetSysColor(_In_ int)
BOOL WINAPI IsWindow(_In_opt_ HWND)
HANDLE WINAPI RemovePropW(_In_ HWND, _In_ LPCWSTR)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
BOOL WINAPI SetSysColors(_In_ int cElements, _In_reads_(cElements) CONST INT *lpaElements, _In_reads_(cElements) CONST COLORREF *lpaRgbValues)
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1383
BOOL WINAPI EnumChildWindows(_In_opt_ HWND, _In_ WNDENUMPROC, _In_ LPARAM)
#define SPIF_SENDCHANGE
Definition: winuser.h:1575
#define SPIF_UPDATEINIFILE
Definition: winuser.h:1574
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)
#define SPI_SETICONTITLELOGFONT
Definition: winuser.h:1386
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
_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:409
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193