2 * Win32 5.1 Theme system
4 * Copyright (C) 2003 Kevin Koltzau
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.
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.
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
27 /***********************************************************************
28 * Defines and global variables
31 static 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'
38 static const WCHAR szThemeActive
[] = {'T','h','e','m','e','A','c','t','i','v','e','\0'};
39 static const WCHAR szSizeName
[] = {'S','i','z','e','N','a','m','e','\0'};
40 static const WCHAR szColorName
[] = {'C','o','l','o','r','N','a','m','e','\0'};
41 static const WCHAR szDllName
[] = {'D','l','l','N','a','m','e','\0'};
43 static const WCHAR szIniDocumentation
[] = {'d','o','c','u','m','e','n','t','a','t','i','o','n','\0'};
46 ATOM atDialogThemeEnabled
;
48 static DWORD dwThemeAppProperties
= STAP_ALLOW_NONCLIENT
| STAP_ALLOW_CONTROLS
;
50 static ATOM atSubAppName
;
51 static ATOM atSubIdList
;
54 PTHEME_FILE g_ActiveThemeFile
;
56 RTL_HANDLE_TABLE g_UxThemeHandleTable
;
59 /***********************************************************************/
61 static BOOL CALLBACK
UXTHEME_broadcast_msg_enumchild (HWND hWnd
, LPARAM msg
)
63 SendMessageW(hWnd
, msg
, 0, 0);
67 /* Broadcast a message to *all* windows, including children */
68 BOOL CALLBACK
UXTHEME_broadcast_msg (HWND hWnd
, LPARAM msg
)
72 EnumWindows (UXTHEME_broadcast_msg
, msg
);
76 SendMessageW(hWnd
, msg
, 0, 0);
77 EnumChildWindows (hWnd
, UXTHEME_broadcast_msg_enumchild
, msg
);
82 /* At the end of the day this is a subset of what SHRegGetPath() does - copied
83 * here to avoid linking against shlwapi. */
84 static DWORD
query_reg_path (HKEY hKey
, LPCWSTR lpszValue
,
87 DWORD dwRet
, dwType
, dwUnExpDataLen
= MAX_PATH
* sizeof(WCHAR
), dwExpDataLen
;
89 TRACE("(hkey=%p,%s,%p)\n", hKey
, debugstr_w(lpszValue
),
92 dwRet
= RegQueryValueExW(hKey
, lpszValue
, 0, &dwType
, pvData
, &dwUnExpDataLen
);
93 if (dwRet
!=ERROR_SUCCESS
&& dwRet
!=ERROR_MORE_DATA
)
96 if (dwType
== REG_EXPAND_SZ
)
100 /* Expand type REG_EXPAND_SZ into REG_SZ */
103 /* If the caller didn't supply a buffer or the buffer is too small we have
104 * to allocate our own
106 if (dwRet
== ERROR_MORE_DATA
)
109 nBytesToAlloc
= dwUnExpDataLen
;
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
);
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
);
132 static HRESULT
UXTHEME_SetActiveTheme(PTHEME_FILE tf
)
134 if(g_ActiveThemeFile
)
135 MSSTYLES_CloseThemeFile(g_ActiveThemeFile
);
136 g_ActiveThemeFile
= tf
;
137 if (g_ActiveThemeFile
)
139 MSSTYLES_ReferenceTheme(g_ActiveThemeFile
);
140 MSSTYLES_ParseThemeIni(g_ActiveThemeFile
);
145 static BOOL
bIsThemeActive(LPCWSTR pszTheme
, LPCWSTR pszColor
, LPCWSTR pszSize
)
147 if (g_ActiveThemeFile
== NULL
)
150 if (wcscmp(pszTheme
, g_ActiveThemeFile
->szThemeFile
) != 0)
155 if (g_ActiveThemeFile
->pszAvailColors
!= g_ActiveThemeFile
->pszSelectedColor
)
160 if (wcscmp(pszColor
, g_ActiveThemeFile
->pszSelectedColor
) != 0)
166 if (g_ActiveThemeFile
->pszAvailSizes
!= g_ActiveThemeFile
->pszSelectedSize
)
171 if (wcscmp(pszSize
, g_ActiveThemeFile
->pszSelectedSize
) != 0)
178 /***********************************************************************
181 * Set the current active theme from the registry
183 void UXTHEME_LoadTheme(BOOL bLoad
)
190 WCHAR szCurrentTheme
[MAX_PATH
];
191 WCHAR szCurrentColor
[64];
192 WCHAR szCurrentSize
[64];
193 BOOL bThemeActive
= FALSE
;
195 if ((bLoad
!= FALSE
) && g_bThemeHooksActive
)
197 /* Get current theme configuration */
198 if(!RegOpenKeyW(HKEY_CURRENT_USER
, szThemeManager
, &hKey
)) {
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');
205 bThemeActive
= FALSE
;
206 TRACE("Failed to get ThemeActive: %d\n", GetLastError());
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';
219 TRACE("Failed to open theme registry key\n");
223 bThemeActive
= FALSE
;
228 if( bIsThemeActive(szCurrentTheme
, szCurrentColor
, szCurrentSize
) )
230 TRACE("Tried to load active theme again\n");
234 /* Make sure the theme requested is actually valid */
235 hr
= MSSTYLES_OpenThemeFile(szCurrentTheme
,
236 szCurrentColor
[0]?szCurrentColor
:NULL
,
237 szCurrentSize
[0]?szCurrentSize
:NULL
,
240 bThemeActive
= FALSE
;
243 TRACE("Theme active: %s %s %s\n", debugstr_w(szCurrentTheme
),
244 debugstr_w(szCurrentColor
), debugstr_w(szCurrentSize
));
246 UXTHEME_SetActiveTheme(pt
);
247 MSSTYLES_CloseThemeFile(pt
);
251 UXTHEME_SetActiveTheme(NULL
);
252 TRACE("Theming not active\n");
256 /***********************************************************************/
258 static const char * const SysColorsNames
[] =
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 */
292 static const WCHAR strColorKey
[] =
293 { 'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
294 'C','o','l','o','r','s',0 };
295 static const WCHAR keyFlatMenus
[] = { 'F','l','a','t','M','e','n','u', 0};
296 static const WCHAR keyGradientCaption
[] = { 'G','r','a','d','i','e','n','t',
297 'C','a','p','t','i','o','n', 0 };
298 static const WCHAR keyNonClientMetrics
[] = { 'N','o','n','C','l','i','e','n','t',
299 'M','e','t','r','i','c','s',0 };
300 static const WCHAR keyIconTitleFont
[] = { 'I','c','o','n','T','i','t','l','e',
303 static const struct BackupSysParam
306 const WCHAR
* keyName
;
307 } backupSysParams
[] =
309 {SPI_GETFLATMENU
, SPI_SETFLATMENU
, keyFlatMenus
},
310 {SPI_GETGRADIENTCAPTIONS
, SPI_SETGRADIENTCAPTIONS
, keyGradientCaption
},
314 #define NUM_SYS_COLORS (COLOR_MENUBAR+1)
316 static void save_sys_colors (HKEY baseKey
)
322 if (RegCreateKeyExW( baseKey
, strColorKey
,
323 0, 0, 0, KEY_ALL_ACCESS
,
324 0, &hKey
, 0 ) == ERROR_SUCCESS
)
326 for (i
= 0; i
< NUM_SYS_COLORS
; i
++)
328 COLORREF col
= GetSysColor (i
);
330 sprintf (colorStr
, "%d %d %d",
331 GetRValue (col
), GetGValue (col
), GetBValue (col
));
333 RegSetValueExA (hKey
, SysColorsNames
[i
], 0, REG_SZ
,
334 (BYTE
*)colorStr
, strlen (colorStr
)+1);
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
343 static void UXTHEME_BackupSystemMetrics(void)
346 const struct BackupSysParam
* bsp
= backupSysParams
;
348 if (RegCreateKeyExW( HKEY_CURRENT_USER
, szThemeManager
,
349 0, 0, 0, KEY_ALL_ACCESS
,
350 0, &hKey
, 0) == ERROR_SUCCESS
)
352 NONCLIENTMETRICSW ncm
;
353 LOGFONTW iconTitleFont
;
356 save_sys_colors (hKey
);
358 /* back up "other" settings */
359 while (bsp
->spiGet
>= 0)
363 SystemParametersInfoW (bsp
->spiGet
, 0, &value
, 0);
364 RegSetValueExW (hKey
, bsp
->keyName
, 0, REG_DWORD
,
365 (LPBYTE
)&value
, sizeof (value
));
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);
374 RegSetValueExW (hKey
, keyNonClientMetrics
, 0, REG_BINARY
, (LPBYTE
)&ncm
,
376 memset (&iconTitleFont
, 0, sizeof (iconTitleFont
));
377 SystemParametersInfoW (SPI_GETICONTITLELOGFONT
, sizeof (iconTitleFont
),
379 RegSetValueExW (hKey
, keyIconTitleFont
, 0, REG_BINARY
,
380 (LPBYTE
)&iconTitleFont
, sizeof (iconTitleFont
));
386 /* Read back old settings after a theme was deactivated */
387 static void UXTHEME_RestoreSystemMetrics(void)
390 const struct BackupSysParam
* bsp
= backupSysParams
;
392 if (RegOpenKeyExW (HKEY_CURRENT_USER
, szThemeManager
,
393 0, KEY_QUERY_VALUE
, &hKey
) == ERROR_SUCCESS
)
397 /* read backed-up colors */
398 if (RegOpenKeyExW (hKey
, strColorKey
,
399 0, KEY_QUERY_VALUE
, &colorKey
) == ERROR_SUCCESS
)
402 COLORREF sysCols
[NUM_SYS_COLORS
];
403 int sysColsIndices
[NUM_SYS_COLORS
];
406 for (i
= 0; i
< NUM_SYS_COLORS
; i
++)
410 DWORD count
= sizeof(colorStr
);
412 if (RegQueryValueExA (colorKey
, SysColorsNames
[i
], 0,
413 &type
, (LPBYTE
) colorStr
, &count
) == ERROR_SUCCESS
)
416 if (sscanf (colorStr
, "%d %d %d", &r
, &g
, &b
) == 3)
418 sysColsIndices
[sysColCount
] = i
;
419 sysCols
[sysColCount
] = RGB(r
, g
, b
);
424 RegCloseKey (colorKey
);
426 SetSysColors (sysColCount
, sysColsIndices
, sysCols
);
429 /* read backed-up other settings */
430 while (bsp
->spiGet
>= 0)
433 DWORD count
= sizeof(value
);
436 if (RegQueryValueExW (hKey
, bsp
->keyName
, 0,
437 &type
, (LPBYTE
)&value
, &count
) == ERROR_SUCCESS
)
439 SystemParametersInfoW (bsp
->spiSet
, 0, UlongToPtr(value
), SPIF_UPDATEINIFILE
);
445 /* read backed-up non-client metrics */
447 NONCLIENTMETRICSW ncm
;
448 LOGFONTW iconTitleFont
;
449 DWORD count
= sizeof(ncm
);
452 if (RegQueryValueExW (hKey
, keyNonClientMetrics
, 0,
453 &type
, (LPBYTE
)&ncm
, &count
) == ERROR_SUCCESS
)
455 SystemParametersInfoW (SPI_SETNONCLIENTMETRICS
,
456 count
, &ncm
, SPIF_UPDATEINIFILE
);
459 count
= sizeof(iconTitleFont
);
461 if (RegQueryValueExW (hKey
, keyIconTitleFont
, 0,
462 &type
, (LPBYTE
)&iconTitleFont
, &count
) == ERROR_SUCCESS
)
464 SystemParametersInfoW (SPI_SETICONTITLELOGFONT
,
465 count
, &iconTitleFont
, SPIF_UPDATEINIFILE
);
473 /* Make system settings persistent, so they're in effect even w/o uxtheme
475 * For efficiency reasons, only the last SystemParametersInfoW sets
476 * SPIF_SENDWININICHANGE */
477 static void UXTHEME_SaveSystemMetrics(void)
479 const struct BackupSysParam
* bsp
= backupSysParams
;
480 NONCLIENTMETRICSW ncm
;
481 LOGFONTW iconTitleFont
;
483 save_sys_colors (HKEY_CURRENT_USER
);
485 while (bsp
->spiGet
>= 0)
489 SystemParametersInfoW (bsp
->spiGet
, 0, &value
, 0);
490 SystemParametersInfoW (bsp
->spiSet
, 0, UlongToPtr(value
), SPIF_UPDATEINIFILE
);
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
,
500 memset (&iconTitleFont
, 0, sizeof (iconTitleFont
));
501 SystemParametersInfoW (SPI_GETICONTITLELOGFONT
, sizeof (iconTitleFont
),
503 SystemParametersInfoW (SPI_SETICONTITLELOGFONT
, sizeof (iconTitleFont
),
504 &iconTitleFont
, SPIF_UPDATEINIFILE
| SPIF_SENDCHANGE
);
507 /***********************************************************************
510 * Change the current active theme
512 static HRESULT
UXTHEME_ApplyTheme(PTHEME_FILE tf
)
518 TRACE("UXTHEME_ApplyTheme\n");
520 if (tf
&& !g_ActiveThemeFile
)
522 UXTHEME_BackupSystemMetrics();
525 hr
= UXTHEME_SetActiveTheme(tf
);
531 UXTHEME_RestoreSystemMetrics();
534 TRACE("Writing theme config to registry\n");
535 if(!RegCreateKeyW(HKEY_CURRENT_USER
, szThemeManager
, &hKey
)) {
536 tmp
[0] = g_ActiveThemeFile
? '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
));
548 RegDeleteValueW(hKey
, szColorName
);
549 RegDeleteValueW(hKey
, szSizeName
);
550 RegDeleteValueW(hKey
, szDllName
);
556 TRACE("Failed to open theme registry key\n");
558 UXTHEME_SaveSystemMetrics ();
563 /***********************************************************************
566 void UXTHEME_InitSystem(HINSTANCE hInst
)
568 static const WCHAR szWindowTheme
[] = {
569 'u','x','_','t','h','e','m','e','\0'
571 static const WCHAR szSubAppName
[] = {
572 'u','x','_','s','u','b','a','p','p','\0'
574 static const WCHAR szSubIdList
[] = {
575 'u','x','_','s','u','b','i','d','l','s','t','\0'
577 static const WCHAR szDialogThemeEnabled
[] = {
578 'u','x','_','d','i','a','l','o','g','t','h','e','m','e','\0'
583 atWindowTheme
= GlobalAddAtomW(szWindowTheme
);
584 atSubAppName
= GlobalAddAtomW(szSubAppName
);
585 atSubIdList
= GlobalAddAtomW(szSubIdList
);
586 atDialogThemeEnabled
= GlobalAddAtomW(szDialogThemeEnabled
);
587 atWndContext
= GlobalAddAtomW(L
"ux_WndContext");
589 RtlInitializeHandleTable(0xFFF, sizeof(UXTHEME_HANDLE
), &g_UxThemeHandleTable
);
593 /***********************************************************************
594 * IsAppThemed (UXTHEME.@)
596 BOOL WINAPI
IsAppThemed(void)
599 SetLastError(ERROR_SUCCESS
);
600 return (g_ActiveThemeFile
!= NULL
);
603 /***********************************************************************
604 * IsThemeActive (UXTHEME.@)
606 BOOL WINAPI
IsThemeActive(void)
614 TRACE("IsThemeActive\n");
615 SetLastError(ERROR_SUCCESS
);
617 if (g_ActiveThemeFile
)
620 if (g_bThemeHooksActive
)
624 Result
= RegOpenKeyW(HKEY_CURRENT_USER
, szThemeManager
, &hKey
);
625 if (Result
== ERROR_SUCCESS
)
627 buffsize
= sizeof(tmp
);
628 if (!RegQueryValueExW(hKey
, szThemeActive
, NULL
, NULL
, (LPBYTE
)tmp
, &buffsize
))
629 bActive
= (tmp
[0] != '0');
636 /***********************************************************************
637 * EnableTheming (UXTHEME.@)
640 * This is a global and persistent change
642 HRESULT WINAPI
EnableTheming(BOOL fEnable
)
645 WCHAR szEnabled
[] = {'0','\0'};
647 TRACE("(%d)\n", fEnable
);
649 if (fEnable
!= (g_ActiveThemeFile
!= NULL
)) {
651 UXTHEME_BackupSystemMetrics();
653 UXTHEME_RestoreSystemMetrics();
654 UXTHEME_SaveSystemMetrics ();
656 if (fEnable
) szEnabled
[0] = '1';
657 if(!RegOpenKeyW(HKEY_CURRENT_USER
, szThemeManager
, &hKey
)) {
658 RegSetValueExW(hKey
, szThemeActive
, 0, REG_SZ
, (LPBYTE
)szEnabled
, sizeof(WCHAR
));
661 UXTHEME_broadcast_msg (NULL
, WM_THEMECHANGED
);
666 /***********************************************************************
667 * UXTHEME_SetWindowProperty
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
672 static HRESULT
UXTHEME_SetWindowProperty(HWND hwnd
, ATOM aProp
, LPCWSTR pszValue
)
674 ATOM oldValue
= (ATOM
)(size_t)RemovePropW(hwnd
, (LPCWSTR
)MAKEINTATOM(aProp
));
677 DeleteAtom(oldValue
);
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 */
689 atValue
= AddAtomW(pszValue
);
692 ERR("AddAtomW for %S failed with last error %d!\n", pszValue
, GetLastError());
693 return HRESULT_FROM_WIN32(GetLastError());
696 if (!SetPropW(hwnd
, (LPCWSTR
)MAKEINTATOM(aProp
), (LPWSTR
)MAKEINTATOM(atValue
)))
698 ERR("SetPropW for atom %d failed with last error %d\n", aProp
, GetLastError());
699 if(atValue
) DeleteAtom(atValue
);
700 return HRESULT_FROM_WIN32(GetLastError());
706 static LPWSTR
UXTHEME_GetWindowProperty(HWND hwnd
, ATOM aProp
, LPWSTR pszBuffer
, int dwLen
)
708 ATOM atValue
= (ATOM
)(size_t)GetPropW(hwnd
, (LPCWSTR
)MAKEINTATOM(aProp
));
710 if(GetAtomNameW(atValue
, pszBuffer
, dwLen
))
712 TRACE("property defined, but unable to get value\n");
717 PTHEME_CLASS
ValidateHandle(HTHEME hTheme
)
719 PUXTHEME_HANDLE pHandle
;
721 if (!g_bThemeHooksActive
|| !hTheme
|| hTheme
== INVALID_HANDLE_VALUE
)
724 if (!RtlIsValidHandle(&g_UxThemeHandleTable
, (PRTL_HANDLE_TABLE_ENTRY
)hTheme
))
726 ERR("Invalid handle 0x%x!\n", hTheme
);
731 return pHandle
->pClass
;
735 OpenThemeDataInternal(PTHEME_FILE ThemeFile
, HWND hwnd
, LPCWSTR pszClassList
, DWORD flags
)
737 WCHAR szAppBuff
[256];
738 WCHAR szClassBuff
[256];
740 LPCWSTR pszUseClassList
;
741 HTHEME hTheme
= NULL
;
742 TRACE("(%p,%s, %x)\n", hwnd
, debugstr_w(pszClassList
), flags
);
746 SetLastError(E_POINTER
);
750 if ((flags
& OTD_NONCLIENT
) && !(dwThemeAppProperties
& STAP_ALLOW_NONCLIENT
))
752 SetLastError(E_PROP_ID_UNSUPPORTED
);
756 if (!(flags
& OTD_NONCLIENT
) && !(dwThemeAppProperties
& STAP_ALLOW_CONTROLS
))
758 SetLastError(E_PROP_ID_UNSUPPORTED
);
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]));
768 pszUseClassList
= pszClassList
;
773 PUXTHEME_HANDLE pHandle
;
775 if (!ThemeFile
->classes
)
776 MSSTYLES_ParseThemeIni(ThemeFile
);
777 pClass
= MSSTYLES_OpenThemeClass(ThemeFile
, pszAppName
, pszUseClassList
);
781 pHandle
= (PUXTHEME_HANDLE
)RtlAllocateHandle(&g_UxThemeHandleTable
, NULL
);
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
;
792 MSSTYLES_CloseThemeClass(pClass
);
800 if ((flags
& OTD_NONCLIENT
) == 0)
802 SetPropW(hwnd
, (LPCWSTR
)MAKEINTATOM(atWindowTheme
), hTheme
);
807 SetLastError(E_PROP_ID_UNSUPPORTED
);
810 SetLastError(hTheme
? ERROR_SUCCESS
: E_PROP_ID_UNSUPPORTED
);
812 TRACE(" = %p\n", hTheme
);
816 /***********************************************************************
817 * OpenThemeDataEx (UXTHEME.61)
819 HTHEME WINAPI
OpenThemeDataEx(HWND hwnd
, LPCWSTR pszClassList
, DWORD flags
)
821 return OpenThemeDataInternal(g_ActiveThemeFile
, hwnd
, pszClassList
, flags
);
824 /***********************************************************************
825 * OpenThemeDataFromFile (UXTHEME.16)
827 HTHEME WINAPI
OpenThemeDataFromFile(HTHEMEFILE hThemeFile
, HWND hwnd
, LPCWSTR pszClassList
, DWORD flags
)
829 return OpenThemeDataInternal((PTHEME_FILE
)hThemeFile
, hwnd
, pszClassList
, flags
);
832 /***********************************************************************
833 * OpenThemeData (UXTHEME.@)
835 HTHEME WINAPI
OpenThemeData(HWND hwnd
, LPCWSTR classlist
)
837 return OpenThemeDataInternal(g_ActiveThemeFile
, hwnd
, classlist
, 0);
840 /***********************************************************************
841 * GetWindowTheme (UXTHEME.@)
843 * Retrieve the last theme opened for a window.
846 * hwnd [I] window to retrieve the theme for
849 * The most recent theme.
851 HTHEME WINAPI
GetWindowTheme(HWND hwnd
)
853 TRACE("(%p)\n", hwnd
);
857 SetLastError(E_HANDLE
);
861 return GetPropW(hwnd
, (LPCWSTR
)MAKEINTATOM(atWindowTheme
));
864 /***********************************************************************
865 * SetWindowTheme (UXTHEME.@)
867 * Persistent through the life of the window, even after themes change
869 HRESULT WINAPI
SetWindowTheme(HWND hwnd
, LPCWSTR pszSubAppName
,
870 LPCWSTR pszSubIdList
)
873 TRACE("(%p,%s,%s)\n", hwnd
, debugstr_w(pszSubAppName
),
874 debugstr_w(pszSubIdList
));
879 hr
= UXTHEME_SetWindowProperty(hwnd
, atSubAppName
, pszSubAppName
);
883 hr
= UXTHEME_SetWindowProperty(hwnd
, atSubIdList
, pszSubIdList
);
887 UXTHEME_broadcast_msg (hwnd
, WM_THEMECHANGED
);
891 /***********************************************************************
892 * GetCurrentThemeName (UXTHEME.@)
894 HRESULT WINAPI
GetCurrentThemeName(LPWSTR pszThemeFileName
, int dwMaxNameChars
,
895 LPWSTR pszColorBuff
, int cchMaxColorChars
,
896 LPWSTR pszSizeBuff
, int cchMaxSizeChars
)
900 if(g_ActiveThemeFile
== NULL
)
901 return E_PROP_ID_UNSUPPORTED
;
903 if (pszThemeFileName
&& dwMaxNameChars
)
905 cchar
= lstrlenW(g_ActiveThemeFile
->szThemeFile
) + 1;
906 if(cchar
> dwMaxNameChars
)
907 return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER
);
908 lstrcpynW(pszThemeFileName
, g_ActiveThemeFile
->szThemeFile
, cchar
);
911 if (pszColorBuff
&& cchMaxColorChars
)
913 cchar
= lstrlenW(g_ActiveThemeFile
->pszSelectedColor
) + 1;
914 if(cchar
> cchMaxColorChars
)
915 return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER
);
916 lstrcpynW(pszColorBuff
, g_ActiveThemeFile
->pszSelectedColor
, cchar
);
919 if (pszSizeBuff
&& cchMaxSizeChars
)
921 cchar
= lstrlenW(g_ActiveThemeFile
->pszSelectedSize
) + 1;
922 if(cchar
> cchMaxSizeChars
)
923 return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER
);
924 lstrcpynW(pszSizeBuff
, g_ActiveThemeFile
->pszSelectedSize
, cchar
);
930 /***********************************************************************
931 * GetThemeAppProperties (UXTHEME.@)
933 DWORD WINAPI
GetThemeAppProperties(void)
935 return dwThemeAppProperties
;
938 /***********************************************************************
939 * SetThemeAppProperties (UXTHEME.@)
941 void WINAPI
SetThemeAppProperties(DWORD dwFlags
)
943 TRACE("(0x%08x)\n", dwFlags
);
944 dwThemeAppProperties
= dwFlags
;
947 /***********************************************************************
948 * CloseThemeData (UXTHEME.@)
950 HRESULT WINAPI
CloseThemeData(HTHEME hTheme
)
952 PUXTHEME_HANDLE pHandle
= hTheme
;
955 TRACE("(%p)\n", hTheme
);
957 if (!RtlIsValidHandle(&g_UxThemeHandleTable
, (PRTL_HANDLE_TABLE_ENTRY
)hTheme
))
960 hr
= MSSTYLES_CloseThemeClass(pHandle
->pClass
);
963 RtlFreeHandle(&g_UxThemeHandleTable
, (PRTL_HANDLE_TABLE_ENTRY
)pHandle
);
965 TRACE("Destroying handle 0x%x for class 0x%x. Count: %d\n", pHandle
, pHandle
->pClass
, g_cHandles
);
970 /***********************************************************************
971 * HitTestThemeBackground (UXTHEME.@)
973 HRESULT WINAPI
HitTestThemeBackground(HTHEME hTheme
, HDC hdc
, int iPartId
,
974 int iStateId
, DWORD dwOptions
,
975 const RECT
*pRect
, HRGN hrgn
,
976 POINT ptTest
, WORD
*pwHitTestCode
)
978 FIXME("%d %d 0x%08x: stub\n", iPartId
, iStateId
, dwOptions
);
979 if (!ValidateHandle(hTheme
))
984 /***********************************************************************
985 * IsThemePartDefined (UXTHEME.@)
987 BOOL WINAPI
IsThemePartDefined(HTHEME hTheme
, int iPartId
, int iStateId
)
991 TRACE("(%p,%d,%d)\n", hTheme
, iPartId
, iStateId
);
993 pClass
= ValidateHandle(hTheme
);
996 SetLastError(E_HANDLE
);
999 if(MSSTYLES_FindPartState(pClass
, iPartId
, iStateId
, NULL
))
1004 /***********************************************************************
1005 * GetThemeDocumentationProperty (UXTHEME.@)
1007 * Try and retrieve the documentation property from string resources
1008 * if that fails, get it from the [documentation] section of themes.ini
1010 HRESULT WINAPI
GetThemeDocumentationProperty(LPCWSTR pszThemeName
,
1011 LPCWSTR pszPropertyName
,
1012 LPWSTR pszValueBuff
,
1015 const WORD wDocToRes
[] = {
1016 TMT_DISPLAYNAME
,5000,
1023 TMT_DESCRIPTION
,5007
1030 TRACE("(%s,%s,%p,%d)\n", debugstr_w(pszThemeName
), debugstr_w(pszPropertyName
),
1031 pszValueBuff
, cchMaxValChars
);
1033 if (!g_bThemeHooksActive
)
1036 hr
= MSSTYLES_OpenThemeFile(pszThemeName
, NULL
, NULL
, &pt
);
1037 if(FAILED(hr
)) return hr
;
1039 /* Try to load from string resources */
1040 hr
= E_PROP_ID_UNSUPPORTED
;
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
)) {
1051 /* If loading from string resource failed, try getting it from the theme.ini */
1053 PUXINI_FILE uf
= MSSTYLES_GetThemeIni(pt
);
1054 if(UXINI_FindSection(uf
, szIniDocumentation
)) {
1057 if(UXINI_FindValue(uf
, pszPropertyName
, &lpValue
, &dwLen
)) {
1058 lstrcpynW(pszValueBuff
, lpValue
, min(dwLen
+1,cchMaxValChars
));
1065 MSSTYLES_CloseThemeFile(pt
);
1069 /**********************************************************************
1070 * Undocumented functions
1073 /**********************************************************************
1074 * QueryThemeServices (UXTHEME.1)
1077 * some kind of status flag
1079 DWORD WINAPI
QueryThemeServices(void)
1082 return 3; /* This is what is returned under XP in most cases */
1086 /**********************************************************************
1087 * OpenThemeFile (UXTHEME.2)
1089 * Opens a theme file, which can be used to change the current theme, etc
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
1099 * Failure: HRESULT error-code
1101 HRESULT WINAPI
OpenThemeFile(LPCWSTR pszThemeFileName
, LPCWSTR pszColorName
,
1102 LPCWSTR pszSizeName
, HTHEMEFILE
*hThemeFile
,
1105 TRACE("(%s,%s,%s,%p,%d)\n", debugstr_w(pszThemeFileName
),
1106 debugstr_w(pszColorName
), debugstr_w(pszSizeName
),
1107 hThemeFile
, unknown
);
1109 if (!g_bThemeHooksActive
)
1112 return MSSTYLES_OpenThemeFile(pszThemeFileName
, pszColorName
, pszSizeName
, (PTHEME_FILE
*)hThemeFile
);
1115 /**********************************************************************
1116 * CloseThemeFile (UXTHEME.3)
1118 * Releases theme file handle returned by OpenThemeFile
1121 * hThemeFile Handle to theme file
1125 * Failure: HRESULT error-code
1127 HRESULT WINAPI
CloseThemeFile(HTHEMEFILE hThemeFile
)
1129 TRACE("(%p)\n", hThemeFile
);
1130 MSSTYLES_CloseThemeFile(hThemeFile
);
1134 /**********************************************************************
1135 * ApplyTheme (UXTHEME.4)
1137 * Set a theme file to be the currently active theme
1140 * hThemeFile Handle to theme file
1142 * hWnd Window requesting the theme change
1146 * Failure: HRESULT error-code
1149 * I'm not sure what the second parameter is (the datatype is likely wrong), other then this:
1150 * Under XP if I pass
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
1158 HRESULT WINAPI
ApplyTheme(HTHEMEFILE hThemeFile
, char *unknown
, HWND hWnd
)
1161 TRACE("(%p,%s,%p)\n", hThemeFile
, unknown
, hWnd
);
1162 hr
= UXTHEME_ApplyTheme(hThemeFile
);
1163 UXTHEME_broadcast_msg (NULL
, WM_THEMECHANGED
);
1167 /**********************************************************************
1168 * GetThemeDefaults (UXTHEME.7)
1170 * Get the default color & size for a theme
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
1181 * Failure: HRESULT error-code
1183 HRESULT WINAPI
GetThemeDefaults(LPCWSTR pszThemeFileName
, LPWSTR pszColorName
,
1184 DWORD dwColorNameLen
, LPWSTR pszSizeName
,
1185 DWORD dwSizeNameLen
)
1189 TRACE("(%s,%p,%d,%p,%d)\n", debugstr_w(pszThemeFileName
),
1190 pszColorName
, dwColorNameLen
,
1191 pszSizeName
, dwSizeNameLen
);
1193 if (!g_bThemeHooksActive
)
1196 hr
= MSSTYLES_OpenThemeFile(pszThemeFileName
, NULL
, NULL
, &pt
);
1197 if(FAILED(hr
)) return hr
;
1199 lstrcpynW(pszColorName
, pt
->pszSelectedColor
, dwColorNameLen
);
1200 lstrcpynW(pszSizeName
, pt
->pszSelectedSize
, dwSizeNameLen
);
1202 MSSTYLES_CloseThemeFile(pt
);
1206 /**********************************************************************
1207 * EnumThemes (UXTHEME.8)
1209 * Enumerate available themes, calls specified EnumThemeProc for each
1210 * theme found. Passes lpData through to callback function.
1213 * pszThemePath Path containing themes
1214 * callback Called for each theme found in path
1215 * lpData Passed through to callback
1219 * Failure: HRESULT error-code
1221 HRESULT WINAPI
EnumThemes(LPCWSTR pszThemePath
, ENUMTHEMEPROC callback
,
1224 WCHAR szDir
[MAX_PATH
];
1225 WCHAR szPath
[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'};
1233 WIN32_FIND_DATAW wfd
;
1237 TRACE("(%s,%p,%p)\n", debugstr_w(pszThemePath
), callback
, lpData
);
1239 if(!pszThemePath
|| !callback
)
1242 lstrcpyW(szDir
, pszThemePath
);
1243 pathLen
= lstrlenW (szDir
);
1244 if ((pathLen
> 0) && (pathLen
< MAX_PATH
-1) && (szDir
[pathLen
- 1] != '\\'))
1246 szDir
[pathLen
] = '\\';
1247 szDir
[pathLen
+1] = 0;
1250 lstrcpyW(szPath
, szDir
);
1251 lstrcatW(szPath
, szStar
);
1252 TRACE("searching %s\n", debugstr_w(szPath
));
1254 hFind
= FindFirstFileW(szPath
, &wfd
);
1255 if(hFind
!= INVALID_HANDLE_VALUE
) {
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
);
1261 hr
= GetThemeDocumentationProperty(szPath
, szDisplayName
, szName
, sizeof(szName
)/sizeof(szName
[0]));
1263 hr
= GetThemeDocumentationProperty(szPath
, szTooltip
, szTip
, sizeof(szTip
)/sizeof(szTip
[0]));
1265 TRACE("callback(%s,%s,%s,%p)\n", debugstr_w(szPath
), debugstr_w(szName
), debugstr_w(szTip
), lpData
);
1266 if(!callback(NULL
, szPath
, szName
, szTip
, NULL
, lpData
)) {
1267 TRACE("callback ended enum\n");
1272 } while(FindNextFileW(hFind
, &wfd
));
1279 /**********************************************************************
1280 * EnumThemeColors (UXTHEME.9)
1282 * Enumerate theme colors available with a particular size
1285 * pszThemeFileName Path to a msstyles theme file
1286 * pszSizeName Theme size to enumerate available colors
1287 * If NULL the default theme size is used
1288 * dwColorNum Color index to retrieve, increment from 0
1289 * pszColorNames Output color names
1293 * E_PROP_ID_UNSUPPORTED when dwColorName does not refer to a color
1294 * or when pszSizeName does not refer to a valid size
1297 * XP fails with E_POINTER when pszColorNames points to a buffer smaller than
1298 * sizeof(THEMENAMES).
1300 * Not very efficient that I'm opening & validating the theme every call, but
1301 * this is undocumented and almost never called..
1302 * (and this is how windows works too)
1304 HRESULT WINAPI
EnumThemeColors(LPWSTR pszThemeFileName
, LPWSTR pszSizeName
,
1305 DWORD dwColorNum
, PTHEMENAMES pszColorNames
)
1310 UINT resourceId
= dwColorNum
+ 1000;
1311 TRACE("(%s,%s,%d)\n", debugstr_w(pszThemeFileName
),
1312 debugstr_w(pszSizeName
), dwColorNum
);
1314 if (!g_bThemeHooksActive
)
1317 hr
= MSSTYLES_OpenThemeFile(pszThemeFileName
, NULL
, pszSizeName
, &pt
);
1318 if(FAILED(hr
)) return hr
;
1320 tmp
= pt
->pszAvailColors
;
1321 while(dwColorNum
&& *tmp
) {
1323 tmp
+= lstrlenW(tmp
)+1;
1325 if(!dwColorNum
&& *tmp
) {
1326 TRACE("%s\n", debugstr_w(tmp
));
1327 lstrcpyW(pszColorNames
->szName
, tmp
);
1328 LoadStringW (pt
->hTheme
, resourceId
,
1329 pszColorNames
->szDisplayName
,
1330 sizeof (pszColorNames
->szDisplayName
) / sizeof (WCHAR
));
1331 LoadStringW (pt
->hTheme
, resourceId
+1000,
1332 pszColorNames
->szTooltip
,
1333 sizeof (pszColorNames
->szTooltip
) / sizeof (WCHAR
));
1336 hr
= E_PROP_ID_UNSUPPORTED
;
1338 MSSTYLES_CloseThemeFile(pt
);
1342 /**********************************************************************
1343 * EnumThemeSizes (UXTHEME.10)
1345 * Enumerate theme colors available with a particular size
1348 * pszThemeFileName Path to a msstyles theme file
1349 * pszColorName Theme color to enumerate available sizes
1350 * If NULL the default theme color is used
1351 * dwSizeNum Size index to retrieve, increment from 0
1352 * pszSizeNames Output size names
1356 * E_PROP_ID_UNSUPPORTED when dwSizeName does not refer to a size
1357 * or when pszColorName does not refer to a valid color
1360 * XP fails with E_POINTER when pszSizeNames points to a buffer smaller than
1361 * sizeof(THEMENAMES).
1363 * Not very efficient that I'm opening & validating the theme every call, but
1364 * this is undocumented and almost never called..
1365 * (and this is how windows works too)
1367 HRESULT WINAPI
EnumThemeSizes(LPWSTR pszThemeFileName
, LPWSTR pszColorName
,
1368 DWORD dwSizeNum
, PTHEMENAMES pszSizeNames
)
1373 UINT resourceId
= dwSizeNum
+ 3000;
1374 TRACE("(%s,%s,%d)\n", debugstr_w(pszThemeFileName
),
1375 debugstr_w(pszColorName
), dwSizeNum
);
1377 if (!g_bThemeHooksActive
)
1380 hr
= MSSTYLES_OpenThemeFile(pszThemeFileName
, pszColorName
, NULL
, &pt
);
1381 if(FAILED(hr
)) return hr
;
1383 tmp
= pt
->pszAvailSizes
;
1384 while(dwSizeNum
&& *tmp
) {
1386 tmp
+= lstrlenW(tmp
)+1;
1388 if(!dwSizeNum
&& *tmp
) {
1389 TRACE("%s\n", debugstr_w(tmp
));
1390 lstrcpyW(pszSizeNames
->szName
, tmp
);
1391 LoadStringW (pt
->hTheme
, resourceId
,
1392 pszSizeNames
->szDisplayName
,
1393 sizeof (pszSizeNames
->szDisplayName
) / sizeof (WCHAR
));
1394 LoadStringW (pt
->hTheme
, resourceId
+1000,
1395 pszSizeNames
->szTooltip
,
1396 sizeof (pszSizeNames
->szTooltip
) / sizeof (WCHAR
));
1399 hr
= E_PROP_ID_UNSUPPORTED
;
1401 MSSTYLES_CloseThemeFile(pt
);
1405 /**********************************************************************
1406 * ParseThemeIniFile (UXTHEME.11)
1408 * Enumerate data in a theme INI file.
1411 * pszIniFileName Path to a theme ini file
1412 * pszUnknown Cannot be NULL, L"" is valid
1413 * callback Called for each found entry
1414 * lpData Passed through to callback
1418 * 0x800706488 (Unknown property) when enumeration is canceled from callback
1421 * When pszUnknown is NULL the callback is never called, the value does not seem to serve
1424 HRESULT WINAPI
ParseThemeIniFile(LPCWSTR pszIniFileName
, LPWSTR pszUnknown
,
1425 PARSETHEMEINIFILEPROC callback
, LPVOID lpData
)
1427 FIXME("%s %s: stub\n", debugstr_w(pszIniFileName
), debugstr_w(pszUnknown
));
1431 /**********************************************************************
1432 * CheckThemeSignature (UXTHEME.29)
1434 * Validates the signature of a theme file
1437 * pszIniFileName Path to a theme file
1441 * Failure: HRESULT error-code
1443 HRESULT WINAPI
CheckThemeSignature(LPCWSTR pszThemeFileName
)
1447 TRACE("(%s)\n", debugstr_w(pszThemeFileName
));
1449 if (!g_bThemeHooksActive
)
1452 hr
= MSSTYLES_OpenThemeFile(pszThemeFileName
, NULL
, NULL
, &pt
);
1455 MSSTYLES_CloseThemeFile(pt
);