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 static BOOL CALLBACK UXTHEME_broadcast_msg_enumchild (HWND hWnd, LPARAM msg)
75 PostMessageW(hWnd, msg, 0, 0);
79 /* Broadcast a message to *all* windows, including children */
80 static BOOL CALLBACK UXTHEME_broadcast_msg (HWND hWnd, LPARAM msg)
84 EnumWindows (UXTHEME_broadcast_msg, msg);
88 PostMessageW(hWnd, msg, 0, 0);
89 EnumChildWindows (hWnd, UXTHEME_broadcast_msg_enumchild, msg);
94 /***********************************************************************
97 * Set the current active theme from the registry
99 static void UXTHEME_LoadTheme(void)
107 /* Get current theme configuration */
108 if(!RegOpenKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) {
109 TRACE("Loading theme config\n");
110 buffsize = sizeof(tmp)/sizeof(tmp[0]);
111 if(!RegQueryValueExW(hKey, szThemeActive, NULL, NULL, (LPBYTE)tmp, &buffsize)) {
112 bThemeActive = (tmp[0] != '0');
115 bThemeActive = FALSE;
116 TRACE("Failed to get ThemeActive: %ld\n", GetLastError());
118 buffsize = sizeof(szCurrentColor)/sizeof(szCurrentColor[0]);
119 if(RegQueryValueExW(hKey, szColorName, NULL, NULL, (LPBYTE)szCurrentColor, &buffsize))
120 szCurrentColor[0] = '\0';
121 buffsize = sizeof(szCurrentSize)/sizeof(szCurrentSize[0]);
122 if(RegQueryValueExW(hKey, szSizeName, NULL, NULL, (LPBYTE)szCurrentSize, &buffsize))
123 szCurrentSize[0] = '\0';
124 if(SHRegGetPathW(hKey, NULL, szDllName, szCurrentTheme, 0))
125 szCurrentTheme[0] = '\0';
129 TRACE("Failed to open theme registry key\n");
132 /* Make sure the theme requested is actually valid */
133 hr = MSSTYLES_OpenThemeFile(szCurrentTheme,
134 szCurrentColor[0]?szCurrentColor:NULL,
135 szCurrentSize[0]?szCurrentSize:NULL,
138 bThemeActive = FALSE;
139 szCurrentTheme[0] = '\0';
140 szCurrentColor[0] = '\0';
141 szCurrentSize[0] = '\0';
144 /* Make sure the global color & size match the theme */
145 lstrcpynW(szCurrentColor, pt->pszSelectedColor, sizeof(szCurrentColor)/sizeof(szCurrentColor[0]));
146 lstrcpynW(szCurrentSize, pt->pszSelectedSize, sizeof(szCurrentSize)/sizeof(szCurrentSize[0]));
148 MSSTYLES_SetActiveTheme(pt);
149 TRACE("Theme active: %s %s %s\n", debugstr_w(szCurrentTheme),
150 debugstr_w(szCurrentColor), debugstr_w(szCurrentSize));
151 MSSTYLES_CloseThemeFile(pt);
155 MSSTYLES_SetActiveTheme(NULL);
156 TRACE("Themeing not active\n");
160 /***********************************************************************
161 * UXTHEME_SetActiveTheme
163 * Change the current active theme
165 HRESULT UXTHEME_SetActiveTheme(PTHEME_FILE tf)
171 hr = MSSTYLES_SetActiveTheme(tf);
176 lstrcpynW(szCurrentTheme, tf->szThemeFile, sizeof(szCurrentTheme)/sizeof(szCurrentTheme[0]));
177 lstrcpynW(szCurrentColor, tf->pszSelectedColor, sizeof(szCurrentColor)/sizeof(szCurrentColor[0]));
178 lstrcpynW(szCurrentSize, tf->pszSelectedSize, sizeof(szCurrentSize)/sizeof(szCurrentSize[0]));
181 bThemeActive = FALSE;
182 szCurrentTheme[0] = '\0';
183 szCurrentColor[0] = '\0';
184 szCurrentSize[0] = '\0';
187 TRACE("Writing theme config to registry\n");
188 if(!RegCreateKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) {
189 tmp[0] = bThemeActive?'1':'0';
191 RegSetValueExW(hKey, szThemeActive, 0, REG_SZ, (const BYTE*)tmp, sizeof(WCHAR)*2);
193 RegSetValueExW(hKey, szColorName, 0, REG_SZ, (const BYTE*)szCurrentColor,
194 (lstrlenW(szCurrentColor)+1)*sizeof(WCHAR));
195 RegSetValueExW(hKey, szSizeName, 0, REG_SZ, (const BYTE*)szCurrentSize,
196 (lstrlenW(szCurrentSize)+1)*sizeof(WCHAR));
197 RegSetValueExW(hKey, szDllName, 0, REG_SZ, (const BYTE*)szCurrentTheme,
198 (lstrlenW(szCurrentTheme)+1)*sizeof(WCHAR));
201 RegDeleteValueW(hKey, szColorName);
202 RegDeleteValueW(hKey, szSizeName);
203 RegDeleteValueW(hKey, szDllName);
209 TRACE("Failed to open theme registry key\n");
213 /***********************************************************************
216 void UXTHEME_InitSystem(HINSTANCE hInst)
218 static const WCHAR szWindowTheme[] = {
219 'u','x','_','t','h','e','m','e','\0'
221 static const WCHAR szSubAppName[] = {
222 'u','x','_','s','u','b','a','p','p','\0'
224 static const WCHAR szSubIdList[] = {
225 'u','x','_','s','u','b','i','d','l','s','t','\0'
230 atWindowTheme = GlobalAddAtomW(szWindowTheme);
231 atSubAppName = GlobalAddAtomW(szSubAppName);
232 atSubIdList = GlobalAddAtomW(szSubIdList);
237 /***********************************************************************
238 * IsAppThemed (UXTHEME.@)
240 BOOL WINAPI IsAppThemed(void)
242 return IsThemeActive();
245 /***********************************************************************
246 * IsThemeActive (UXTHEME.@)
248 BOOL WINAPI IsThemeActive(void)
254 /***********************************************************************
255 * EnableTheming (UXTHEME.@)
258 * This is a global and persistent change
260 HRESULT WINAPI EnableTheming(BOOL fEnable)
263 WCHAR szEnabled[] = {'0','\0'};
265 TRACE("(%d)\n", fEnable);
267 if(fEnable != bThemeActive) {
268 bThemeActive = fEnable;
269 if(bThemeActive) szEnabled[0] = '1';
270 if(!RegOpenKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) {
271 RegSetValueExW(hKey, szThemeActive, 0, REG_SZ, (LPBYTE)szEnabled, sizeof(WCHAR));
274 UXTHEME_broadcast_msg (NULL, WM_THEMECHANGED);
279 /***********************************************************************
280 * UXTHEME_SetWindowProperty
282 * I'm using atoms as there may be large numbers of duplicated strings
283 * and they do the work of keeping memory down as a cause of that quite nicely
285 HRESULT UXTHEME_SetWindowProperty(HWND hwnd, ATOM aProp, LPCWSTR pszValue)
287 ATOM oldValue = (ATOM)(size_t)RemovePropW(hwnd, MAKEINTATOMW(aProp));
289 DeleteAtom(oldValue);
291 ATOM atValue = AddAtomW(pszValue);
293 || !SetPropW(hwnd, MAKEINTATOMW(aProp), (LPWSTR)MAKEINTATOMW(atValue))) {
294 HRESULT hr = HRESULT_FROM_WIN32(GetLastError());
295 if(atValue) DeleteAtom(atValue);
302 LPWSTR UXTHEME_GetWindowProperty(HWND hwnd, ATOM aProp, LPWSTR pszBuffer, int dwLen)
304 ATOM atValue = (ATOM)(size_t)GetPropW(hwnd, MAKEINTATOMW(aProp));
306 if(GetAtomNameW(atValue, pszBuffer, dwLen))
308 TRACE("property defined, but unable to get value\n");
313 /***********************************************************************
314 * OpenThemeData (UXTHEME.@)
316 HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR pszClassList)
318 WCHAR szAppBuff[256];
319 WCHAR szClassBuff[256];
321 LPCWSTR pszUseClassList;
323 TRACE("(%p,%s)\n", hwnd, debugstr_w(pszClassList));
327 pszAppName = UXTHEME_GetWindowProperty(hwnd, atSubAppName, szAppBuff, sizeof(szAppBuff)/sizeof(szAppBuff[0]));
328 /* If SetWindowTheme was used on the window, that overrides the class list passed to this function */
329 pszUseClassList = UXTHEME_GetWindowProperty(hwnd, atSubIdList, szClassBuff, sizeof(szClassBuff)/sizeof(szClassBuff[0]));
331 pszUseClassList = pszClassList;
333 if (!pszClassList) return NULL;
335 hTheme = MSSTYLES_OpenThemeClass(pszAppName, pszUseClassList);
337 SetPropW(hwnd, MAKEINTATOMW(atWindowTheme), hTheme);
341 /***********************************************************************
342 * GetWindowTheme (UXTHEME.@)
344 * Retrieve the last theme opened for a window
346 HTHEME WINAPI GetWindowTheme(HWND hwnd)
348 TRACE("(%p)\n", hwnd);
349 return GetPropW(hwnd, MAKEINTATOMW(atWindowTheme));
352 /***********************************************************************
353 * SetWindowTheme (UXTHEME.@)
355 * Persistent through the life of the window, even after themes change
357 HRESULT WINAPI SetWindowTheme(HWND hwnd, LPCWSTR pszSubAppName,
358 LPCWSTR pszSubIdList)
361 TRACE("(%p,%s,%s)\n", hwnd, debugstr_w(pszSubAppName),
362 debugstr_w(pszSubIdList));
363 hr = UXTHEME_SetWindowProperty(hwnd, atSubAppName, pszSubAppName);
365 hr = UXTHEME_SetWindowProperty(hwnd, atSubIdList, pszSubIdList);
367 UXTHEME_broadcast_msg (hwnd, WM_THEMECHANGED);
371 /***********************************************************************
372 * GetCurrentThemeName (UXTHEME.@)
374 HRESULT WINAPI GetCurrentThemeName(LPWSTR pszThemeFileName, int dwMaxNameChars,
375 LPWSTR pszColorBuff, int cchMaxColorChars,
376 LPWSTR pszSizeBuff, int cchMaxSizeChars)
379 return E_PROP_ID_UNSUPPORTED;
380 if(pszThemeFileName) lstrcpynW(pszThemeFileName, szCurrentTheme, dwMaxNameChars);
381 if(pszColorBuff) lstrcpynW(pszColorBuff, szCurrentColor, cchMaxColorChars);
382 if(pszSizeBuff) lstrcpynW(pszSizeBuff, szCurrentSize, cchMaxSizeChars);
386 /***********************************************************************
387 * GetThemeAppProperties (UXTHEME.@)
389 DWORD WINAPI GetThemeAppProperties(void)
391 return dwThemeAppProperties;
394 /***********************************************************************
395 * SetThemeAppProperties (UXTHEME.@)
397 void WINAPI SetThemeAppProperties(DWORD dwFlags)
399 TRACE("(0x%08lx)\n", dwFlags);
400 dwThemeAppProperties = dwFlags;
403 /***********************************************************************
404 * CloseThemeData (UXTHEME.@)
406 HRESULT WINAPI CloseThemeData(HTHEME hTheme)
408 TRACE("(%p)\n", hTheme);
411 return MSSTYLES_CloseThemeClass(hTheme);
414 /***********************************************************************
415 * HitTestThemeBackground (UXTHEME.@)
417 HRESULT WINAPI HitTestThemeBackground(HTHEME hTheme, HDC hdc, int iPartId,
418 int iStateId, DWORD dwOptions,
419 const RECT *pRect, HRGN hrgn,
420 POINT ptTest, WORD *pwHitTestCode)
422 FIXME("%d %d 0x%08lx: stub\n", iPartId, iStateId, dwOptions);
425 return ERROR_CALL_NOT_IMPLEMENTED;
428 /***********************************************************************
429 * IsThemePartDefined (UXTHEME.@)
431 BOOL WINAPI IsThemePartDefined(HTHEME hTheme, int iPartId, int iStateId)
433 TRACE("(%p,%d,%d)\n", hTheme, iPartId, iStateId);
435 SetLastError(E_HANDLE);
438 if(MSSTYLES_FindPartState(hTheme, iPartId, iStateId, NULL))
443 /***********************************************************************
444 * GetThemeDocumentationProperty (UXTHEME.@)
446 * Try and retrieve the documentation property from string resources
447 * if that fails, get it from the [documentation] section of themes.ini
449 HRESULT WINAPI GetThemeDocumentationProperty(LPCWSTR pszThemeName,
450 LPCWSTR pszPropertyName,
454 const WORD wDocToRes[] = {
455 TMT_DISPLAYNAME,5000,
469 TRACE("(%s,%s,%p,%d)\n", debugstr_w(pszThemeName), debugstr_w(pszPropertyName),
470 pszValueBuff, cchMaxValChars);
472 hr = MSSTYLES_OpenThemeFile(pszThemeName, NULL, NULL, &pt);
473 if(FAILED(hr)) return hr;
475 /* Try to load from string resources */
476 hr = E_PROP_ID_UNSUPPORTED;
477 if(MSSTYLES_LookupProperty(pszPropertyName, NULL, &iDocId)) {
478 for(i=0; i<sizeof(wDocToRes)/sizeof(wDocToRes[0]); i+=2) {
479 if(wDocToRes[i] == iDocId) {
480 if(LoadStringW(pt->hTheme, wDocToRes[i+1], pszValueBuff, cchMaxValChars)) {
487 /* If loading from string resource failed, try getting it from the theme.ini */
489 PUXINI_FILE uf = MSSTYLES_GetThemeIni(pt);
490 if(UXINI_FindSection(uf, szIniDocumentation)) {
493 if(UXINI_FindValue(uf, pszPropertyName, &lpValue, &dwLen)) {
494 lstrcpynW(pszValueBuff, lpValue, min(dwLen+1,cchMaxValChars));
501 MSSTYLES_CloseThemeFile(pt);
505 /**********************************************************************
506 * Undocumented functions
509 /**********************************************************************
510 * QueryThemeServices (UXTHEME.1)
513 * some kind of status flag
515 DWORD WINAPI QueryThemeServices()
518 return 3; /* This is what is returned under XP in most cases */
522 /**********************************************************************
523 * OpenThemeFile (UXTHEME.2)
525 * Opens a theme file, which can be used to change the current theme, etc
528 * pszThemeFileName Path to a msstyles theme file
529 * pszColorName Color defined in the theme, eg. NormalColor
530 * pszSizeName Size defined in the theme, eg. NormalSize
531 * hThemeFile Handle to theme file
533 HRESULT WINAPI OpenThemeFile(LPCWSTR pszThemeFileName, LPCWSTR pszColorName,
534 LPCWSTR pszSizeName, HTHEMEFILE *hThemeFile,
537 TRACE("(%s,%s,%s,%p,%ld)\n", debugstr_w(pszThemeFileName),
538 debugstr_w(pszColorName), debugstr_w(pszSizeName),
539 hThemeFile, unknown);
540 return MSSTYLES_OpenThemeFile(pszThemeFileName, pszColorName, pszSizeName, (PTHEME_FILE*)hThemeFile);
543 /**********************************************************************
544 * CloseThemeFile (UXTHEME.3)
546 * Releases theme file handle returned by OpenThemeFile
549 * hThemeFile Handle to theme file
551 HRESULT WINAPI CloseThemeFile(HTHEMEFILE hThemeFile)
553 TRACE("(%p)\n", hThemeFile);
554 MSSTYLES_CloseThemeFile(hThemeFile);
558 /**********************************************************************
559 * ApplyTheme (UXTHEME.4)
561 * Set a theme file to be the currently active theme
564 * hThemeFile Handle to theme file
566 * hWnd Window requesting the theme change
569 * I'm not sure what the second parameter is (the datatype is likely wrong), other then this:
572 * the theme is applied with the screen redrawing really badly (flickers)
573 * char b[] = "\0"; where \0 can be one or more of any character, makes no difference
574 * the theme is applied smoothly (screen does not flicker)
575 * char *b = "\0" or NULL; where \0 can be zero or more of any character, makes no difference
576 * the function fails returning invalid parameter...very strange
578 HRESULT WINAPI ApplyTheme(HTHEMEFILE hThemeFile, char *unknown, HWND hWnd)
581 TRACE("(%p,%s,%p)\n", hThemeFile, unknown, hWnd);
582 hr = UXTHEME_SetActiveTheme(hThemeFile);
583 UXTHEME_broadcast_msg (NULL, WM_THEMECHANGED);
587 /**********************************************************************
588 * GetThemeDefaults (UXTHEME.7)
590 * Get the default color & size for a theme
593 * pszThemeFileName Path to a msstyles theme file
594 * pszColorName Buffer to receive the default color name
595 * dwColorNameLen Length, in characters, of color name buffer
596 * pszSizeName Buffer to receive the default size name
597 * dwSizeNameLen Length, in characters, of size name buffer
599 HRESULT WINAPI GetThemeDefaults(LPCWSTR pszThemeFileName, LPWSTR pszColorName,
600 DWORD dwColorNameLen, LPWSTR pszSizeName,
605 TRACE("(%s,%p,%ld,%p,%ld)\n", debugstr_w(pszThemeFileName),
606 pszColorName, dwColorNameLen,
607 pszSizeName, dwSizeNameLen);
609 hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, NULL, &pt);
610 if(FAILED(hr)) return hr;
612 lstrcpynW(pszColorName, pt->pszSelectedColor, dwColorNameLen);
613 lstrcpynW(pszSizeName, pt->pszSelectedSize, dwSizeNameLen);
615 MSSTYLES_CloseThemeFile(pt);
619 /**********************************************************************
620 * EnumThemes (UXTHEME.8)
622 * Enumerate available themes, calls specified EnumThemeProc for each
623 * theme found. Passes lpData through to callback function.
626 * pszThemePath Path containing themes
627 * callback Called for each theme found in path
628 * lpData Passed through to callback
630 HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback,
633 WCHAR szDir[MAX_PATH];
634 WCHAR szPath[MAX_PATH];
635 static const WCHAR szStar[] = {'*','.','*','\0'};
636 static const WCHAR szFormat[] = {'%','s','%','s','\\','%','s','.','m','s','s','t','y','l','e','s','\0'};
637 static const WCHAR szDisplayName[] = {'d','i','s','p','l','a','y','n','a','m','e','\0'};
638 static const WCHAR szTooltip[] = {'t','o','o','l','t','i','p','\0'};
642 WIN32_FIND_DATAW wfd;
645 TRACE("(%s,%p,%p)\n", debugstr_w(pszThemePath), callback, lpData);
647 if(!pszThemePath || !callback)
650 lstrcpyW(szDir, pszThemePath);
651 PathAddBackslashW(szDir);
653 lstrcpyW(szPath, szDir);
654 lstrcatW(szPath, szStar);
655 TRACE("searching %s\n", debugstr_w(szPath));
657 hFind = FindFirstFileW(szPath, &wfd);
658 if(hFind != INVALID_HANDLE_VALUE) {
660 if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY
661 && !(wfd.cFileName[0] == '.' && ((wfd.cFileName[1] == '.' && wfd.cFileName[2] == 0) || wfd.cFileName[1] == 0))) {
662 wsprintfW(szPath, szFormat, szDir, wfd.cFileName, wfd.cFileName);
664 hr = GetThemeDocumentationProperty(szPath, szDisplayName, szName, sizeof(szName)/sizeof(szName[0]));
666 hr = GetThemeDocumentationProperty(szPath, szTooltip, szTip, sizeof(szTip)/sizeof(szTip[0]));
668 TRACE("callback(%s,%s,%s,%p)\n", debugstr_w(szPath), debugstr_w(szName), debugstr_w(szTip), lpData);
669 if(!callback(NULL, szPath, szName, szTip, NULL, lpData)) {
670 TRACE("callback ended enum\n");
675 } while(FindNextFileW(hFind, &wfd));
682 /**********************************************************************
683 * EnumThemeColors (UXTHEME.9)
685 * Enumerate theme colors available with a particular size
688 * pszThemeFileName Path to a msstyles theme file
689 * pszSizeName Theme size to enumerate available colors
690 * If NULL the default theme size is used
691 * dwColorNum Color index to retrieve, increment from 0
692 * pszColorName Output color name
696 * E_PROP_ID_UNSUPPORTED when dwColorName does not refer to a color
697 * or when pszSizeName does not refer to a valid size
700 * XP fails with E_POINTER when pszColorName points to a buffer smaller then 605
703 * Not very efficient that I'm opening & validating the theme every call, but
704 * this is undocumented and almost never called..
705 * (and this is how windows works too)
707 HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName,
708 DWORD dwColorNum, LPWSTR pszColorName)
713 TRACE("(%s,%s,%ld)\n", debugstr_w(pszThemeFileName),
714 debugstr_w(pszSizeName), dwColorNum);
716 hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, pszSizeName, &pt);
717 if(FAILED(hr)) return hr;
719 tmp = pt->pszAvailColors;
720 while(dwColorNum && *tmp) {
722 tmp += lstrlenW(tmp)+1;
724 if(!dwColorNum && *tmp) {
725 TRACE("%s\n", debugstr_w(tmp));
726 lstrcpyW(pszColorName, tmp);
729 hr = E_PROP_ID_UNSUPPORTED;
731 MSSTYLES_CloseThemeFile(pt);
735 /**********************************************************************
736 * EnumThemeSizes (UXTHEME.10)
738 * Enumerate theme colors available with a particular size
741 * pszThemeFileName Path to a msstyles theme file
742 * pszColorName Theme color to enumerate available sizes
743 * If NULL the default theme color is used
744 * dwSizeNum Size index to retrieve, increment from 0
745 * pszSizeName Output size name
749 * E_PROP_ID_UNSUPPORTED when dwSizeName does not refer to a size
750 * or when pszColorName does not refer to a valid color
753 * XP fails with E_POINTER when pszSizeName points to a buffer smaller then 605
756 * Not very efficient that I'm opening & validating the theme every call, but
757 * this is undocumented and almost never called..
758 * (and this is how windows works too)
760 HRESULT WINAPI EnumThemeSizes(LPWSTR pszThemeFileName, LPWSTR pszColorName,
761 DWORD dwSizeNum, LPWSTR pszSizeName)
766 TRACE("(%s,%s,%ld)\n", debugstr_w(pszThemeFileName),
767 debugstr_w(pszColorName), dwSizeNum);
769 hr = MSSTYLES_OpenThemeFile(pszThemeFileName, pszColorName, NULL, &pt);
770 if(FAILED(hr)) return hr;
772 tmp = pt->pszAvailSizes;
773 while(dwSizeNum && *tmp) {
775 tmp += lstrlenW(tmp)+1;
777 if(!dwSizeNum && *tmp) {
778 TRACE("%s\n", debugstr_w(tmp));
779 lstrcpyW(pszSizeName, tmp);
782 hr = E_PROP_ID_UNSUPPORTED;
784 MSSTYLES_CloseThemeFile(pt);
788 /**********************************************************************
789 * ParseThemeIniFile (UXTHEME.11)
791 * Enumerate data in a theme INI file.
794 * pszIniFileName Path to a theme ini file
795 * pszUnknown Cannot be NULL, L"" is valid
796 * callback Called for each found entry
797 * lpData Passed through to callback
801 * 0x800706488 (Unknown property) when enumeration is canceled from callback
804 * When pszUnknown is NULL the callback is never called, the value does not seem to surve
807 HRESULT WINAPI ParseThemeIniFile(LPCWSTR pszIniFileName, LPWSTR pszUnknown,
808 ParseThemeIniFileProc callback, LPVOID lpData)
810 FIXME("%s %s: stub\n", debugstr_w(pszIniFileName), debugstr_w(pszUnknown));
811 return ERROR_CALL_NOT_IMPLEMENTED;
814 /**********************************************************************
815 * CheckThemeSignature (UXTHEME.29)
817 * Validates the signature of a theme file
820 * pszIniFileName Path to a theme file
822 HRESULT WINAPI CheckThemeSignature(LPCWSTR pszThemeFileName)
826 TRACE("(%s)\n", debugstr_w(pszThemeFileName));
827 hr = MSSTYLES_OpenThemeFile(pszThemeFileName, NULL, NULL, &pt);
830 MSSTYLES_CloseThemeFile(pt);