23#include <wine/unicode.h>
31#define MSSTYLES_VERSION 0x0003
34 't',
'h',
'e',
'm',
'e',
's',
'_',
'i',
'n',
'i',
'\0'
59 static const WCHAR szPackThemVersionResource[] = {
60 'P',
'A',
'C',
'K',
'T',
'H',
'E',
'M',
'_',
'V',
'E',
'R',
'S',
'I',
'O',
'N',
'\0'
62 static const WCHAR szColorNamesResource[] = {
63 'C',
'O',
'L',
'O',
'R',
'N',
'A',
'M',
'E',
'S',
'\0'
65 static const WCHAR szSizeNamesResource[] = {
66 'S',
'I',
'Z',
'E',
'N',
'A',
'M',
'E',
'S',
'\0'
87 TRACE(
"No version resource found\n");
93 TRACE(
"Version resource found, but wrong size: %d\n", versize);
100 TRACE(
"Version of theme file is unsupported: 0x%04x\n",
version);
106 TRACE(
"Color names resource not found\n");
113 TRACE(
"Size names resource not found\n");
124 pszSelectedColor = tmp;
131 pszSelectedColor = pszColors;
138 pszSelectedSize = tmp;
145 pszSelectedSize = pszSizes;
147 if(!pszSelectedColor || !pszSelectedSize) {
148 TRACE(
"Requested color/size (%s/%s) not found in theme\n",
155 (*tf)->hTheme = hTheme;
159 (*tf)->pszAvailColors = pszColors;
160 (*tf)->pszAvailSizes = pszSizes;
161 (*tf)->pszSelectedColor = pszSelectedColor;
162 (*tf)->pszSelectedSize = pszSelectedSize;
163 (*tf)->dwRefCount = 1;
165 TRACE(
"Theme %p refcount: %d\n", *
tf, (*tf)->dwRefCount);
184 TRACE(
"Theme %p refcount: %d\n",
tf,
tf->dwRefCount);
186 if(!
tf->dwRefCount) {
210 tf->images =
img->next;
227 TRACE(
"Theme %p refcount: %d\n",
tf,
tf->dwRefCount);
248 static const WCHAR szFileResNamesResource[] = {
249 'F',
'I',
'L',
'E',
'R',
'E',
'S',
'N',
'A',
'M',
'E',
'S',
'\0'
251 DWORD dwColorCount = 0;
252 DWORD dwSizeCount = 0;
253 DWORD dwColorNum = 0;
256 DWORD dwResourceIndex;
263 tmp =
tf->pszAvailColors;
266 dwColorNum = dwColorCount;
270 tmp =
tf->pszAvailSizes;
273 dwSizeNum = dwSizeCount;
279 TRACE(
"FILERESNAMES map not found\n");
283 dwResourceIndex = (dwSizeCount * dwColorNum) + dwSizeNum;
284 for(
i=0;
i < dwResourceIndex;
i++) {
316 WCHAR part[60] = {
'\0'};
320 lstrcpynW(sec, lpSection,
min(dwLen+1,
sizeof(sec)/
sizeof(sec[0])));
345 lstrcpynW(part, comp,
sizeof(part)/
sizeof(part[0]));
355 lstrcpynW(part, comp,
sizeof(part)/
sizeof(part[0]));
428 cur->hTheme =
tf->hTheme;
431 cur->next =
tf->classes;
456 if(
cur->iPartId == iPartId &&
cur->iStateId == iStateId) {
485 cur->iPartId = iPartId;
486 cur->iStateId = iStateId;
488 cur->next =
tc->partstate;
510 if(
cur->iPropertyId == iPropertyId) {
511 if(
cur->iPrimitiveType == iPropertyPrimitive) {
515 if(!iPropertyPrimitive)
583 cur->iPrimitiveType = iPropertyPrimitive;
584 cur->iPropertyId = iPropertyId;
585 cur->lpValue = lpValue;
586 cur->dwValueLen = dwValueLen;
589 cur->origin = PO_STATE;
591 cur->origin = PO_PART;
593 cur->origin = PO_GLOBAL;
595 cur->origin = PO_CLASS;
624 cur->iPrimitiveType = iPropertyPrimitive;
625 cur->iPropertyId = iPropertyId;
626 cur->lpValue = lpValue;
627 cur->dwValueLen = dwValueLen;
629 cur->origin = PO_GLOBAL;
631 cur->next =
tf->metrics;
646 static const WCHAR szSysMetrics[] = {
'S',
'y',
's',
'M',
'e',
't',
'r',
'i',
'c',
's',
'\0'};
647 static const WCHAR szGlobals[] = {
'g',
'l',
'o',
'b',
'a',
'l',
's',
'\0'};
657 int iPropertyPrimitive;
675 lstrcpynW(szPropertyName,
lpName,
min(dwLen+1,
sizeof(szPropertyName)/
sizeof(szPropertyName[0])));
701 lstrcpynW(szPropertyName,
lpName,
min(dwLen+1,
sizeof(szPropertyName)/
sizeof(szPropertyName[0])));
742 ERR(
"Failed to parse theme ini\n");
771 start = pszClassList;
794 cls->
tf->dwRefCount++;
795 TRACE(
"Theme %p refcount: %d\n",
tf,
tf->dwRefCount);
803 cls->
tf->dwRefCount++;
804 TRACE(
"Theme %p refcount: %d\n",
tf,
tf->dwRefCount);
841 TRACE(
"(%p, %d, %d, %d)\n",
tc, iPartId, iStateId, iPropertyId);
852 else if(iPartId != 0)
874 if(
dib.dsBm.bmBitsPixel != 32)
879 n =
dib.dsBmih.biHeight *
dib.dsBmih.biWidth;
884 p[0] = (
p[0] *
a) >> 8;
885 p[1] = (
p[1] *
a) >> 8;
886 p[2] = (
p[2] *
a) >> 8;
901 lstrcpynW(szFile, lpFilename,
sizeof(szFile)/
sizeof(szFile[0]));
904 if(*tmp ==
'\\') *tmp =
'_';
905 if(*tmp ==
'/') *tmp =
'_';
906 if(*tmp ==
'.') *tmp =
'_';
910 img =
tc->tf->images;
916 *hasAlpha =
img->hasAlpha;
923#ifdef ENABLE_PNG_SUPPORT
933#ifdef ENABLE_PNG_SUPPORT
936 img->hasAlpha = *hasAlpha;
939 img->next =
tc->tf->images;
940 tc->tf->images =
img;
951 while(
cur < lpStringEnd && ((*
cur <
'0' || *
cur >
'9') && *
cur !=
'-'))
cur++;
952 if(
cur >= lpStringEnd) {
959 while(
cur < lpStringEnd && (*
cur >=
'0' && *
cur <=
'9')) {
965 if(lpValEnd) *lpValEnd =
cur;
975 if(
cur >= lpStringEnd) {
979 while(
cur < lpStringEnd && *
cur !=
'\n'&& *
cur !=
',')
cur++;
985 if(lpValEnd) *lpValEnd =
cur;
997 if(*
tp->lpValue ==
't' || *
tp->lpValue ==
'T')
1013 lpCur =
tp->lpValue;
1014 lpEnd =
tp->lpValue +
tp->dwValueLen;
1017 TRACE(
"Could not parse color property\n");
1021 TRACE(
"Could not parse color property\n");
1025 TRACE(
"Could not parse color property\n");
1040 static const WCHAR szBold[] = {
'b',
'o',
'l',
'd',
'\0'};
1041 static const WCHAR szItalic[] = {
'i',
't',
'a',
'l',
'i',
'c',
'\0'};
1042 static const WCHAR szUnderline[] = {
'u',
'n',
'd',
'e',
'r',
'l',
'i',
'n',
'e',
'\0'};
1043 static const WCHAR szStrikeOut[] = {
's',
't',
'r',
'i',
'k',
'e',
'o',
'u',
't',
'\0'};
1048 TRACE(
"Property is there, but failed to get face name\n");
1053 TRACE(
"Property is there, but failed to get point size\n");
1097 TRACE(
"Could not parse int property\n");
1114 for(
i=0;
i < MAX_INTLIST_COUNT;
i++) {
1118 pIntList->iValueCount =
i;
1134 TRACE(
"Could not parse position property\n");
1138 TRACE(
"Could not parse position property\n");
1171 TRACE(
"Could not parse rect property\n");
1191 TRACE(
"Could not parse margins property\n");
static const WCHAR szClassName[]
#define HeapFree(x, y, z)
static const WCHAR version[]
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
_In_ uint64_t _In_ uint64_t _In_ uint64_t _In_opt_ traverse_ptr * tp
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
GLboolean GLboolean GLboolean GLboolean a
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
PTHEME_PARTSTATE MSSTYLES_FindPartState(PTHEME_CLASS tc, int iPartId, int iStateId, PTHEME_CLASS *tcNext)
static BOOL prepare_alpha(HBITMAP bmp, BOOL *hasAlpha)
static const WCHAR szThemesIniResource[]
static PTHEME_CLASS MSSTYLES_AddClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassName)
PTHEME_PROPERTY MSSTYLES_FindProperty(PTHEME_CLASS tc, int iPartId, int iStateId, int iPropertyPrimitive, int iPropertyId)
HRESULT MSSTYLES_GetPropertyFont(PTHEME_PROPERTY tp, HDC hdc, LOGFONTW *pFont)
PUXINI_FILE MSSTYLES_GetThemeIni(PTHEME_FILE tf)
HRESULT MSSTYLES_ReferenceTheme(PTHEME_FILE tf)
HRESULT MSSTYLES_GetPropertyBool(PTHEME_PROPERTY tp, BOOL *pfVal)
HRESULT MSSTYLES_GetPropertyString(PTHEME_PROPERTY tp, LPWSTR pszBuff, int cchMaxBuffChars)
HRESULT MSSTYLES_GetPropertyMargins(PTHEME_PROPERTY tp, RECT *prc, MARGINS *pMargins)
static PUXINI_FILE MSSTYLES_GetActiveThemeIni(PTHEME_FILE tf)
HRESULT MSSTYLES_GetPropertyColor(PTHEME_PROPERTY tp, COLORREF *pColor)
PTHEME_CLASS MSSTYLES_OpenThemeClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassList)
static PTHEME_PROPERTY MSSTYLES_LFindProperty(PTHEME_PROPERTY tp, int iPropertyPrimitive, int iPropertyId)
void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
static PTHEME_PARTSTATE MSSTYLES_AddPartState(PTHEME_CLASS tc, int iPartId, int iStateId)
HRESULT MSSTYLES_GetPropertyIntList(PTHEME_PROPERTY tp, INTLIST *pIntList)
HRESULT MSSTYLES_GetPropertyRect(PTHEME_PROPERTY tp, RECT *pRect)
HBITMAP MSSTYLES_LoadBitmap(PTHEME_CLASS tc, LPCWSTR lpFilename, BOOL *hasAlpha)
static BOOL MSSTYLES_ParseIniSectionName(LPCWSTR lpSection, DWORD dwLen, LPWSTR szAppName, LPWSTR szClassName, int *iPartId, int *iStateId)
static PTHEME_PROPERTY MSSTYLES_AddMetric(PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId, LPCWSTR lpValue, DWORD dwValueLen)
HRESULT MSSTYLES_GetPropertyPosition(PTHEME_PROPERTY tp, POINT *pPoint)
HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWSTR pszSizeName, PTHEME_FILE *tf)
HRESULT MSSTYLES_CloseThemeClass(PTHEME_CLASS tc)
static PTHEME_PROPERTY MSSTYLES_PSFindProperty(PTHEME_PARTSTATE ps, int iPropertyPrimitive, int iPropertyId)
static BOOL MSSTYLES_GetNextInteger(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, int *value)
static PTHEME_CLASS MSSTYLES_FindClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWSTR pszClassName)
static BOOL MSSTYLES_GetNextToken(LPCWSTR lpStringStart, LPCWSTR lpStringEnd, LPCWSTR *lpValEnd, LPWSTR lpBuff, DWORD buffSize)
PTHEME_PROPERTY MSSTYLES_FindMetric(PTHEME_FILE tf, int iPropertyPrimitive, int iPropertyId)
static PTHEME_PROPERTY MSSTYLES_AddProperty(PTHEME_PARTSTATE ps, int iPropertyPrimitive, int iPropertyId, LPCWSTR lpValue, DWORD dwValueLen, BOOL isGlobal)
void MSSTYLES_ParseThemeIni(PTHEME_FILE tf)
HRESULT MSSTYLES_GetPropertyInt(PTHEME_PROPERTY tp, int *piVal)
static HRESULT MSSTYLES_GetFont(LPCWSTR lpCur, LPCWSTR lpEnd, LPCWSTR *lpValEnd, LOGFONTW *pFont)
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
#define LOCALE_SYSTEM_DEFAULT
BOOL MSSTYLES_TryLoadPng(_In_ HINSTANCE hTheme, _In_ LPCWSTR szFile, _In_ LPCWSTR type, _Out_ HBITMAP *phBitmap)
BOOL prepare_png_alpha(_In_ HBITMAP png, _Out_ BOOL *hasAlpha)
static unsigned __int64 next
WCHAR lfFaceName[LF_FACESIZE]
struct _THEME_CLASS * overrides
WCHAR szAppName[MAX_THEME_APP_NAME]
PTHEME_PARTSTATE partstate
struct _THEME_CLASS * next
WCHAR szClassName[MAX_THEME_CLASS_NAME]
struct _THEME_PARTSTATE * next
PTHEME_PROPERTY properties
struct _THEME_PROPERTY * next
BOOL MSSTYLES_LookupProperty(LPCWSTR pszPropertyName, int *dwPrimitive, int *dwId)
BOOL MSSTYLES_LookupPartState(LPCWSTR pszClass, LPCWSTR pszPart, LPCWSTR pszState, int *iPartId, int *iStateId)
LPCWSTR UXINI_GetNextSection(PUXINI_FILE uf, DWORD *dwLen)
PUXINI_FILE UXINI_LoadINI(HMODULE hTheme, LPCWSTR lpName)
LPCWSTR UXINI_GetNextValue(PUXINI_FILE uf, DWORD *dwNameLen, LPCWSTR *lpValue, DWORD *dwValueLen)
void UXINI_CloseINI(PUXINI_FILE uf)
#define MAX_THEME_CLASS_NAME
#define MAX_THEME_VALUE_NAME
#define MAX_THEME_APP_NAME
#define E_PROP_ID_UNSUPPORTED
DWORD WINAPI GetLastError(void)
#define LOAD_LIBRARY_AS_DATAFILE
#define HRESULT_FROM_WIN32(x)
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define LR_CREATEDIBSECTION
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
HDC WINAPI GetDC(_In_opt_ HWND)
#define MAKEINTRESOURCEW(i)