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;
65 ATOM atDialogThemeEnabled;
67 BOOL bThemeActive = FALSE;
68 WCHAR szCurrentTheme[MAX_PATH];
69 WCHAR szCurrentColor[64];
70 WCHAR szCurrentSize[64];
72 /***********************************************************************/
74 static BOOL CALLBACK UXTHEME_broadcast_msg_enumchild (HWND hWnd, LPARAM msg)
76 PostMessageW(hWnd, msg, 0, 0);
80 /* Broadcast a message to *all* windows, including children */
81 static BOOL CALLBACK UXTHEME_broadcast_msg (HWND hWnd, LPARAM msg)
85 EnumWindows (UXTHEME_broadcast_msg, msg);
89 PostMessageW(hWnd, msg, 0, 0);
90 EnumChildWindows (hWnd, UXTHEME_broadcast_msg_enumchild, msg);
95 /***********************************************************************
98 * Set the current active theme from the registry
100 static void UXTHEME_LoadTheme(void)
108 /* Get current theme configuration */
109 if(!RegOpenKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) {
110 TRACE("Loading theme config\n");
111 buffsize = sizeof(tmp)/sizeof(tmp[0]);
112 if(!RegQueryValueExW(hKey, szThemeActive, NULL, NULL, (LPBYTE)tmp, &buffsize)) {
113 bThemeActive = (tmp[0] != '0');
116 bThemeActive = FALSE;
117 TRACE("Failed to get ThemeActive: %ld\n", GetLastError());
119 buffsize = sizeof(szCurrentColor)/sizeof(szCurrentColor[0]);
120 if(RegQueryValueExW(hKey, szColorName, NULL, NULL, (LPBYTE)szCurrentColor, &buffsize))
121 szCurrentColor[0] = '\0';
122 buffsize = sizeof(szCurrentSize)/sizeof(szCurrentSize[0]);
123 if(RegQueryValueExW(hKey, szSizeName, NULL, NULL, (LPBYTE)szCurrentSize, &buffsize))
124 szCurrentSize[0] = '\0';
125 if(SHRegGetPathW(hKey, NULL, szDllName, szCurrentTheme, 0))
126 szCurrentTheme[0] = '\0';
130 TRACE("Failed to open theme registry key\n");
133 /* Make sure the theme requested is actually valid */
134 hr = MSSTYLES_OpenThemeFile(szCurrentTheme,
135 szCurrentColor[0]?szCurrentColor:NULL,
136 szCurrentSize[0]?szCurrentSize:NULL,
139 bThemeActive = FALSE;
140 szCurrentTheme[0] = '\0';
141 szCurrentColor[0] = '\0';
142 szCurrentSize[0] = '\0';
145 /* Make sure the global color & size match the theme */
146 lstrcpynW(szCurrentColor, pt->pszSelectedColor, sizeof(szCurrentColor)/sizeof(szCurrentColor[0]));
147 lstrcpynW(szCurrentSize, pt->pszSelectedSize, sizeof(szCurrentSize)/sizeof(szCurrentSize[0]));
149 MSSTYLES_SetActiveTheme(pt);
150 TRACE("Theme active: %s %s %s\n", debugstr_w(szCurrentTheme),
151 debugstr_w(szCurrentColor), debugstr_w(szCurrentSize));
152 MSSTYLES_CloseThemeFile(pt);
156 MSSTYLES_SetActiveTheme(NULL);
157 TRACE("Themeing not active\n");
161 /***********************************************************************
162 * UXTHEME_SetActiveTheme
164 * Change the current active theme
166 HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf)
172 hr = MSSTYLES_SetActiveTheme(tf);
177 lstrcpynW(szCurrentTheme, tf->szThemeFile, sizeof(szCurrentTheme)/sizeof(szCurrentTheme[0]));
178 lstrcpynW(szCurrentColor, tf->pszSelectedColor, sizeof(szCurrentColor)/sizeof(szCurrentColor[0]));
179 lstrcpynW(szCurrentSize, tf->pszSelectedSize, sizeof(szCurrentSize)/sizeof(szCurrentSize[0]));
182 bThemeActive = FALSE;
183 szCurrentTheme[0] = '\0';
184 szCurrentColor[0] = '\0';
185 szCurrentSize[0] = '\0';
188 TRACE("Writing theme config to registry\n");
189 if(!RegCreateKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) {
190 tmp[0] = bThemeActive?'1':'0';
192 RegSetValueExW(hKey, szThemeActive, 0, REG_SZ, (const BYTE*)tmp, sizeof(WCHAR)*2);
194 RegSetValueExW(hKey, szColorName, 0, REG_SZ, (const BYTE*)szCurrentColor,
195 (lstrlenW(szCurrentColor)+1)*sizeof(WCHAR));
196 RegSetValueExW(hKey, szSizeName, 0, REG_SZ, (const BYTE*)szCurrentSize,
197 (lstrlenW(szCurrentSize)+1)*sizeof(WCHAR));
198 RegSetValueExW(hKey, szDllName, 0, REG_SZ, (const BYTE*)szCurrentTheme,
199 (lstrlenW(szCurrentTheme)+1)*sizeof(WCHAR));
202 RegDeleteValueW(hKey, szColorName);
203 RegDeleteValueW(hKey, szSizeName);
204 RegDeleteValueW(hKey, szDllName);
210 TRACE("Failed to open theme registry key\n");
214 /***********************************************************************
217 void UXTHEME_InitSystem(HINSTANCE hInst)
219 static const WCHAR szWindowTheme[] = {
220 'u','x','_','t','h','e','m','e','\0'
222 static const WCHAR szSubAppName[] = {
223 'u','x','_','s','u','b','a','p','p','\0'
225 static const WCHAR szSubIdList[] = {
226 'u','x','_','s','u','b','i','d','l','s','t','\0'
228 static const WCHAR szDialogThemeEnabled[] = {
229 'u','x','_','d','i','a','l','o','g','t','h','e','m','e','\0'
234 atWindowTheme = GlobalAddAtomW(szWindowTheme);
235 atSubAppName = GlobalAddAtomW(szSubAppName);
236 atSubIdList = GlobalAddAtomW(szSubIdList);
237 atDialogThemeEnabled = GlobalAddAtomW(szDialogThemeEnabled);
242 /***********************************************************************
243 * IsAppThemed (UXTHEME.@)
245 BOOL WINAPI IsAppThemed(void)
247 return IsThemeActive();
250 /***********************************************************************
251 * IsThemeActive (UXTHEME.@)
253 BOOL WINAPI IsThemeActive(void)
259 /***********************************************************************
260 * EnableTheming (UXTHEME.@)
263 * This is a global and persistent change
265 HRESULT WINAPI EnableTheming(BOOL fEnable)
268 WCHAR szEnabled[] = {'0','\0'};
270 TRACE("(%d)\n", fEnable);
272 if(fEnable != bThemeActive) {
273 bThemeActive = fEnable;
274 if(bThemeActive) szEnabled[0] = '1';
275 if(!RegOpenKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) {
276 RegSetValueExW(hKey, szThemeActive, 0, REG_SZ, (LPBYTE)szEnabled, sizeof(WCHAR));
279 UXTHEME_broadcast_msg (NULL, WM_THEMECHANGED);
284 /***********************************************************************
285 * UXTHEME_SetWindowProperty
287 * I'm using atoms as there may be large numbers of duplicated strings
288 * and they do the work of keeping memory down as a cause of that quite nicely
290 HRESULT UXTHEME_SetWindowProperty(HWND hwnd, ATOM aProp, LPCWSTR pszValue)
292 ATOM oldValue = (ATOM)(size_t)RemovePropW(hwnd, MAKEINTATOMW(aProp));
294 DeleteAtom(oldValue);
296 ATOM atValue = AddAtomW(pszValue);
298 || !SetPropW(hwnd, MAKEINTATOMW(aProp), (LPWSTR)MAKEINTATOMW(atValue))) {
299 HRESULT hr = HRESULT_FROM_WIN32(GetLastError());
300 if(atValue) DeleteAtom(atValue);
307 LPWSTR UXTHEME_GetWindowProperty(HWND hwnd, ATOM aProp, LPWSTR pszBuffer, int dwLen)
309 ATOM atValue = (ATOM)(size_t)GetPropW(hwnd, MAKEINTATOMW(aProp));
311 if(GetAtomNameW(atValue, pszBuffer, dwLen))
313 TRACE("property defined, but unable to get value\n");
318 /***********************************************************************
319 * OpenThemeData (UXTHEME.@)
321 HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR pszClassList)
323 WCHAR szAppBuff[256];
324 WCHAR szClassBuff[256];
326 LPCWSTR pszUseClassList;
328 TRACE("(%p,%s)\n", hwnd, debugstr_w(pszClassList));
332 pszAppName = UXTHEME_GetWindowProperty(hwnd, atSubAppName, szAppBuff, sizeof(szAppBuff)/sizeof(szAppBuff[0]));
333 /* If SetWindowTheme was used on the window, that overrides the class list passed to this function */
334 pszUseClassList = UXTHEME_GetWindowProperty(hwnd, atSubIdList, szClassBuff, sizeof(szClassBuff)/sizeof(szClassBuff[0]));
336 pszUseClassList = pszClassList;
338 if (!pszClassList) return NULL;
340 hTheme = MSSTYLES_OpenThemeClass(pszAppName, pszUseClassList);
342 SetPropW(hwnd, MAKEINTATOMW(atWindowTheme), hTheme);
346 /***********************************************************************
347 * GetWindowTheme (UXTHEME.@)
349 * Retrieve the last theme opened for a window
351 HTHEME WINAPI GetWindowTheme(HWND hwnd)
353 TRACE("(%p)\n", hwnd);
354 return GetPropW(hwnd, MAKEINTATOMW(atWindowTheme));
357 /***********************************************************************
358 * SetWindowTheme (UXTHEME.@)
360 * Persistent through the life of the window, even after themes change
362 HRESULT WINAPI SetWindowTheme(HWND hwnd, LPCWSTR pszSubAppName,
363 LPCWSTR pszSubIdList)
366 TRACE("(%p,%s,%s)\n", hwnd, debugstr_w(pszSubAppName),
367 debugstr_w(pszSubIdList));
368 hr = UXTHEME_SetWindowProperty(hwnd, atSubAppName, pszSubAppName);
370 hr = UXTHEME_SetWindowProperty(hwnd, atSubIdList, pszSubIdList);
372 UXTHEME_broadcast_msg (hwnd, WM_THEMECHANGED);
376 /***********************************************************************
377 * GetCurrentThemeName (UXTHEME.@)
379 HRESULT WINAPI GetCurrentThemeName(LPWSTR pszThemeFileName, int dwMaxNameChars,
380 LPWSTR pszColorBuff, int cchMaxColorChars,
381 LPWSTR pszSizeBuff, int cchMaxSizeChars)
384 return E_PROP_ID_UNSUPPORTED;
385 if(pszThemeFileName) lstrcpynW(pszThemeFileName, szCurrentTheme, dwMaxNameChars);
386 if(pszColorBuff) lstrcpynW(pszColorBuff, szCurrentColor, cchMaxColorChars);
387 if(pszSizeBuff) lstrcpynW(pszSizeBuff, szCurrentSize, cchMaxSizeChars);
391 /***********************************************************************
392 * GetThemeAppProperties (UXTHEME.@)
394 DWORD WINAPI GetThemeAppProperties(void)
396 return dwThemeAppProperties;
399 /***********************************************************************
400 * SetThemeAppProperties (UXTHEME.@)
402 void WINAPI SetThemeAppProperties(DWORD dwFlags)
404 TRACE("(0x%08lx)\n", dwFlags);
405 dwThemeAppProperties = dwFlags;
408 /***********************************************************************
409 * CloseThemeData (UXTHEME.@)
411 HRESULT WINAPI CloseThemeData(HTHEME hTheme)
413 TRACE("(%p)\n", hTheme);
416 return MSSTYLES_CloseThemeClass(hTheme);
419 /***********************************************************************
420 * HitTestThemeBackground (UXTHEME.@)
422 HRESULT WINAPI HitTestThemeBackground(HTHEME hTheme, HDC hdc, int iPartId,
423 int iStateId, DWORD dwOptions,
424 const RECT *pRect, HRGN hrgn,
425 POINT ptTest, WORD *pwHitTestCode)
427 FIXME("%d %d 0x%08lx: stub\n", iPartId, iStateId, dwOptions);
430 return ERROR_CALL_NOT_IMPLEMENTED;
433 /***********************************************************************
434 * IsThemePartDefined (UXTHEME.@)
436 BOOL WINAPI IsThemePartDefined(HTHEME hTheme, int iPartId, int iStateId)
438 TRACE("(%p,%d,%d)\n", hTheme, iPartId, iStateId);
440 SetLastError(E_HANDLE);
443 if(MSSTYLES_FindPartState(hTheme, iPartId, iStateId, NULL))
448 /***********************************************************************
449 * GetThemeDocumentationProperty (UXTHEME.@)
451 * Try and retrieve the documentation property from string resources
452 * if that fails, get it from the [documentation] section of themes.ini
454 HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName,
455 LPCWSTR pszPropertyName,
459 const WORD wDocToRes[] = {
460 TMT_DISPLAYNAME,5000,
474 TRACE("(%s,%s,%p,%d)\n", debugstr_w(pszThemeName), debugstr_w(pszPropertyName),
475 pszValueBuff, cchMaxValChars);
477 hr = MSSTYLES_OpenThemeFile(pszThemeName, NULL, NULL, &pt);
478 if(FAILED(hr)) return hr;
480 /* Try to load from string resources */
481 hr = E_PROP_ID_UNSUPPORTED;
482 if(MSSTYLES_LookupProperty(pszPropertyName, NULL, &iDocId)) {
483 for(i=0; i<sizeof(wDocToRes)/sizeof(wDocToRes[0]); i+=2) {
484 if(wDocToRes[i] == iDocId) {
485 if(LoadStringW(pt->hTheme, wDocToRes[i+1], pszValueBuff, cchMaxValChars)) {
492 /* If loading from string resource failed, try getting it from the theme.ini */
494 PUXINI_FILE uf = MSSTYLES_GetThemeIni(pt);
495 if(UXINI_FindSection(uf, szIniDocumentation)) {
498 if(UXINI_FindValue(uf, pszPropertyName, &lpValue, &dwLen)) {
499 lstrcpynW(pszValueBuff, lpValue, min(dwLen+1,cchMaxValChars));
506 MSSTYLES_CloseThemeFile(pt);
510 /**********************************************************************
511 * Undocumented functions
514 /**********************************************************************
515 * QueryThemeServices (UXTHEME.1)
518 * some kind of status flag
520 DWORD WINAPI QueryThemeServices()
523 return 3; /* This is what is returned under XP in most cases */
527 /**********************************************************************
528 * OpenThemeFile (UXTHEME.2)
530 * Opens a theme file, which can be used to change the current theme, etc
533 * pszThemeFileName Path to a msstyles theme file
534 * pszColorName Color defined in the theme, eg. NormalColor
535 * pszSizeName Size defined in the theme, eg. NormalSize
536 * hThemeFile Handle to theme file
538 HRESULT WINAPI OpenThemeFile(LPCWSTR pszThemeFileName, LPCWSTR pszColorName,
539 LPCWSTR pszSizeName, HTHEMEFILE *hThemeFile,
542 TRACE("(%s,%s,%s,%p,%ld)\n", debugstr_w(pszThemeFileName),
543 debugstr_w(pszColorName), debugstr_w(pszSizeName),
544 hThemeFile, unknown);
545 return MSSTYLES_OpenThemeFile(pszThemeFileName, pszColorName, pszSizeName, (PTHEME_FILE*)hThemeFile);
548 /**********************************************************************
549 * CloseThemeFile (UXTHEME.3)
551 * Releases theme file handle returned by OpenThemeFile
554 * hThemeFile Handle to theme file
556 HRESULT WINAPI CloseThemeFile(HTHEMEFILE hThemeFile)
558 TRACE("(%p)\n", hThemeFile);
559 MSSTYLES_CloseThemeFile(hThemeFile);
563 /**********************************************************************
564 * ApplyTheme (UXTHEME.4)
566 * Set a theme file to be the currently active theme
569 * hThemeFile Handle to theme file
571 * hWnd Window requesting the theme change
574 * I'm not sure what the second parameter is (the datatype is likely wrong), other then this:
577 * the theme is applied with the screen redrawing really badly (flickers)
578 * char b[] = "\0"; where \0 can be one or more of any character, makes no difference
579 * the theme is applied smoothly (screen does not flicker)
580 * char *b = "\0" or NULL; where \0 can be zero or more of any character, makes no difference
581 * the function fails returning invalid parameter...very strange
583 HRESULT WINAPI ApplyTheme(HTHEMEFILE hThemeFile, char *unknown, HWND hWnd)
586 TRACE("(%p,%s,%p)\n", hThemeFile, unknown, hWnd);
587 hr = UXTHEME_SetActiveTheme(hThemeFile);
588 UXTHEME_broadcast_msg (NULL, WM_THEMECHANGED);
592 /**********************************************************************
593 * GetThemeDefaults (UXTHEME.7)
595 * Get the default color & size for a theme
598 * pszThemeFileName Path to a msstyles theme file
599 * pszColorName Buffer to receive the default color name
600 * dwColorNameLen Length, in characters, of color name buffer
601 * pszSizeName Buffer to receive the default size name
602 * dwSizeNameLen Length, in characters, of size name buffer
604 HRESULT WINAPI GetThemeDefaults(LPCWSTR pszThemeFileName, LPWSTR pszColorName,
605 DWORD dwColorNameLen, LPWSTR pszSizeName,
610 TRACE("(%s,%p,%ld,%p,%ld)\n", debugstr_w(pszThemeFileName),
611 pszColorName, dwColorNameLen,
612 pszSizeName, dwSizeNameLen);
614 hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, NULL, &pt);
615 if(FAILED(hr)) return hr;
617 lstrcpynW(pszColorName, pt->pszSelectedColor, dwColorNameLen);
618 lstrcpynW(pszSizeName, pt->pszSelectedSize, dwSizeNameLen);
620 MSSTYLES_CloseThemeFile(pt);
624 /**********************************************************************
625 * EnumThemes (UXTHEME.8)
627 * Enumerate available themes, calls specified EnumThemeProc for each
628 * theme found. Passes lpData through to callback function.
631 * pszThemePath Path containing themes
632 * callback Called for each theme found in path
633 * lpData Passed through to callback
635 HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback,
638 WCHAR szDir[MAX_PATH];
639 WCHAR szPath[MAX_PATH];
640 static const WCHAR szStar[] = {'*','.','*','\0'};
641 static const WCHAR szFormat[] = {'%','s','%','s','\\','%','s','.','m','s','s','t','y','l','e','s','\0'};
642 static const WCHAR szDisplayName[] = {'d','i','s','p','l','a','y','n','a','m','e','\0'};
643 static const WCHAR szTooltip[] = {'t','o','o','l','t','i','p','\0'};
647 WIN32_FIND_DATAW wfd;
650 TRACE("(%s,%p,%p)\n", debugstr_w(pszThemePath), callback, lpData);
652 if(!pszThemePath || !callback)
655 lstrcpyW(szDir, pszThemePath);
656 PathAddBackslashW(szDir);
658 lstrcpyW(szPath, szDir);
659 lstrcatW(szPath, szStar);
660 TRACE("searching %s\n", debugstr_w(szPath));
662 hFind = FindFirstFileW(szPath, &wfd);
663 if(hFind != INVALID_HANDLE_VALUE) {
665 if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY
666 && !(wfd.cFileName[0] == '.' && ((wfd.cFileName[1] == '.' && wfd.cFileName[2] == 0) || wfd.cFileName[1] == 0))) {
667 wsprintfW(szPath, szFormat, szDir, wfd.cFileName, wfd.cFileName);
669 hr = GetThemeDocumentationProperty(szPath, szDisplayName, szName, sizeof(szName)/sizeof(szName[0]));
671 hr = GetThemeDocumentationProperty(szPath, szTooltip, szTip, sizeof(szTip)/sizeof(szTip[0]));
673 TRACE("callback(%s,%s,%s,%p)\n", debugstr_w(szPath), debugstr_w(szName), debugstr_w(szTip), lpData);
674 if(!callback(NULL, szPath, szName, szTip, NULL, lpData)) {
675 TRACE("callback ended enum\n");
680 } while(FindNextFileW(hFind, &wfd));
687 /**********************************************************************
688 * EnumThemeColors (UXTHEME.9)
690 * Enumerate theme colors available with a particular size
693 * pszThemeFileName Path to a msstyles theme file
694 * pszSizeName Theme size to enumerate available colors
695 * If NULL the default theme size is used
696 * dwColorNum Color index to retrieve, increment from 0
697 * pszColorName Output color name
701 * E_PROP_ID_UNSUPPORTED when dwColorName does not refer to a color
702 * or when pszSizeName does not refer to a valid size
705 * XP fails with E_POINTER when pszColorName points to a buffer smaller then 605
708 * Not very efficient that I'm opening & validating the theme every call, but
709 * this is undocumented and almost never called..
710 * (and this is how windows works too)
712 HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName,
713 DWORD dwColorNum, LPWSTR pszColorName)
718 TRACE("(%s,%s,%ld)\n", debugstr_w(pszThemeFileName),
719 debugstr_w(pszSizeName), dwColorNum);
721 hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, pszSizeName, &pt);
722 if(FAILED(hr)) return hr;
724 tmp = pt->pszAvailColors;
725 while(dwColorNum && *tmp) {
727 tmp += lstrlenW(tmp)+1;
729 if(!dwColorNum && *tmp) {
730 TRACE("%s\n", debugstr_w(tmp));
731 lstrcpyW(pszColorName, tmp);
734 hr = E_PROP_ID_UNSUPPORTED;
736 MSSTYLES_CloseThemeFile(pt);
740 /**********************************************************************
741 * EnumThemeSizes (UXTHEME.10)
743 * Enumerate theme colors available with a particular size
746 * pszThemeFileName Path to a msstyles theme file
747 * pszColorName Theme color to enumerate available sizes
748 * If NULL the default theme color is used
749 * dwSizeNum Size index to retrieve, increment from 0
750 * pszSizeName Output size name
754 * E_PROP_ID_UNSUPPORTED when dwSizeName does not refer to a size
755 * or when pszColorName does not refer to a valid color
758 * XP fails with E_POINTER when pszSizeName points to a buffer smaller then 605
761 * Not very efficient that I'm opening & validating the theme every call, but
762 * this is undocumented and almost never called..
763 * (and this is how windows works too)
765 HRESULT WINAPI EnumThemeSizes(LPWSTR pszThemeFileName, LPWSTR pszColorName,
766 DWORD dwSizeNum, LPWSTR pszSizeName)
771 TRACE("(%s,%s,%ld)\n", debugstr_w(pszThemeFileName),
772 debugstr_w(pszColorName), dwSizeNum);
774 hr = MSSTYLES_OpenThemeFile(pszThemeFileName, pszColorName, NULL, &pt);
775 if(FAILED(hr)) return hr;
777 tmp = pt->pszAvailSizes;
778 while(dwSizeNum && *tmp) {
780 tmp += lstrlenW(tmp)+1;
782 if(!dwSizeNum && *tmp) {
783 TRACE("%s\n", debugstr_w(tmp));
784 lstrcpyW(pszSizeName, tmp);
787 hr = E_PROP_ID_UNSUPPORTED;
789 MSSTYLES_CloseThemeFile(pt);
793 /**********************************************************************
794 * ParseThemeIniFile (UXTHEME.11)
796 * Enumerate data in a theme INI file.
799 * pszIniFileName Path to a theme ini file
800 * pszUnknown Cannot be NULL, L"" is valid
801 * callback Called for each found entry
802 * lpData Passed through to callback
806 * 0x800706488 (Unknown property) when enumeration is canceled from callback
809 * When pszUnknown is NULL the callback is never called, the value does not seem to surve
812 HRESULT WINAPI ParseThemeIniFile(LPCWSTR pszIniFileName, LPWSTR pszUnknown,
813 ParseThemeIniFileProc callback, LPVOID lpData)
815 FIXME("%s %s: stub\n", debugstr_w(pszIniFileName), debugstr_w(pszUnknown));
816 return ERROR_CALL_NOT_IMPLEMENTED;
819 /**********************************************************************
820 * CheckThemeSignature (UXTHEME.29)
822 * Validates the signature of a theme file
825 * pszIniFileName Path to a theme file
827 HRESULT WINAPI CheckThemeSignature(LPCWSTR pszThemeFileName)
831 TRACE("(%s)\n", debugstr_w(pszThemeFileName));
832 hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, NULL, &pt);
835 MSSTYLES_CloseThemeFile(pt);