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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 #include "uxthemedll.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(uxtheme
);
41 /***********************************************************************
42 * Defines and global variables
45 static const WCHAR szThemeManager
[] = {
46 'S','o','f','t','w','a','r','e','\\',
47 'M','i','c','r','o','s','o','f','t','\\',
48 'W','i','n','d','o','w','s','\\',
49 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
50 'T','h','e','m','e','M','a','n','a','g','e','r','\0'
52 static const WCHAR szThemeActive
[] = {'T','h','e','m','e','A','c','t','i','v','e','\0'};
53 static const WCHAR szSizeName
[] = {'S','i','z','e','N','a','m','e','\0'};
54 static const WCHAR szColorName
[] = {'C','o','l','o','r','N','a','m','e','\0'};
55 static const WCHAR szDllName
[] = {'D','l','l','N','a','m','e','\0'};
57 static const WCHAR szIniDocumentation
[] = {'d','o','c','u','m','e','n','t','a','t','i','o','n','\0'};
61 DWORD dwThemeAppProperties
= STAP_ALLOW_NONCLIENT
| STAP_ALLOW_CONTROLS
;
66 BOOL bThemeActive
= FALSE
;
67 WCHAR szCurrentTheme
[MAX_PATH
];
68 WCHAR szCurrentColor
[64];
69 WCHAR szCurrentSize
[64];
71 /***********************************************************************/
73 /***********************************************************************
76 * Set the current active theme from the registry
78 static void UXTHEME_LoadTheme(void)
86 /* Get current theme configuration */
87 if(!RegOpenKeyW(HKEY_CURRENT_USER
, szThemeManager
, &hKey
)) {
88 TRACE("Loading theme config\n");
89 buffsize
= sizeof(tmp
)/sizeof(tmp
[0]);
90 if(!RegQueryValueExW(hKey
, szThemeActive
, NULL
, NULL
, (LPBYTE
)tmp
, &buffsize
)) {
91 bThemeActive
= (tmp
[0] != '0');
95 TRACE("Failed to get ThemeActive: %ld\n", GetLastError());
97 buffsize
= sizeof(szCurrentColor
)/sizeof(szCurrentColor
[0]);
98 if(RegQueryValueExW(hKey
, szColorName
, NULL
, NULL
, (LPBYTE
)szCurrentColor
, &buffsize
))
99 szCurrentColor
[0] = '\0';
100 buffsize
= sizeof(szCurrentSize
)/sizeof(szCurrentSize
[0]);
101 if(RegQueryValueExW(hKey
, szSizeName
, NULL
, NULL
, (LPBYTE
)szCurrentSize
, &buffsize
))
102 szCurrentSize
[0] = '\0';
103 if(SHRegGetPathW(hKey
, NULL
, szDllName
, szCurrentTheme
, 0))
104 szCurrentTheme
[0] = '\0';
108 TRACE("Failed to open theme registry key\n");
111 /* Make sure the theme requested is actually valid */
112 hr
= MSSTYLES_OpenThemeFile(szCurrentTheme
,
113 szCurrentColor
[0]?szCurrentColor
:NULL
,
114 szCurrentSize
[0]?szCurrentSize
:NULL
,
117 bThemeActive
= FALSE
;
118 szCurrentTheme
[0] = '\0';
119 szCurrentColor
[0] = '\0';
120 szCurrentSize
[0] = '\0';
123 /* Make sure the global color & size match the theme */
124 lstrcpynW(szCurrentColor
, pt
->pszSelectedColor
, sizeof(szCurrentColor
)/sizeof(szCurrentColor
[0]));
125 lstrcpynW(szCurrentSize
, pt
->pszSelectedSize
, sizeof(szCurrentSize
)/sizeof(szCurrentSize
[0]));
127 MSSTYLES_SetActiveTheme(pt
);
128 TRACE("Theme active: %s %s %s\n", debugstr_w(szCurrentTheme
),
129 debugstr_w(szCurrentColor
), debugstr_w(szCurrentSize
));
130 MSSTYLES_CloseThemeFile(pt
);
134 MSSTYLES_SetActiveTheme(NULL
);
135 TRACE("Themeing not active\n");
139 /***********************************************************************
140 * UXTHEME_SetActiveTheme
142 * Change the current active theme
144 HRESULT
UXTHEME_SetActiveTheme(PTHEME_FILE tf
)
150 hr
= MSSTYLES_SetActiveTheme(tf
);
155 lstrcpynW(szCurrentTheme
, tf
->szThemeFile
, sizeof(szCurrentTheme
)/sizeof(szCurrentTheme
[0]));
156 lstrcpynW(szCurrentColor
, tf
->pszSelectedColor
, sizeof(szCurrentColor
)/sizeof(szCurrentColor
[0]));
157 lstrcpynW(szCurrentSize
, tf
->pszSelectedSize
, sizeof(szCurrentSize
)/sizeof(szCurrentSize
[0]));
160 bThemeActive
= FALSE
;
161 szCurrentTheme
[0] = '\0';
162 szCurrentColor
[0] = '\0';
163 szCurrentSize
[0] = '\0';
166 TRACE("Writing theme config to registry\n");
167 if(!RegCreateKeyW(HKEY_CURRENT_USER
, szThemeManager
, &hKey
)) {
168 tmp
[0] = bThemeActive
?'1':'0';
170 RegSetValueExW(hKey
, szThemeActive
, 0, REG_SZ
, (const BYTE
*)tmp
, sizeof(WCHAR
)*2);
172 RegSetValueExW(hKey
, szColorName
, 0, REG_SZ
, (const BYTE
*)szCurrentColor
,
173 (lstrlenW(szCurrentColor
)+1)*sizeof(WCHAR
));
174 RegSetValueExW(hKey
, szSizeName
, 0, REG_SZ
, (const BYTE
*)szCurrentSize
,
175 (lstrlenW(szCurrentSize
)+1)*sizeof(WCHAR
));
176 RegSetValueExW(hKey
, szDllName
, 0, REG_SZ
, (const BYTE
*)szCurrentTheme
,
177 (lstrlenW(szCurrentTheme
)+1)*sizeof(WCHAR
));
180 RegDeleteValueW(hKey
, szColorName
);
181 RegDeleteValueW(hKey
, szSizeName
);
182 RegDeleteValueW(hKey
, szDllName
);
188 TRACE("Failed to open theme registry key\n");
192 /***********************************************************************
195 void UXTHEME_InitSystem(HINSTANCE hInst
)
197 static const WCHAR szWindowTheme
[] = {
198 'u','x','_','t','h','e','m','e','\0'
200 static const WCHAR szSubAppName
[] = {
201 'u','x','_','s','u','b','a','p','p','\0'
203 static const WCHAR szSubIdList
[] = {
204 'u','x','_','s','u','b','i','d','l','s','t','\0'
209 atWindowTheme
= GlobalAddAtomW(szWindowTheme
);
210 atSubAppName
= GlobalAddAtomW(szSubAppName
);
211 atSubIdList
= GlobalAddAtomW(szSubIdList
);
216 /***********************************************************************
217 * IsAppThemed (UXTHEME.@)
219 BOOL WINAPI
IsAppThemed(void)
221 return IsThemeActive();
224 /***********************************************************************
225 * IsThemeActive (UXTHEME.@)
227 BOOL WINAPI
IsThemeActive(void)
233 /***********************************************************************
234 * EnableTheming (UXTHEME.@)
237 * This is a global and persistent change
239 HRESULT WINAPI
EnableTheming(BOOL fEnable
)
242 WCHAR szEnabled
[] = {'0','\0'};
244 TRACE("(%d)\n", fEnable
);
246 if(fEnable
!= bThemeActive
) {
247 bThemeActive
= fEnable
;
248 if(bThemeActive
) szEnabled
[0] = '1';
249 if(!RegOpenKeyW(HKEY_CURRENT_USER
, szThemeManager
, &hKey
)) {
250 RegSetValueExW(hKey
, szThemeActive
, 0, REG_SZ
, (LPBYTE
)szEnabled
, sizeof(WCHAR
));
253 PostMessageW(HWND_BROADCAST
, WM_THEMECHANGED
, 0, 0);
258 /***********************************************************************
259 * UXTHEME_SetWindowProperty
261 * I'm using atoms as there may be large numbers of duplicated strings
262 * and they do the work of keeping memory down as a cause of that quite nicely
264 HRESULT
UXTHEME_SetWindowProperty(HWND hwnd
, ATOM aProp
, LPCWSTR pszValue
)
266 ATOM oldValue
= (ATOM
)(size_t)RemovePropW(hwnd
, MAKEINTATOMW(aProp
));
268 DeleteAtom(oldValue
);
270 ATOM atValue
= AddAtomW(pszValue
);
272 || !SetPropW(hwnd
, MAKEINTATOMW(aProp
), (LPWSTR
)MAKEINTATOMW(atValue
))) {
273 HRESULT hr
= HRESULT_FROM_WIN32(GetLastError());
274 if(atValue
) DeleteAtom(atValue
);
281 LPWSTR
UXTHEME_GetWindowProperty(HWND hwnd
, ATOM aProp
, LPWSTR pszBuffer
, int dwLen
)
283 ATOM atValue
= (ATOM
)(size_t)GetPropW(hwnd
, MAKEINTATOMW(aProp
));
285 if(GetAtomNameW(atValue
, pszBuffer
, dwLen
))
287 TRACE("property defined, but unable to get value\n");
292 /***********************************************************************
293 * OpenThemeData (UXTHEME.@)
295 HTHEME WINAPI
OpenThemeData(HWND hwnd
, LPCWSTR pszClassList
)
297 WCHAR szAppBuff
[256];
298 WCHAR szClassBuff
[256];
300 LPCWSTR pszUseClassList
;
302 TRACE("(%p,%s)\n", hwnd
, debugstr_w(pszClassList
));
306 pszAppName
= UXTHEME_GetWindowProperty(hwnd
, atSubAppName
, szAppBuff
, sizeof(szAppBuff
)/sizeof(szAppBuff
[0]));
307 /* If SetWindowTheme was used on the window, that overrides the class list passed to this function */
308 pszUseClassList
= UXTHEME_GetWindowProperty(hwnd
, atSubIdList
, szClassBuff
, sizeof(szClassBuff
)/sizeof(szClassBuff
[0]));
310 pszUseClassList
= pszClassList
;
312 hTheme
= MSSTYLES_OpenThemeClass(pszAppName
, pszUseClassList
);
314 SetPropW(hwnd
, MAKEINTATOMW(atWindowTheme
), hTheme
);
318 /***********************************************************************
319 * GetWindowTheme (UXTHEME.@)
321 * Retrieve the last theme opened for a window
323 HTHEME WINAPI
GetWindowTheme(HWND hwnd
)
325 TRACE("(%p)\n", hwnd
);
326 return GetPropW(hwnd
, MAKEINTATOMW(atWindowTheme
));
329 /***********************************************************************
330 * SetWindowTheme (UXTHEME.@)
332 * Persistent through the life of the window, even after themes change
334 HRESULT WINAPI
SetWindowTheme(HWND hwnd
, LPCWSTR pszSubAppName
,
335 LPCWSTR pszSubIdList
)
338 TRACE("(%p,%s,%s)\n", hwnd
, debugstr_w(pszSubAppName
),
339 debugstr_w(pszSubIdList
));
340 hr
= UXTHEME_SetWindowProperty(hwnd
, atSubAppName
, pszSubAppName
);
342 hr
= UXTHEME_SetWindowProperty(hwnd
, atSubIdList
, pszSubIdList
);
344 PostMessageW(hwnd
, WM_THEMECHANGED
, 0, 0);
348 /***********************************************************************
349 * GetCurrentThemeName (UXTHEME.@)
351 HRESULT WINAPI
GetCurrentThemeName(LPWSTR pszThemeFileName
, int dwMaxNameChars
,
352 LPWSTR pszColorBuff
, int cchMaxColorChars
,
353 LPWSTR pszSizeBuff
, int cchMaxSizeChars
)
356 return E_PROP_ID_UNSUPPORTED
;
357 if(pszThemeFileName
) lstrcpynW(pszThemeFileName
, szCurrentTheme
, dwMaxNameChars
);
358 if(pszColorBuff
) lstrcpynW(pszColorBuff
, szCurrentColor
, cchMaxColorChars
);
359 if(pszSizeBuff
) lstrcpynW(pszSizeBuff
, szCurrentSize
, cchMaxSizeChars
);
363 /***********************************************************************
364 * GetThemeAppProperties (UXTHEME.@)
366 DWORD WINAPI
GetThemeAppProperties(void)
368 return dwThemeAppProperties
;
371 /***********************************************************************
372 * SetThemeAppProperties (UXTHEME.@)
374 void WINAPI
SetThemeAppProperties(DWORD dwFlags
)
376 TRACE("(0x%08lx)\n", dwFlags
);
377 dwThemeAppProperties
= dwFlags
;
380 /***********************************************************************
381 * CloseThemeData (UXTHEME.@)
383 HRESULT WINAPI
CloseThemeData(HTHEME hTheme
)
385 TRACE("(%p)\n", hTheme
);
388 return MSSTYLES_CloseThemeClass(hTheme
);
391 /***********************************************************************
392 * HitTestThemeBackground (UXTHEME.@)
394 HRESULT WINAPI
HitTestThemeBackground(HTHEME hTheme
, HDC hdc
, int iPartId
,
395 int iStateId
, DWORD dwOptions
,
396 const RECT
*pRect
, HRGN hrgn
,
397 POINT ptTest
, WORD
*pwHitTestCode
)
399 FIXME("%d %d 0x%08lx: stub\n", iPartId
, iStateId
, dwOptions
);
402 return ERROR_CALL_NOT_IMPLEMENTED
;
405 /***********************************************************************
406 * IsThemePartDefined (UXTHEME.@)
408 BOOL WINAPI
IsThemePartDefined(HTHEME hTheme
, int iPartId
, int iStateId
)
410 TRACE("(%p,%d,%d)\n", hTheme
, iPartId
, iStateId
);
412 SetLastError(E_HANDLE
);
415 if(MSSTYLES_FindPartState(hTheme
, iPartId
, iStateId
, NULL
))
420 /***********************************************************************
421 * GetThemeDocumentationProperty (UXTHEME.@)
423 * Try and retrieve the documentation property from string resources
424 * if that fails, get it from the [documentation] section of themes.ini
426 HRESULT WINAPI
GetThemeDocumentationProperty(LPCWSTR pszThemeName
,
427 LPCWSTR pszPropertyName
,
431 const WORD wDocToRes
[] = {
432 TMT_DISPLAYNAME
,5000,
446 TRACE("(%s,%s,%p,%d)\n", debugstr_w(pszThemeName
), debugstr_w(pszPropertyName
),
447 pszValueBuff
, cchMaxValChars
);
449 hr
= MSSTYLES_OpenThemeFile(pszThemeName
, NULL
, NULL
, &pt
);
450 if(FAILED(hr
)) return hr
;
452 /* Try to load from string resources */
453 hr
= E_PROP_ID_UNSUPPORTED
;
454 if(MSSTYLES_LookupProperty(pszPropertyName
, NULL
, &iDocId
)) {
455 for(i
=0; i
<sizeof(wDocToRes
)/sizeof(wDocToRes
[0]); i
+=2) {
456 if(wDocToRes
[i
] == iDocId
) {
457 if(LoadStringW(pt
->hTheme
, wDocToRes
[i
+1], pszValueBuff
, cchMaxValChars
)) {
464 /* If loading from string resource failed, try getting it from the theme.ini */
466 PUXINI_FILE uf
= MSSTYLES_GetThemeIni(pt
);
467 if(UXINI_FindSection(uf
, szIniDocumentation
)) {
470 if(UXINI_FindValue(uf
, pszPropertyName
, &lpValue
, &dwLen
)) {
471 lstrcpynW(pszValueBuff
, lpValue
, min(dwLen
+1,cchMaxValChars
));
478 MSSTYLES_CloseThemeFile(pt
);
482 /**********************************************************************
483 * Undocumented functions
486 /**********************************************************************
487 * QueryThemeServices (UXTHEME.1)
490 * some kind of status flag
492 DWORD WINAPI
QueryThemeServices()
495 return 3; /* This is what is returned under XP in most cases */
499 /**********************************************************************
500 * OpenThemeFile (UXTHEME.2)
502 * Opens a theme file, which can be used to change the current theme, etc
505 * pszThemeFileName Path to a msstyles theme file
506 * pszColorName Color defined in the theme, eg. NormalColor
507 * pszSizeName Size defined in the theme, eg. NormalSize
508 * hThemeFile Handle to theme file
510 HRESULT WINAPI
OpenThemeFile(LPCWSTR pszThemeFileName
, LPCWSTR pszColorName
,
511 LPCWSTR pszSizeName
, HTHEMEFILE
*hThemeFile
,
514 TRACE("(%s,%s,%s,%p,%ld)\n", debugstr_w(pszThemeFileName
),
515 debugstr_w(pszColorName
), debugstr_w(pszSizeName
),
516 hThemeFile
, unknown
);
517 return MSSTYLES_OpenThemeFile(pszThemeFileName
, pszColorName
, pszSizeName
, (PTHEME_FILE
*)hThemeFile
);
520 /**********************************************************************
521 * CloseThemeFile (UXTHEME.3)
523 * Releases theme file handle returned by OpenThemeFile
526 * hThemeFile Handle to theme file
528 HRESULT WINAPI
CloseThemeFile(HTHEMEFILE hThemeFile
)
530 TRACE("(%p)\n", hThemeFile
);
531 MSSTYLES_CloseThemeFile(hThemeFile
);
535 /**********************************************************************
536 * ApplyTheme (UXTHEME.4)
538 * Set a theme file to be the currently active theme
541 * hThemeFile Handle to theme file
543 * hWnd Window requesting the theme change
546 * I'm not sure what the second parameter is (the datatype is likely wrong), other then this:
549 * the theme is applied with the screen redrawing really badly (flickers)
550 * char b[] = "\0"; where \0 can be one or more of any character, makes no difference
551 * the theme is applied smoothly (screen does not flicker)
552 * char *b = "\0" or NULL; where \0 can be zero or more of any character, makes no difference
553 * the function fails returning invalid parameter...very strange
555 HRESULT WINAPI
ApplyTheme(HTHEMEFILE hThemeFile
, char *unknown
, HWND hWnd
)
558 TRACE("(%p,%s,%p)\n", hThemeFile
, unknown
, hWnd
);
559 hr
= UXTHEME_SetActiveTheme(hThemeFile
);
560 PostMessageW(HWND_BROADCAST
, WM_THEMECHANGED
, 0, 0);
564 /**********************************************************************
565 * GetThemeDefaults (UXTHEME.7)
567 * Get the default color & size for a theme
570 * pszThemeFileName Path to a msstyles theme file
571 * pszColorName Buffer to receive the default color name
572 * dwColorNameLen Length, in characters, of color name buffer
573 * pszSizeName Buffer to receive the default size name
574 * dwSizeNameLen Length, in characters, of size name buffer
576 HRESULT WINAPI
GetThemeDefaults(LPCWSTR pszThemeFileName
, LPWSTR pszColorName
,
577 DWORD dwColorNameLen
, LPWSTR pszSizeName
,
582 TRACE("(%s,%p,%ld,%p,%ld)\n", debugstr_w(pszThemeFileName
),
583 pszColorName
, dwColorNameLen
,
584 pszSizeName
, dwSizeNameLen
);
586 hr
= MSSTYLES_OpenThemeFile(pszThemeFileName
, NULL
, NULL
, &pt
);
587 if(FAILED(hr
)) return hr
;
589 lstrcpynW(pszColorName
, pt
->pszSelectedColor
, dwColorNameLen
);
590 lstrcpynW(pszSizeName
, pt
->pszSelectedSize
, dwSizeNameLen
);
592 MSSTYLES_CloseThemeFile(pt
);
596 /**********************************************************************
597 * EnumThemes (UXTHEME.8)
599 * Enumerate available themes, calls specified EnumThemeProc for each
600 * theme found. Passes lpData through to callback function.
603 * pszThemePath Path containing themes
604 * callback Called for each theme found in path
605 * lpData Passed through to callback
607 HRESULT WINAPI
EnumThemes(LPCWSTR pszThemePath
, EnumThemeProc callback
,
610 WCHAR szDir
[MAX_PATH
];
611 WCHAR szPath
[MAX_PATH
];
612 static const WCHAR szStar
[] = {'*','.','*','\0'};
613 static const WCHAR szFormat
[] = {'%','s','%','s','\\','%','s','.','m','s','s','t','y','l','e','s','\0'};
614 static const WCHAR szDisplayName
[] = {'d','i','s','p','l','a','y','n','a','m','e','\0'};
615 static const WCHAR szTooltip
[] = {'t','o','o','l','t','i','p','\0'};
619 WIN32_FIND_DATAW wfd
;
622 TRACE("(%s,%p,%p)\n", debugstr_w(pszThemePath
), callback
, lpData
);
624 if(!pszThemePath
|| !callback
)
627 lstrcpyW(szDir
, pszThemePath
);
628 PathAddBackslashW(szDir
);
630 lstrcpyW(szPath
, szDir
);
631 lstrcatW(szPath
, szStar
);
632 TRACE("searching %s\n", debugstr_w(szPath
));
634 hFind
= FindFirstFileW(szPath
, &wfd
);
635 if(hFind
!= INVALID_HANDLE_VALUE
) {
637 if(wfd
.dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY
638 && !(wfd
.cFileName
[0] == '.' && ((wfd
.cFileName
[1] == '.' && wfd
.cFileName
[2] == 0) || wfd
.cFileName
[1] == 0))) {
639 wsprintfW(szPath
, szFormat
, szDir
, wfd
.cFileName
, wfd
.cFileName
);
641 hr
= GetThemeDocumentationProperty(szPath
, szDisplayName
, szName
, sizeof(szName
)/sizeof(szName
[0]));
643 hr
= GetThemeDocumentationProperty(szPath
, szTooltip
, szTip
, sizeof(szTip
)/sizeof(szTip
[0]));
645 TRACE("callback(%s,%s,%s,%p)\n", debugstr_w(szPath
), debugstr_w(szName
), debugstr_w(szTip
), lpData
);
646 if(!callback(NULL
, szPath
, szName
, szTip
, NULL
, lpData
)) {
647 TRACE("callback ended enum\n");
652 } while(FindNextFileW(hFind
, &wfd
));
659 /**********************************************************************
660 * EnumThemeColors (UXTHEME.9)
662 * Enumerate theme colors available with a particular size
665 * pszThemeFileName Path to a msstyles theme file
666 * pszSizeName Theme size to enumerate available colors
667 * If NULL the default theme size is used
668 * dwColorNum Color index to retrieve, increment from 0
669 * pszColorName Output color name
673 * E_PROP_ID_UNSUPPORTED when dwColorName does not refer to a color
674 * or when pszSizeName does not refer to a valid size
677 * XP fails with E_POINTER when pszColorName points to a buffer smaller then 605
680 * Not very efficient that I'm opening & validating the theme every call, but
681 * this is undocumented and almost never called..
682 * (and this is how windows works too)
684 HRESULT WINAPI
EnumThemeColors(LPWSTR pszThemeFileName
, LPWSTR pszSizeName
,
685 DWORD dwColorNum
, LPWSTR pszColorName
)
690 TRACE("(%s,%s,%ld)\n", debugstr_w(pszThemeFileName
),
691 debugstr_w(pszSizeName
), dwColorNum
);
693 hr
= MSSTYLES_OpenThemeFile(pszThemeFileName
, NULL
, pszSizeName
, &pt
);
694 if(FAILED(hr
)) return hr
;
696 tmp
= pt
->pszAvailColors
;
697 while(dwColorNum
&& *tmp
) {
699 tmp
+= lstrlenW(tmp
)+1;
701 if(!dwColorNum
&& *tmp
) {
702 TRACE("%s\n", debugstr_w(tmp
));
703 lstrcpyW(pszColorName
, tmp
);
706 hr
= E_PROP_ID_UNSUPPORTED
;
708 MSSTYLES_CloseThemeFile(pt
);
712 /**********************************************************************
713 * EnumThemeSizes (UXTHEME.10)
715 * Enumerate theme colors available with a particular size
718 * pszThemeFileName Path to a msstyles theme file
719 * pszColorName Theme color to enumerate available sizes
720 * If NULL the default theme color is used
721 * dwSizeNum Size index to retrieve, increment from 0
722 * pszSizeName Output size name
726 * E_PROP_ID_UNSUPPORTED when dwSizeName does not refer to a size
727 * or when pszColorName does not refer to a valid color
730 * XP fails with E_POINTER when pszSizeName points to a buffer smaller then 605
733 * Not very efficient that I'm opening & validating the theme every call, but
734 * this is undocumented and almost never called..
735 * (and this is how windows works too)
737 HRESULT WINAPI
EnumThemeSizes(LPWSTR pszThemeFileName
, LPWSTR pszColorName
,
738 DWORD dwSizeNum
, LPWSTR pszSizeName
)
743 TRACE("(%s,%s,%ld)\n", debugstr_w(pszThemeFileName
),
744 debugstr_w(pszColorName
), dwSizeNum
);
746 hr
= MSSTYLES_OpenThemeFile(pszThemeFileName
, pszColorName
, NULL
, &pt
);
747 if(FAILED(hr
)) return hr
;
749 tmp
= pt
->pszAvailSizes
;
750 while(dwSizeNum
&& *tmp
) {
752 tmp
+= lstrlenW(tmp
)+1;
754 if(!dwSizeNum
&& *tmp
) {
755 TRACE("%s\n", debugstr_w(tmp
));
756 lstrcpyW(pszSizeName
, tmp
);
759 hr
= E_PROP_ID_UNSUPPORTED
;
761 MSSTYLES_CloseThemeFile(pt
);
765 /**********************************************************************
766 * ParseThemeIniFile (UXTHEME.11)
768 * Enumerate data in a theme INI file.
771 * pszIniFileName Path to a theme ini file
772 * pszUnknown Cannot be NULL, L"" is valid
773 * callback Called for each found entry
774 * lpData Passed through to callback
778 * 0x800706488 (Unknown property) when enumeration is canceled from callback
781 * When pszUnknown is NULL the callback is never called, the value does not seem to surve
784 HRESULT WINAPI
ParseThemeIniFile(LPCWSTR pszIniFileName
, LPWSTR pszUnknown
,
785 ParseThemeIniFileProc callback
, LPVOID lpData
)
787 FIXME("%s %s: stub\n", debugstr_w(pszIniFileName
), debugstr_w(pszUnknown
));
788 return ERROR_CALL_NOT_IMPLEMENTED
;
791 /**********************************************************************
792 * CheckThemeSignature (UXTHEME.29)
794 * Validates the signature of a theme file
797 * pszIniFileName Path to a theme file
799 HRESULT WINAPI
CheckThemeSignature(LPCWSTR pszThemeFileName
)
803 TRACE("(%s)\n", debugstr_w(pszThemeFileName
));
804 hr
= MSSTYLES_OpenThemeFile(pszThemeFileName
, NULL
, NULL
, &pt
);
807 MSSTYLES_CloseThemeFile(pt
);