Enforce schema restrictions for numeric and image thmutil attributes.
Sean Hall committed
Jun 3, 2021 at 16:24 UTC
089295bf2eb1274da2326e5864afc905070a2832
7 files changed
+696
-1633
src/burn/engine/package.cpp
+2
-2
@@ -141,11 +141,11 @@ extern "C" HRESULT PackagesParseFromXml(
141
ExitOnFailure(hr, "Failed to get @CacheId.");
142
143
// @Size
144
- hr = XmlGetAttributeLargeNumber(pixnNode, L"Size", &pPackage->qwSize);
144
+ hr = XmlGetAttributeUInt64(pixnNode, L"Size", &pPackage->qwSize);
145
ExitOnFailure(hr, "Failed to get @Size.");
146
147
// @InstallSize
148
- hr = XmlGetAttributeLargeNumber(pixnNode, L"InstallSize", &pPackage->qwInstallSize);
148
+ hr = XmlGetAttributeUInt64(pixnNode, L"InstallSize", &pPackage->qwInstallSize);
149
ExitOnFailure(hr, "Failed to get @InstallSize.");
150
151
// @PerMachine
src/libs/dutil/WixToolset.DUtil/atomutil.cpp
+1
-1
@@ -854,7 +854,7 @@ static HRESULT ParseAtomLink(
854
}
855
else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrNodeName, -1, L"length", -1))
856
{
857
- hr = XmlGetAttributeLargeNumber(pixnLink, bstrNodeName, &pLink->dw64Length);
857
+ hr = XmlGetAttributeUInt64(pixnLink, bstrNodeName, &pLink->dw64Length);
858
if (E_INVALIDARG == hr)
859
{
860
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
src/libs/dutil/WixToolset.DUtil/inc/xmlutil.h
+17
-2
@@ -106,10 +106,25 @@ HRESULT DAPI XmlGetAttributeNumberBase(
106
__in int nBase,
107
__out DWORD* pdwValue
108
);
109
-HRESULT DAPI XmlGetAttributeLargeNumber(
109
+HRESULT DAPI XmlGetAttributeUInt16(
110
__in IXMLDOMNode* pixnNode,
111
__in_z LPCWSTR pwzAttribute,
112
- __out DWORD64* pdw64Value
112
+ __out WORD* pwValue
113
+ );
114
+HRESULT DAPI XmlGetAttributeInt32(
115
+ __in IXMLDOMNode* pixnNode,
116
+ __in_z LPCWSTR pwzAttribute,
117
+ __out int* piValue
118
+ );
119
+HRESULT DAPI XmlGetAttributeUInt32(
120
+ __in IXMLDOMNode* pixnNode,
121
+ __in_z LPCWSTR pwzAttribute,
122
+ __out DWORD* pdwValue
123
+ );
124
+HRESULT DAPI XmlGetAttributeUInt64(
125
+ __in IXMLDOMNode* pixnNode,
126
+ __in_z LPCWSTR pwzAttribute,
127
+ __out DWORD64* pqwValue
128
);
129
HRESULT DAPI XmlGetNamedItem(
130
__in IXMLDOMNamedNodeMap *pixnmAttributes,
src/libs/dutil/WixToolset.DUtil/strutil.cpp
+1
-1
@@ -2580,7 +2580,7 @@ extern "C" HRESULT DAPI StrStringToUInt64(
2580
while (i < cchIn)
2581
{
2582
nDigit = wzIn[i] - L'0';
2583
- if (9 < nDigit)
2583
+ if (0 > nDigit || 9 < nDigit)
2584
{
2585
ExitFunction1(hr = E_INVALIDARG);
2586
}
src/libs/dutil/WixToolset.DUtil/thmutil.cpp
+562
-431
@@ -20,6 +20,7 @@
20
#define ThmExitOnRequiredXmlQueryFailure(x, s, ...) ExitOnRequiredXmlQueryFailureSource(DUTIL_SOURCE_THMUTIL, x, s, __VA_ARGS__)
21
#define ThmExitOnGdipFailure(g, x, s, ...) ExitOnGdipFailureSource(DUTIL_SOURCE_THMUTIL, g, x, s, __VA_ARGS__)
22
23
+#define ThmExitOnUnexpectedAttribute(x, n, e, a) { x = ParseUnexpectedAttribute(n, e, a); if (FAILED(x)) { ExitFunction(); } }
24
25
// from CommCtrl.h
26
#ifndef BS_COMMANDLINK
@@ -86,17 +87,33 @@ static HRESULT ParseTheme(
87
__in IXMLDOMDocument* pixd,
88
__out THEME** ppTheme
89
);
89
-static HRESULT ParseImage(
90
+static HRESULT GetAttributeImageFileOrResource(
91
__in_opt HMODULE hModule,
92
__in_z_opt LPCWSTR wzRelativePath,
93
__in IXMLDOMNode* pElement,
94
__out HBITMAP* phImage
95
);
95
-static HRESULT ParseIcon(
96
+static HRESULT ParseCommandLinkImage(
97
__in_opt HMODULE hModule,
98
__in_z_opt LPCWSTR wzRelativePath,
99
__in IXMLDOMNode* pElement,
99
- __out HICON* phIcon
100
+ __in THEME_CONTROL* pControl
101
+ );
102
+static HRESULT GetAttributeCoordinateOrDimension(
103
+ __in IXMLDOMNode* pixn,
104
+ __in LPCWSTR wzAttribute,
105
+ __inout int* pnValue
106
+ );
107
+static HRESULT GetAttributeFontId(
108
+ __in IXMLDOMNode* pixn,
109
+ __in LPCWSTR wzAttribute,
110
+ __inout DWORD* pdwValue
111
+ );
112
+static HRESULT ParseSourceXY(
113
+ __in IXMLDOMNode* pixn,
114
+ __in BOOL fAllowed,
115
+ __inout int* pnX,
116
+ __inout int* pnY
117
);
118
static HRESULT ParseWindow(
119
__in_opt HMODULE hModule,
@@ -138,6 +155,7 @@ static HRESULT ParseControl(
155
__in_opt HMODULE hModule,
156
__in_opt LPCWSTR wzRelativePath,
157
__in IXMLDOMNode* pixn,
158
+ __in_z LPCWSTR wzElementName,
159
__in THEME* pTheme,
160
__in THEME_CONTROL* pControl,
161
__in_opt THEME_PAGE* pPage
@@ -183,6 +201,11 @@ static HRESULT ParseTooltips(
201
__in THEME_CONTROL* pControl,
202
__inout BOOL* pfAnyChildren
203
);
204
+static HRESULT ParseUnexpectedAttribute(
205
+ __in IXMLDOMNode* pixn,
206
+ __in_z LPCWSTR wzElementName,
207
+ __in_z LPCWSTR wzAttribute
208
+ );
209
static HRESULT ParseNotes(
210
__in IXMLDOMNode* pixn,
211
__in THEME_CONTROL* pControl,
@@ -1698,6 +1721,7 @@ static HRESULT ParseTheme(
1721
HRESULT hr = S_OK;
1722
THEME* pTheme = NULL;
1723
IXMLDOMElement *pThemeElement = NULL;
1724
+ BOOL fXmlFound = FALSE;
1725
1726
hr = pixd->get_documentElement(&pThemeElement);
1727
ThmExitOnFailure(hr, "Failed to get theme element.");
@@ -1709,8 +1733,8 @@ static HRESULT ParseTheme(
1733
pTheme->nDpi = USER_DEFAULT_SCREEN_DPI;
1734
1735
// Parse the optional background resource image.
1712
- hr = ParseImage(hModule, wzRelativePath, pThemeElement, &pTheme->hImage);
1713
- ThmExitOnFailure(hr, "Failed while parsing theme image.");
1736
+ hr = GetAttributeImageFileOrResource(hModule, wzRelativePath, pThemeElement, &pTheme->hImage);
1737
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed while parsing theme image.");
1738
1739
// Parse the fonts.
1740
hr = ParseFonts(pThemeElement, pTheme);
@@ -1734,7 +1758,7 @@ LExit:
1758
return hr;
1759
}
1760
1737
-static HRESULT ParseImage(
1761
+static HRESULT GetAttributeImageFileOrResource(
1762
__in_opt HMODULE hModule,
1763
__in_z_opt LPCWSTR wzRelativePath,
1764
__in IXMLDOMNode* pElement,
@@ -1744,45 +1768,44 @@ static HRESULT ParseImage(
1768
HRESULT hr = S_OK;
1769
BSTR bstr = NULL;
1770
LPWSTR sczImageFile = NULL;
1747
- int iResourceId = 0;
1771
+ WORD wResourceId = 0;
1772
+ BOOL fFound = FALSE;
1773
Gdiplus::Bitmap* pBitmap = NULL;
1774
*phImage = NULL;
1775
1751
- hr = XmlGetAttribute(pElement, L"ImageResource", &bstr);
1752
- ThmExitOnFailure(hr, "Failed to get image resource attribute.");
1776
+ hr = XmlGetAttributeUInt16(pElement, L"ImageResource", &wResourceId);
1777
+ ThmExitOnOptionalXmlQueryFailure(hr, fFound, "Failed to get image resource attribute.");
1778
1754
- if (S_OK == hr)
1779
+ if (fFound)
1780
{
1756
- iResourceId = wcstol(bstr, NULL, 10);
1757
-
1758
- hr = GdipBitmapFromResource(hModule, MAKEINTRESOURCE(iResourceId), &pBitmap);
1759
- // Don't fail.
1781
+ hr = GdipBitmapFromResource(hModule, MAKEINTRESOURCE(wResourceId), &pBitmap);
1782
+ ThmExitOnFailure(hr, "Failed to load image from resource: %hu", wResourceId);
1783
}
1784
1762
- ReleaseNullBSTR(bstr);
1785
+ hr = XmlGetAttribute(pElement, L"ImageFile", &bstr);
1786
+ ThmExitOnOptionalXmlQueryFailure(hr, fFound, "Failed to get image file attribute.");
1787
1764
- // Parse the optional background image from a given file.
1765
- if (!pBitmap)
1788
+ if (fFound)
1789
{
1767
- hr = XmlGetAttribute(pElement, L"ImageFile", &bstr);
1768
- ThmExitOnFailure(hr, "Failed to get image file attribute.");
1769
-
1770
- if (S_OK == hr)
1790
+ if (pBitmap)
1791
{
1772
- if (wzRelativePath)
1773
- {
1774
- hr = PathConcat(wzRelativePath, bstr, &sczImageFile);
1775
- ThmExitOnFailure(hr, "Failed to combine image file path.");
1776
- }
1777
- else
1778
- {
1779
- hr = PathRelativeToModule(&sczImageFile, bstr, hModule);
1780
- ThmExitOnFailure(hr, "Failed to get image filename.");
1781
- }
1792
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "ImageFile attribute can't be specified with ImageResource attribute.");
1793
+ }
1794
1783
- hr = GdipBitmapFromFile(sczImageFile, &pBitmap);
1784
- // Don't fail.
1795
+ // Parse the optional background image from a given file.
1796
+ if (wzRelativePath)
1797
+ {
1798
+ hr = PathConcat(wzRelativePath, bstr, &sczImageFile);
1799
+ ThmExitOnFailure(hr, "Failed to combine image file path.");
1800
+ }
1801
+ else
1802
+ {
1803
+ hr = PathRelativeToModule(&sczImageFile, bstr, hModule);
1804
+ ThmExitOnFailure(hr, "Failed to get image filename.");
1805
}
1806
+
1807
+ hr = GdipBitmapFromFile(sczImageFile, &pBitmap);
1808
+ ThmExitOnFailure(hr, "Failed to load image from file: %ls", sczImageFile);
1809
}
1810
1811
// If there is an image, convert it into a bitmap handle.
@@ -1792,8 +1815,10 @@ static HRESULT ParseImage(
1815
Gdiplus::Status gs = pBitmap->GetHBITMAP(black, phImage);
1816
ThmExitOnGdipFailure(gs, hr, "Failed to convert GDI+ bitmap into HBITMAP.");
1817
}
1795
-
1796
- hr = S_OK;
1818
+ else
1819
+ {
1820
+ hr = E_NOTFOUND;
1821
+ }
1822
1823
LExit:
1824
if (pBitmap)
@@ -1808,62 +1833,244 @@ LExit:
1833
}
1834
1835
1811
-static HRESULT ParseIcon(
1836
+static HRESULT ParseOwnerDrawImage(
1837
__in_opt HMODULE hModule,
1838
__in_z_opt LPCWSTR wzRelativePath,
1839
+ __in THEME* pTheme,
1840
__in IXMLDOMNode* pElement,
1815
- __out HICON* phIcon
1841
+ __in THEME_CONTROL* pControl
1842
)
1843
{
1844
HRESULT hr = S_OK;
1819
- BSTR bstr = NULL;
1820
- LPWSTR sczImageFile = NULL;
1821
- int iResourceId = 0;
1822
- *phIcon = NULL;
1845
+ BOOL fXmlFound = FALSE;
1846
+ BOOL fFoundImage = FALSE;
1847
1824
- hr = XmlGetAttribute(pElement, L"IconResource", &bstr);
1825
- ThmExitOnFailure(hr, "Failed to get icon resource attribute.");
1848
+ // Parse the optional background resource image.
1849
+ hr = GetAttributeImageFileOrResource(hModule, wzRelativePath, pElement, &pControl->hImage);
1850
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed while parsing control image.");
1851
1827
- if (S_OK == hr)
1852
+ if (fXmlFound)
1853
+ {
1854
+ fFoundImage = TRUE;
1855
+ }
1856
+
1857
+ hr = ParseSourceXY(pElement, NULL != pTheme->hImage, &pControl->nSourceX, &pControl->nSourceY);
1858
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get control SourceX and SourceY attributes.");
1859
+
1860
+ if (fXmlFound)
1861
{
1829
- iResourceId = wcstol(bstr, NULL, 10);
1862
+ if (fFoundImage)
1863
+ {
1864
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Unexpected SourceX attribute with image attribute.");
1865
+ }
1866
+ else if (1 > pControl->nWidth || 1 > pControl->nHeight)
1867
+ {
1868
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Control Width and Height must be positive when using SourceX and SourceY.");
1869
+ }
1870
1831
- *phIcon = reinterpret_cast<HICON>(::LoadImageW(hModule, MAKEINTRESOURCEW(iResourceId), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE));
1832
- ThmExitOnNullWithLastError(*phIcon, hr, "Failed to load icon.");
1871
+ fFoundImage = TRUE;
1872
}
1834
- else
1873
+
1874
+ if (THEME_CONTROL_TYPE_IMAGE == pControl->type && !fFoundImage)
1875
{
1836
- ReleaseNullBSTR(bstr);
1876
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Image control didn't specify an image.");
1877
+ }
1878
1838
- hr = XmlGetAttribute(pElement, L"IconFile", &bstr);
1839
- ThmExitOnFailure(hr, "Failed to get icon file attribute.");
1879
+LExit:
1880
+ return hr;
1881
+}
1882
1841
- if (S_OK == hr)
1883
+
1884
+static HRESULT ParseCommandLinkImage(
1885
+ __in_opt HMODULE hModule,
1886
+ __in_z_opt LPCWSTR wzRelativePath,
1887
+ __in IXMLDOMNode* pElement,
1888
+ __in THEME_CONTROL* pControl
1889
+ )
1890
+{
1891
+ HRESULT hr = S_OK;
1892
+ BSTR bstr = NULL;
1893
+ BOOL fImageFound = FALSE;
1894
+ BOOL fXmlFound = FALSE;
1895
+ LPWSTR sczIconFile = NULL;
1896
+ WORD wResourceId = 0;
1897
+
1898
+ hr = GetAttributeImageFileOrResource(hModule, wzRelativePath, pElement, &pControl->hImage);
1899
+ ThmExitOnOptionalXmlQueryFailure(hr, fImageFound, "Failed to parse image attributes for CommandLink.");
1900
+
1901
+ hr = XmlGetAttributeUInt16(pElement, L"IconResource", &wResourceId);
1902
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get icon resource attribute.");
1903
+
1904
+ if (fXmlFound)
1905
+ {
1906
+ if (fImageFound)
1907
{
1843
- if (wzRelativePath)
1844
- {
1845
- hr = PathConcat(wzRelativePath, bstr, &sczImageFile);
1846
- ThmExitOnFailure(hr, "Failed to combine image file path.");
1847
- }
1848
- else
1849
- {
1850
- hr = PathRelativeToModule(&sczImageFile, bstr, hModule);
1851
- ThmExitOnFailure(hr, "Failed to get image filename.");
1852
- }
1908
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Unexpected IconResource attribute with image attribute.");
1909
+ }
1910
+
1911
+ pControl->hIcon = reinterpret_cast<HICON>(::LoadImageW(hModule, MAKEINTRESOURCEW(wResourceId), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE));
1912
+ ThmExitOnNullWithLastError(pControl->hIcon, hr, "Failed to load icon.");
1913
+ }
1914
+
1915
+ hr = XmlGetAttribute(pElement, L"IconFile", &bstr);
1916
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get icon file attribute.");
1917
+
1918
+ if (fXmlFound)
1919
+ {
1920
+ if (fImageFound)
1921
+ {
1922
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Unexpected IconFile attribute with image attribute.");
1923
+ }
1924
+ else if (pControl->hIcon)
1925
+ {
1926
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "IconFile attribute can't be specified with IconResource attribute.");
1927
+ }
1928
1854
- *phIcon = reinterpret_cast<HICON>(::LoadImageW(NULL, sczImageFile, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE));
1855
- ThmExitOnNullWithLastError(*phIcon, hr, "Failed to load icon: %ls.", sczImageFile);
1929
+ if (wzRelativePath)
1930
+ {
1931
+ hr = PathConcat(wzRelativePath, bstr, &sczIconFile);
1932
+ ThmExitOnFailure(hr, "Failed to combine image file path.");
1933
}
1934
+ else
1935
+ {
1936
+ hr = PathRelativeToModule(&sczIconFile, bstr, hModule);
1937
+ ThmExitOnFailure(hr, "Failed to get image filename.");
1938
+ }
1939
+
1940
+ pControl->hIcon = reinterpret_cast<HICON>(::LoadImageW(NULL, sczIconFile, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE));
1941
+ ThmExitOnNullWithLastError(pControl->hIcon, hr, "Failed to load icon: %ls.", sczIconFile);
1942
}
1943
1944
+ ThmExitOnUnexpectedAttribute(hr, pElement, L"CommandLink", L"SourceX");
1945
+ ThmExitOnUnexpectedAttribute(hr, pElement, L"CommandLink", L"SourceY");
1946
+
1947
LExit:
1860
- ReleaseStr(sczImageFile);
1948
+ ReleaseStr(sczIconFile);
1949
ReleaseBSTR(bstr);
1950
1951
return hr;
1952
}
1953
1954
1955
+static HRESULT GetAttributeCoordinateOrDimension(
1956
+ __in IXMLDOMNode* pixn,
1957
+ __in LPCWSTR wzAttribute,
1958
+ __inout int* pnValue
1959
+ )
1960
+{
1961
+ HRESULT hr = S_OK;
1962
+ int nValue = 0;
1963
+ BOOL fXmlFound = FALSE;
1964
+
1965
+ hr = XmlGetAttributeInt32(pixn, wzAttribute, &nValue);
1966
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get coordinate or dimension attribute.");
1967
+
1968
+ if (!fXmlFound)
1969
+ {
1970
+ ExitFunction1(hr = E_NOTFOUND);
1971
+ }
1972
+ else if (abs(nValue) > SHORT_MAX)
1973
+ {
1974
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Invalid coordinate or dimension attribute value: %i", nValue);
1975
+ }
1976
+
1977
+ *pnValue = nValue;
1978
+
1979
+LExit:
1980
+ return hr;
1981
+}
1982
+
1983
+static HRESULT GetAttributeFontId(
1984
+ __in IXMLDOMNode* pixn,
1985
+ __in LPCWSTR wzAttribute,
1986
+ __inout DWORD* pdwValue
1987
+ )
1988
+{
1989
+ HRESULT hr = S_OK;
1990
+ DWORD dwValue = 0;
1991
+ BOOL fXmlFound = FALSE;
1992
+
1993
+ hr = XmlGetAttributeUInt32(pixn, wzAttribute, &dwValue);
1994
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get font id attribute.");
1995
+
1996
+ if (!fXmlFound)
1997
+ {
1998
+ ExitFunction1(hr = E_NOTFOUND);
1999
+ }
2000
+ else if (THEME_INVALID_ID == dwValue)
2001
+ {
2002
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Invalid font id value: %u", dwValue);
2003
+ }
2004
+
2005
+ *pdwValue = dwValue;
2006
+
2007
+LExit:
2008
+ return hr;
2009
+}
2010
+
2011
+static HRESULT ParseSourceXY(
2012
+ __in IXMLDOMNode* pixn,
2013
+ __in BOOL fAllowed,
2014
+ __inout int* pnX,
2015
+ __inout int* pnY
2016
+ )
2017
+{
2018
+ HRESULT hr = S_OK;
2019
+ BOOL fXFound = FALSE;
2020
+ BOOL fYFound = FALSE;
2021
+
2022
+ hr = GetAttributeCoordinateOrDimension(pixn, L"SourceX", pnX);
2023
+ ThmExitOnOptionalXmlQueryFailure(hr, fXFound, "Failed to get SourceX attribute.");
2024
+
2025
+ if (!fXFound)
2026
+ {
2027
+ *pnX = -1;
2028
+ }
2029
+ else
2030
+ {
2031
+ if (!fAllowed)
2032
+ {
2033
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "SourceX cannot be specified without an image specified on Theme.");
2034
+ }
2035
+ else if (0 > *pnX)
2036
+ {
2037
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "SourceX must be non-negative.");
2038
+ }
2039
+ }
2040
+
2041
+ hr = GetAttributeCoordinateOrDimension(pixn, L"SourceY", pnY);
2042
+ ThmExitOnOptionalXmlQueryFailure(hr, fYFound, "Failed to get SourceY attribute.");
2043
+
2044
+ if (!fYFound)
2045
+ {
2046
+ if (fXFound)
2047
+ {
2048
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "SourceY must be specified with SourceX.");
2049
+ }
2050
+
2051
+ *pnY = -1;
2052
+ hr = E_NOTFOUND;
2053
+ }
2054
+ else
2055
+ {
2056
+ if (!fAllowed)
2057
+ {
2058
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "SourceY cannot be specified without an image specified on Theme.");
2059
+ }
2060
+ else if (!fXFound)
2061
+ {
2062
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "SourceY must be specified with SourceX.");
2063
+ }
2064
+ else if (0 > *pnY)
2065
+ {
2066
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "SourceY must be non-negative.");
2067
+ }
2068
+ }
2069
+
2070
+LExit:
2071
+ return hr;
2072
+}
2073
+
2074
static HRESULT ParseWindow(
2075
__in_opt HMODULE hModule,
2076
__in_opt LPCWSTR wzRelativePath,
@@ -1873,77 +2080,79 @@ static HRESULT ParseWindow(
2080
{
2081
HRESULT hr = S_OK;
2082
IXMLDOMNode* pixn = NULL;
1876
- DWORD dwValue = 0;
2083
+ BOOL fXmlFound = FALSE;
2084
+ int nValue = 0;
2085
BSTR bstr = NULL;
2086
LPWSTR sczIconFile = NULL;
2087
2088
hr = XmlSelectSingleNode(pElement, L"Window", &pixn);
1881
- if (S_FALSE == hr)
1882
- {
1883
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
1884
- }
1885
- ThmExitOnFailure(hr, "Failed to find window element.");
2089
+ ThmExitOnRequiredXmlQueryFailure(hr, "Failed to find window element.");
2090
2091
hr = XmlGetYesNoAttribute(pixn, L"AutoResize", &pTheme->fAutoResize);
1888
- if (E_NOTFOUND == hr)
1889
- {
1890
- hr = S_OK;
1891
- }
1892
- ThmExitOnFailure(hr, "Failed to get window AutoResize attribute.");
1893
-
1894
- hr = XmlGetAttributeNumber(pixn, L"Width", &dwValue);
1895
- if (S_FALSE == hr)
1896
- {
1897
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
1898
- ThmExitOnRootFailure(hr, "Failed to find window Width attribute.");
1899
- }
1900
- ThmExitOnFailure(hr, "Failed to get window Width attribute.");
2092
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get window AutoResize attribute.");
2093
1902
- pTheme->nWidth = pTheme->nDefaultDpiWidth = pTheme->nWindowWidth = dwValue;
2094
+ hr = GetAttributeCoordinateOrDimension(pixn, L"Width", &nValue);
2095
+ ThmExitOnRequiredXmlQueryFailure(hr, "Failed to get window Width attribute.");
2096
1904
- hr = XmlGetAttributeNumber(pixn, L"Height", &dwValue);
1905
- if (S_FALSE == hr)
2097
+ if (1 > nValue)
2098
{
1907
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
1908
- ThmExitOnRootFailure(hr, "Failed to find window Height attribute.");
2099
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Window/@Width must be positive: %i", nValue);
2100
}
1910
- ThmExitOnFailure(hr, "Failed to get window Height attribute.");
2101
1912
- pTheme->nHeight = pTheme->nDefaultDpiHeight = pTheme->nWindowHeight = dwValue;
2102
+ pTheme->nWidth = pTheme->nDefaultDpiWidth = pTheme->nWindowWidth = nValue;
2103
1914
- hr = XmlGetAttributeNumber(pixn, L"MinimumWidth", &dwValue);
1915
- if (S_FALSE == hr)
2104
+ hr = GetAttributeCoordinateOrDimension(pixn, L"Height", &nValue);
2105
+ ThmExitOnRequiredXmlQueryFailure(hr, "Failed to get window Height attribute.");
2106
+
2107
+ if (1 > nValue)
2108
{
1917
- dwValue = 0;
1918
- hr = S_OK;
2109
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Window/@Height must be positive: %i", nValue);
2110
}
1920
- ThmExitOnFailure(hr, "Failed to get window MinimumWidth attribute.");
2111
1922
- pTheme->nMinimumWidth = pTheme->nDefaultDpiMinimumWidth = dwValue;
2112
+ pTheme->nHeight = pTheme->nDefaultDpiHeight = pTheme->nWindowHeight = nValue;
2113
1924
- hr = XmlGetAttributeNumber(pixn, L"MinimumHeight", &dwValue);
1925
- if (S_FALSE == hr)
2114
+ hr = GetAttributeCoordinateOrDimension(pixn, L"MinimumWidth", &nValue);
2115
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get window MinimumWidth attribute.");
2116
+
2117
+ if (fXmlFound)
2118
{
1927
- dwValue = 0;
1928
- hr = S_OK;
2119
+ if (!pTheme->fAutoResize)
2120
+ {
2121
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Window/@MinimumWidth can't be specified unless AutoResize is enabled.");
2122
+ }
2123
+ else if (1 > nValue || pTheme->nWidth < nValue)
2124
+ {
2125
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Window/@MinimumWidth must be positive and not greater than Window/@Width: %i", nValue);
2126
+ }
2127
+
2128
+ pTheme->nMinimumWidth = pTheme->nDefaultDpiMinimumWidth = nValue;
2129
}
1930
- ThmExitOnFailure(hr, "Failed to get window MinimumHeight attribute.");
2130
1932
- pTheme->nMinimumHeight = pTheme->nDefaultDpiMinimumHeight = dwValue;
2131
+ hr = GetAttributeCoordinateOrDimension(pixn, L"MinimumHeight", &nValue);
2132
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get window MinimumHeight attribute.");
2133
1934
- hr = XmlGetAttributeNumber(pixn, L"FontId", &pTheme->dwFontId);
1935
- if (S_FALSE == hr)
2134
+ if (fXmlFound)
2135
{
1937
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
1938
- ThmExitOnRootFailure(hr, "Failed to find window FontId attribute.");
2136
+ if (!pTheme->fAutoResize)
2137
+ {
2138
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Window/@MinimumHeight can't be specified unless AutoResize is enabled.");
2139
+ }
2140
+ else if (1 > nValue || pTheme->nHeight < nValue)
2141
+ {
2142
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Window/@MinimumHeight must be positive and not greater than Window/@Height: %i", nValue);
2143
+ }
2144
+
2145
+ pTheme->nMinimumHeight = pTheme->nDefaultDpiMinimumHeight = nValue;
2146
}
1940
- ThmExitOnFailure(hr, "Failed to get window FontId attribute.");
2147
+
2148
+ hr = GetAttributeFontId(pixn, L"FontId", &pTheme->dwFontId);
2149
+ ThmExitOnRequiredXmlQueryFailure(hr, "Failed to get window FontId attribute.");
2150
2151
// Get the optional window icon from a resource.
2152
hr = XmlGetAttribute(pixn, L"IconResource", &bstr);
1944
- ThmExitOnFailure(hr, "Failed to get window IconResource attribute.");
2153
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get window IconResource attribute.");
2154
1946
- if (S_OK == hr)
2155
+ if (fXmlFound)
2156
{
2157
pTheme->hIcon = ::LoadIconW(hModule, bstr);
2158
ThmExitOnNullWithLastError(pTheme->hIcon, hr, "Failed to load window icon from IconResource.");
@@ -1953,10 +2162,15 @@ static HRESULT ParseWindow(
2162
2163
// Get the optional window icon from a file.
2164
hr = XmlGetAttribute(pixn, L"IconFile", &bstr);
1956
- ThmExitOnFailure(hr, "Failed to get window IconFile attribute.");
2165
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get window IconFile attribute.");
2166
1958
- if (S_OK == hr)
2167
+ if (fXmlFound)
2168
{
2169
+ if (pTheme->hIcon)
2170
+ {
2171
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Window/@IconFile can't be specified with IconResource.");
2172
+ }
2173
+
2174
if (wzRelativePath)
2175
{
2176
hr = PathConcat(wzRelativePath, bstr, &sczIconFile);
@@ -1974,48 +2188,37 @@ static HRESULT ParseWindow(
2188
ReleaseNullBSTR(bstr);
2189
}
2190
1977
- hr = XmlGetAttributeNumber(pixn, L"SourceX", reinterpret_cast<DWORD*>(&pTheme->nSourceX));
1978
- if (S_FALSE == hr)
1979
- {
1980
- pTheme->nSourceX = -1;
1981
- }
1982
- ThmExitOnFailure(hr, "Failed to get window SourceX attribute.");
1983
-
1984
- hr = XmlGetAttributeNumber(pixn, L"SourceY", reinterpret_cast<DWORD*>(&pTheme->nSourceY));
1985
- if (S_FALSE == hr)
1986
- {
1987
- pTheme->nSourceY = -1;
1988
- }
1989
- ThmExitOnFailure(hr, "Failed to get window SourceY attribute.");
2191
+ hr = ParseSourceXY(pixn, NULL != pTheme->hImage, &pTheme->nSourceX, &pTheme->nSourceY);
2192
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get window SourceX and SourceY attributes.");
2193
2194
// Parse the optional window style.
2195
hr = XmlGetAttributeNumberBase(pixn, L"HexStyle", 16, &pTheme->dwStyle);
1993
- ThmExitOnFailure(hr, "Failed to get theme window style (Window@HexStyle) attribute.");
2196
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get theme window style (Window@HexStyle) attribute.");
2197
1995
- if (S_FALSE == hr)
2198
+ if (!fXmlFound)
2199
{
1997
- pTheme->dwStyle = WS_VISIBLE | WS_MINIMIZEBOX | WS_SYSMENU;
2200
+ pTheme->dwStyle = WS_VISIBLE | WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION;
2201
pTheme->dwStyle |= (0 <= pTheme->nSourceX && 0 <= pTheme->nSourceY) ? WS_POPUP : WS_OVERLAPPED;
2202
}
2203
2001
- hr = XmlGetAttributeNumber(pixn, L"StringId", reinterpret_cast<DWORD*>(&pTheme->uStringId));
2002
- ThmExitOnFailure(hr, "Failed to get window StringId attribute.");
2204
+ hr = XmlGetAttributeUInt32(pixn, L"StringId", reinterpret_cast<DWORD*>(&pTheme->uStringId));
2205
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get window StringId attribute.");
2206
2004
- if (S_FALSE == hr)
2207
+ if (!fXmlFound)
2208
{
2209
pTheme->uStringId = UINT_MAX;
2210
+ }
2211
+ else if (UINT_MAX == pTheme->uStringId)
2212
+ {
2213
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Invalid StringId: %u", pTheme->uStringId);
2214
+ }
2215
2008
- hr = XmlGetAttribute(pixn, L"Caption", &bstr);
2009
- ThmExitOnFailure(hr, "Failed to get window Caption attribute.");
2010
-
2011
- if (S_FALSE == hr)
2012
- {
2013
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
2014
- ThmExitOnRootFailure(hr, "Window elements must contain the Caption or StringId attribute.");
2015
- }
2216
+ hr = XmlGetAttributeEx(pixn, L"Caption", &pTheme->sczCaption);
2217
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get window Caption attribute.");
2218
2017
- hr = StrAllocString(&pTheme->sczCaption, bstr, 0);
2018
- ThmExitOnFailure(hr, "Failed to copy window Caption attribute.");
2219
+ if (fXmlFound && UINT_MAX != pTheme->uStringId || !fXmlFound && UINT_MAX == pTheme->uStringId)
2220
+ {
2221
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Window elements must contain either the Caption or StringId attribute.");
2222
}
2223
2224
// Parse any image lists.
@@ -2049,6 +2252,7 @@ static HRESULT ParseFonts(
2252
IXMLDOMNode* pixn = NULL;
2253
BSTR bstrName = NULL;
2254
DWORD dwId = 0;
2255
+ BOOL fXmlFound = FALSE;
2256
COLORREF crForeground = THEME_INVISIBLE_COLORREF;
2257
COLORREF crBackground = THEME_INVISIBLE_COLORREF;
2258
DWORD dwSystemForegroundColor = FALSE;
@@ -2062,7 +2266,7 @@ static HRESULT ParseFonts(
2266
2267
if (!pTheme->cFonts)
2268
{
2065
- ExitFunction1(hr = S_OK);
2269
+ ThmExitOnRootFailure(hr = E_INVALIDDATA, "No font elements found.");
2270
}
2271
2272
pTheme->rgFonts = static_cast<THEME_FONT*>(MemAlloc(sizeof(THEME_FONT) * pTheme->cFonts, TRUE));
@@ -2070,66 +2274,52 @@ static HRESULT ParseFonts(
2274
2275
while (S_OK == (hr = XmlNextElement(pixnl, &pixn, NULL)))
2276
{
2073
- hr = XmlGetAttributeNumber(pixn, L"Id", &dwId);
2074
- if (S_FALSE == hr)
2075
- {
2076
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
2077
- }
2078
- ThmExitOnFailure(hr, "Failed to find font id.");
2277
+ hr = GetAttributeFontId(pixn, L"Id", &dwId);
2278
+ ThmExitOnRequiredXmlQueryFailure(hr, "Failed to find font id.");
2279
2280
if (pTheme->cFonts <= dwId)
2281
{
2082
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
2083
- ThmExitOnRootFailure(hr, "Invalid theme font id.");
2282
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Invalid theme font id: %u.", dwId);
2283
}
2284
2285
THEME_FONT* pFont = pTheme->rgFonts + dwId;
2286
if (pFont->cFontInstances)
2287
{
2089
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
2090
- ThmExitOnRootFailure(hr, "Theme font id duplicated.");
2288
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Theme font id duplicated.");
2289
}
2290
2291
pFont->lfQuality = CLEARTYPE_QUALITY;
2292
2293
hr = XmlGetText(pixn, &bstrName);
2096
- if (S_FALSE == hr)
2097
- {
2098
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
2099
- }
2100
- ThmExitOnFailure(hr, "Failed to get font name.");
2294
+ ThmExitOnRequiredXmlQueryFailure(hr, "Failed to get font name.");
2295
2296
hr = StrAllocString(&pFont->sczFaceName, bstrName, 0);
2297
ThmExitOnFailure(hr, "Failed to copy font name.");
2298
2105
- hr = XmlGetAttributeNumber(pixn, L"Height", reinterpret_cast<DWORD*>(&pFont->lfHeight));
2106
- if (S_FALSE == hr)
2107
- {
2108
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
2109
- }
2110
- ThmExitOnFailure(hr, "Failed to find font height attribute.");
2299
+ hr = XmlGetAttributeInt32(pixn, L"Height", reinterpret_cast<int*>(&pFont->lfHeight));
2300
+ ThmExitOnRequiredXmlQueryFailure(hr, "Failed to find font height attribute.");
2301
+
2302
+ hr = XmlGetAttributeInt32(pixn, L"Weight", reinterpret_cast<int*>(&pFont->lfWeight));
2303
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to find font weight attribute.");
2304
2112
- hr = XmlGetAttributeNumber(pixn, L"Weight", reinterpret_cast<DWORD*>(&pFont->lfWeight));
2113
- if (S_FALSE == hr)
2305
+ if (!fXmlFound)
2306
{
2307
pFont->lfWeight = FW_DONTCARE;
2116
- hr = S_OK;
2308
}
2118
- ThmExitOnFailure(hr, "Failed to find font weight attribute.");
2309
2310
hr = XmlGetYesNoAttribute(pixn, L"Underline", reinterpret_cast<BOOL*>(&pFont->lfUnderline));
2121
- if (E_NOTFOUND == hr)
2311
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to find font underline attribute.");
2312
+
2313
+ if (!fXmlFound)
2314
{
2315
pFont->lfUnderline = FALSE;
2124
- hr = S_OK;
2316
}
2126
- ThmExitOnFailure(hr, "Failed to find font underline attribute.");
2317
2318
hr = GetFontColor(pixn, L"Foreground", &crForeground, &dwSystemForegroundColor);
2129
- ThmExitOnFailure(hr, "Failed to find font foreground color.");
2319
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to find font foreground color.");
2320
2321
hr = GetFontColor(pixn, L"Background", &crBackground, &dwSystemBackgroundColor);
2132
- ThmExitOnFailure(hr, "Failed to find font background color.");
2322
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to find font background color.");
2323
2324
pFont->crForeground = crForeground;
2325
if (THEME_INVISIBLE_COLORREF != pFont->crForeground)
@@ -2173,16 +2363,18 @@ static HRESULT GetFontColor(
2363
{
2364
HRESULT hr = S_OK;
2365
BSTR bstr = NULL;
2366
+ BOOL fXmlFound = FALSE;
2367
2368
*pdwSystemColor = 0;
2369
2370
hr = XmlGetAttribute(pixn, wzAttributeName, &bstr);
2180
- if (S_FALSE == hr)
2371
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to find font %ls color.", wzAttributeName);
2372
+
2373
+ if (!fXmlFound)
2374
{
2375
*pColorRef = THEME_INVISIBLE_COLORREF;
2183
- ExitFunction1(hr = S_OK);
2376
+ ExitFunction1(hr = E_NOTFOUND);
2377
}
2185
- ThmExitOnFailure(hr, "Failed to find font %ls color.", wzAttributeName);
2378
2379
if (pdwSystemColor)
2380
{
@@ -2220,7 +2412,12 @@ static HRESULT GetFontColor(
2412
}
2413
else
2414
{
2223
- *pColorRef = wcstoul(bstr, NULL, 16);
2415
+ *pColorRef = ::wcstoul(bstr, NULL, 16);
2416
+
2417
+ if (THEME_INVISIBLE_COLORREF == *pColorRef)
2418
+ {
2419
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Invalid %ls value: %ls.", wzAttributeName, bstr);
2420
+ }
2421
}
2422
2423
if (*pdwSystemColor)
@@ -2248,6 +2445,7 @@ static HRESULT ParsePages(
2445
BSTR bstrType = NULL;
2446
THEME_PAGE* pPage = NULL;
2447
DWORD iPage = 0;
2448
+ BOOL fXmlFound = FALSE;
2449
2450
hr = XmlSelectNodes(pElement, L"Page", &pixnl);
2451
ThmExitOnFailure(hr, "Failed to find page elements.");
@@ -2270,11 +2468,7 @@ static HRESULT ParsePages(
2468
pPage->wId = static_cast<WORD>(iPage + 1);
2469
2470
hr = XmlGetAttributeEx(pixn, L"Name", &pPage->sczName);
2273
- if (E_NOTFOUND == hr)
2274
- {
2275
- hr = S_OK;
2276
- }
2277
- ThmExitOnFailure(hr, "Failed when querying page Name.");
2471
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying page Name.");
2472
2473
hr = ParseControls(hModule, wzRelativePath, pixn, pTheme, NULL, pPage);
2474
ThmExitOnFailure(hr, "Failed to parse page controls.");
@@ -2314,9 +2508,10 @@ static HRESULT ParseImageLists(
2508
IXMLDOMNode* pixnImage = NULL;
2509
DWORD dwImageListIndex = 0;
2510
DWORD dwImageCount = 0;
2511
+ THEME_IMAGELIST* pThemeImageList = NULL;
2512
+ BOOL fXmlFound = FALSE;
2513
HBITMAP hBitmap = NULL;
2514
BITMAP bm = { };
2319
- BSTR bstr = NULL;
2515
DWORD i = 0;
2516
int iRetVal = 0;
2517
@@ -2336,15 +2531,12 @@ static HRESULT ParseImageLists(
2531
2532
while (S_OK == (hr = XmlNextElement(pixnlImageLists, &pixnImageList, NULL)))
2533
{
2339
- hr = XmlGetAttribute(pixnImageList, L"Name", &bstr);
2340
- if (S_FALSE == hr)
2341
- {
2342
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
2343
- }
2344
- ThmExitOnFailure(hr, "Failed to find ImageList/@Name attribute.");
2534
+ pThemeImageList = pTheme->rgImageLists + dwImageListIndex;
2535
+ ++dwImageListIndex;
2536
+ i = 0;
2537
2346
- hr = StrAllocString(&pTheme->rgImageLists[dwImageListIndex].sczName, bstr, 0);
2347
- ThmExitOnFailure(hr, "Failed to make copy of ImageList name.");
2538
+ hr = XmlGetAttributeEx(pixnImageList, L"Name", &pThemeImageList->sczName);
2539
+ ThmExitOnRequiredXmlQueryFailure(hr, "Failed to find ImageList/@Name attribute.");
2540
2541
hr = XmlSelectNodes(pixnImageList, L"Image", &pixnlImages);
2542
ThmExitOnFailure(hr, "Failed to select child Image nodes.");
@@ -2352,38 +2544,44 @@ static HRESULT ParseImageLists(
2544
hr = pixnlImages->get_length(reinterpret_cast<long*>(&dwImageCount));
2545
ThmExitOnFailure(hr, "Failed to count the number of images in list.");
2546
2355
- if (0 < dwImageCount)
2547
+ if (!dwImageCount)
2548
{
2357
- i = 0;
2358
- while (S_OK == (hr = XmlNextElement(pixnlImages, &pixnImage, NULL)))
2549
+ ThmExitOnRootFailure(hr = E_INVALIDDATA, "ImageList '%ls' has no images.", pThemeImageList->sczName);
2550
+ }
2551
+
2552
+ while (S_OK == (hr = XmlNextElement(pixnlImages, &pixnImage, NULL)))
2553
+ {
2554
+ if (hBitmap)
2555
{
2360
- if (hBitmap)
2361
- {
2362
- ::DeleteObject(hBitmap);
2363
- hBitmap = NULL;
2364
- }
2365
- hr = ParseImage(hModule, wzRelativePath, pixnImage, &hBitmap);
2366
- ThmExitOnFailure(hr, "Failed to parse image: %u", i);
2556
+ ::DeleteObject(hBitmap);
2557
+ hBitmap = NULL;
2558
+ }
2559
2368
- if (0 == i)
2369
- {
2370
- ::GetObjectW(hBitmap, sizeof(BITMAP), &bm);
2560
+ hr = GetAttributeImageFileOrResource(hModule, wzRelativePath, pixnImage, &hBitmap);
2561
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to parse image list: '%ls', item: %u", pThemeImageList->sczName, i);
2562
2372
- pTheme->rgImageLists[dwImageListIndex].hImageList = ImageList_Create(bm.bmWidth, bm.bmHeight, ILC_COLOR24, dwImageCount, 0);
2373
- ThmExitOnNullWithLastError(pTheme->rgImageLists[dwImageListIndex].hImageList, hr, "Failed to create image list.");
2374
- }
2563
+ if (!fXmlFound)
2564
+ {
2565
+ ThmExitWithRootFailure(hr, E_INVALIDDATA, "Image list: '%ls', item %u didn't specify an image.", pThemeImageList->sczName, i);
2566
+ }
2567
2376
- iRetVal = ImageList_Add(pTheme->rgImageLists[dwImageListIndex].hImageList, hBitmap, NULL);
2377
- if (-1 == iRetVal)
2378
- {
2379
- ThmExitWithLastError(hr, "Failed to add image %u to image list.", i);
2380
- }
2568
+ if (0 == i)
2569
+ {
2570
+ ::GetObjectW(hBitmap, sizeof(BITMAP), &bm);
2571
2382
- ++i;
2383
- ReleaseNullObject(pixnImage);
2572
+ pThemeImageList->hImageList = ImageList_Create(bm.bmWidth, bm.bmHeight, ILC_COLOR24, dwImageCount, 0);
2573
+ ThmExitOnNullWithLastError(pThemeImageList->hImageList, hr, "Failed to create image list.");
2574
}
2575
+
2576
+ iRetVal = ImageList_Add(pThemeImageList->hImageList, hBitmap, NULL);
2577
+ if (-1 == iRetVal)
2578
+ {
2579
+ ThmExitWithLastError(hr, "Failed to add image %u to image list.", i);
2580
+ }
2581
+
2582
+ ++i;
2583
+ ReleaseNullObject(pixnImage);
2584
}
2386
- ++dwImageListIndex;
2585
2586
ReleaseNullObject(pixnlImages);
2587
ReleaseNullObject(pixnImageList);
@@ -2394,7 +2592,6 @@ LExit:
2592
{
2593
::DeleteObject(hBitmap);
2594
}
2397
- ReleaseBSTR(bstr);
2595
ReleaseObject(pixnlImageLists);
2596
ReleaseObject(pixnImageList);
2597
ReleaseObject(pixnlImages);
@@ -2572,7 +2769,7 @@ static HRESULT ParseControls(
2769
THEME_CONTROL* pControl = *prgControls + iControl;
2770
pControl->type = type;
2771
2575
- hr = ParseControl(hModule, wzRelativePath, pixn, pTheme, pControl, pPage);
2772
+ hr = ParseControl(hModule, wzRelativePath, pixn, bstrType, pTheme, pControl, pPage);
2773
ThmExitOnFailure(hr, "Failed to parse control.");
2774
2775
if (pPage)
@@ -2608,154 +2805,108 @@ static HRESULT ParseControl(
2805
__in_opt HMODULE hModule,
2806
__in_opt LPCWSTR wzRelativePath,
2807
__in IXMLDOMNode* pixn,
2808
+ __in_z LPCWSTR wzElementName,
2809
__in THEME* pTheme,
2810
__in THEME_CONTROL* pControl,
2811
__in_opt THEME_PAGE* pPage
2812
)
2813
{
2814
HRESULT hr = S_OK;
2617
- BOOL fFound = FALSE;
2815
+ BOOL fXmlFound = FALSE;
2816
DWORD dwValue = 0;
2817
+ int nValue = 0;
2818
BOOL fValue = FALSE;
2819
BSTR bstrText = NULL;
2820
BOOL fAnyTextChildren = FALSE;
2821
BOOL fAnyNoteChildren = FALSE;
2623
- BOOL fSkipDimensions = FALSE;
2822
2823
InitializeThemeControl(pControl);
2824
2825
hr = XmlGetAttributeEx(pixn, L"Name", &pControl->sczName);
2628
- if (E_NOTFOUND == hr)
2629
- {
2630
- hr = S_OK;
2631
- }
2632
- ThmExitOnFailure(hr, "Failed when querying control Name attribute.");
2826
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying control Name attribute.");
2827
2828
hr = XmlGetAttributeEx(pixn, L"EnableCondition", &pControl->sczEnableCondition);
2635
- if (E_NOTFOUND == hr)
2636
- {
2637
- hr = S_OK;
2638
- }
2639
- ThmExitOnFailure(hr, "Failed when querying control EnableCondition attribute.");
2829
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying control EnableCondition attribute.");
2830
2831
hr = XmlGetAttributeEx(pixn, L"VisibleCondition", &pControl->sczVisibleCondition);
2642
- if (E_NOTFOUND == hr)
2643
- {
2644
- hr = S_OK;
2645
- }
2646
- ThmExitOnFailure(hr, "Failed when querying control VisibleCondition attribute.");
2647
-
2648
- if (!fSkipDimensions)
2649
- {
2650
- hr = XmlGetAttributeNumber(pixn, L"X", &dwValue);
2651
- if (S_FALSE == hr)
2652
- {
2653
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
2654
- }
2655
- ThmExitOnFailure(hr, "Failed to find control X attribute.");
2832
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying control VisibleCondition attribute.");
2833
2657
- pControl->nX = pControl->nDefaultDpiX = dwValue;
2834
+ hr = GetAttributeCoordinateOrDimension(pixn, L"X", &nValue);
2835
+ ThmExitOnRequiredXmlQueryFailure(hr, "Failed to find control X attribute.");
2836
2659
- hr = XmlGetAttributeNumber(pixn, L"Y", &dwValue);
2660
- if (S_FALSE == hr)
2661
- {
2662
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
2663
- }
2664
- ThmExitOnFailure(hr, "Failed to find control Y attribute.");
2837
+ pControl->nX = pControl->nDefaultDpiX = nValue;
2838
2666
- pControl->nY = pControl->nDefaultDpiY = dwValue;
2839
+ hr = GetAttributeCoordinateOrDimension(pixn, L"Y", &nValue);
2840
+ ThmExitOnRequiredXmlQueryFailure(hr, "Failed to find control Y attribute.");
2841
2668
- hr = XmlGetAttributeNumber(pixn, L"Height", &dwValue);
2669
- if (S_FALSE == hr)
2670
- {
2671
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
2672
- }
2673
- ThmExitOnFailure(hr, "Failed to find control Height attribute.");
2842
+ pControl->nY = pControl->nDefaultDpiY = nValue;
2843
2675
- pControl->nHeight = pControl->nDefaultDpiHeight = dwValue;
2844
+ hr = GetAttributeCoordinateOrDimension(pixn, L"Height", &nValue);
2845
+ ThmExitOnRequiredXmlQueryFailure(hr, "Failed to find control Height attribute.");
2846
2677
- hr = XmlGetAttributeNumber(pixn, L"Width", &dwValue);
2678
- if (S_FALSE == hr)
2679
- {
2680
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
2681
- }
2682
- ThmExitOnFailure(hr, "Failed to find control Width attribute.");
2847
+ pControl->nHeight = pControl->nDefaultDpiHeight = nValue;
2848
2684
- pControl->nWidth = pControl->nDefaultDpiWidth = dwValue;
2685
- }
2849
+ hr = GetAttributeCoordinateOrDimension(pixn, L"Width", &nValue);
2850
+ ThmExitOnRequiredXmlQueryFailure(hr, "Failed to find control Width attribute.");
2851
2687
- // Parse the optional background resource image.
2688
- hr = ParseImage(hModule, wzRelativePath, pixn, &pControl->hImage);
2689
- ThmExitOnFailure(hr, "Failed while parsing control image.");
2852
+ pControl->nWidth = pControl->nDefaultDpiWidth = nValue;
2853
2691
- hr = XmlGetAttributeNumber(pixn, L"SourceX", reinterpret_cast<DWORD*>(&pControl->nSourceX));
2692
- ThmExitOnFailure(hr, "Failed when querying control SourceX attribute.");
2854
+ switch (pControl->type)
2855
+ {
2856
+ case THEME_CONTROL_TYPE_COMMANDLINK:
2857
+ hr = ParseCommandLinkImage(hModule, wzRelativePath, pixn, pControl);
2858
+ ThmExitOnFailure(hr, "Failed while parsing CommandLink image.");
2859
+ break;
2860
+ case THEME_CONTROL_TYPE_BUTTON:
2861
+ case THEME_CONTROL_TYPE_IMAGE:
2862
+ case THEME_CONTROL_TYPE_PROGRESSBAR:
2863
+ hr = ParseOwnerDrawImage(hModule, wzRelativePath, pTheme, pixn, pControl);
2864
+ ThmExitOnFailure(hr, "Failed while parsing OwnerDraw image.");
2865
+ break;
2866
+ default:
2867
+ ThmExitOnUnexpectedAttribute(hr, pixn, wzElementName, L"ImageId");
2868
+ ThmExitOnUnexpectedAttribute(hr, pixn, wzElementName, L"ImageFile");
2869
+ ThmExitOnUnexpectedAttribute(hr, pixn, wzElementName, L"ImageResource");
2870
+ ThmExitOnUnexpectedAttribute(hr, pixn, wzElementName, L"SourceX");
2871
+ ThmExitOnUnexpectedAttribute(hr, pixn, wzElementName, L"SourceY");
2872
+ break;
2873
+ }
2874
2694
- hr = XmlGetAttributeNumber(pixn, L"SourceY", reinterpret_cast<DWORD*>(&pControl->nSourceY));
2695
- ThmExitOnFailure(hr, "Failed when querying control SourceY attribute.");
2875
2697
- hr = XmlGetAttributeNumber(pixn, L"FontId", &pControl->dwFontId);
2698
- ThmExitOnFailure(hr, "Failed when querying control FontId attribute.");
2876
+ hr = GetAttributeFontId(pixn, L"FontId", &pControl->dwFontId);
2877
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying control FontId attribute.");
2878
2879
// Parse the optional window style.
2880
hr = XmlGetAttributeNumberBase(pixn, L"HexStyle", 16, &pControl->dwStyle);
2702
- ThmExitOnFailure(hr, "Failed when querying control HexStyle attribute.");
2881
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying control HexStyle attribute.");
2882
2883
// Parse the tabstop bit "shortcut nomenclature", this could have been set with the style above.
2884
hr = XmlGetYesNoAttribute(pixn, L"TabStop", &fValue);
2706
- if (E_NOTFOUND == hr)
2707
- {
2708
- hr = S_OK;
2709
- }
2710
- else
2711
- {
2712
- ThmExitOnFailure(hr, "Failed when querying control TabStop attribute.");
2885
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying control TabStop attribute.");
2886
2714
- if (fValue)
2715
- {
2716
- pControl->dwStyle |= WS_TABSTOP;
2717
- }
2887
+ if (fXmlFound && fValue)
2888
+ {
2889
+ pControl->dwStyle |= WS_TABSTOP;
2890
}
2891
2892
hr = XmlGetYesNoAttribute(pixn, L"Visible", &fValue);
2721
- if (E_NOTFOUND == hr)
2722
- {
2723
- hr = S_OK;
2724
- }
2725
- else
2726
- {
2727
- ThmExitOnFailure(hr, "Failed when querying control Visible attribute.");
2893
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying control Visible attribute.");
2894
2729
- if (fValue)
2730
- {
2731
- pControl->dwStyle |= WS_VISIBLE;
2732
- }
2895
+ if (fXmlFound && fValue)
2896
+ {
2897
+ pControl->dwStyle |= WS_VISIBLE;
2898
}
2899
2900
hr = XmlGetYesNoAttribute(pixn, L"HideWhenDisabled", &fValue);
2736
- if (E_NOTFOUND == hr)
2737
- {
2738
- hr = S_OK;
2739
- }
2740
- else
2741
- {
2742
- ThmExitOnFailure(hr, "Failed when querying control HideWhenDisabled attribute.");
2901
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying control HideWhenDisabled attribute.");
2902
2744
- if (fValue)
2745
- {
2746
- pControl->dwInternalStyle |= INTERNAL_CONTROL_STYLE_HIDE_WHEN_DISABLED;
2747
- }
2903
+ if (fXmlFound && fValue)
2904
+ {
2905
+ pControl->dwInternalStyle |= INTERNAL_CONTROL_STYLE_HIDE_WHEN_DISABLED;
2906
}
2907
2908
hr = XmlGetYesNoAttribute(pixn, L"DisableAutomaticBehavior", &pControl->fDisableVariableFunctionality);
2751
- if (E_NOTFOUND == hr)
2752
- {
2753
- hr = S_OK;
2754
- }
2755
- else
2756
- {
2757
- ThmExitOnFailure(hr, "Failed when querying control DisableAutomaticBehavior attribute.");
2758
- }
2909
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying control DisableAutomaticBehavior attribute.");
2910
2911
hr = ParseActions(pixn, pControl);
2912
ThmExitOnFailure(hr, "Failed to parse action nodes of the control.");
@@ -2774,10 +2925,10 @@ static HRESULT ParseControl(
2925
2926
if (!fAnyTextChildren && !fAnyNoteChildren)
2927
{
2777
- hr = XmlGetAttributeNumber(pixn, L"StringId", &dwValue);
2778
- ThmExitOnOptionalXmlQueryFailure(hr, fFound, "Failed when querying control StringId attribute.");
2928
+ hr = XmlGetAttributeUInt32(pixn, L"StringId", &dwValue);
2929
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying control StringId attribute.");
2930
2780
- if (fFound)
2931
+ if (fXmlFound)
2932
{
2933
pControl->uStringId = dwValue;
2934
}
@@ -2787,9 +2938,9 @@ static HRESULT ParseControl(
2938
if (THEME_CONTROL_TYPE_BILLBOARD != pControl->type && THEME_CONTROL_TYPE_PANEL != pControl->type)
2939
{
2940
hr = XmlGetText(pixn, &bstrText);
2790
- ThmExitOnOptionalXmlQueryFailure(hr, fFound, "Failed to get control inner text.");
2941
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get control inner text.");
2942
2792
- if (fFound)
2943
+ if (fXmlFound)
2944
{
2945
hr = StrAllocString(&pControl->sczText, bstrText, 0);
2946
ThmExitOnFailure(hr, "Failed to copy control text.");
@@ -2803,115 +2954,93 @@ static HRESULT ParseControl(
2954
if (THEME_CONTROL_TYPE_BILLBOARD == pControl->type)
2955
{
2956
hr = XmlGetYesNoAttribute(pixn, L"Loop", &pControl->fBillboardLoops);
2806
- if (E_NOTFOUND == hr)
2807
- {
2808
- hr = S_OK;
2809
- }
2810
- ThmExitOnFailure(hr, "Failed when querying Billboard/@Loop attribute.");
2957
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying Billboard/@Loop attribute.");
2958
2812
- pControl->wBillboardInterval = 5000;
2813
- hr = XmlGetAttributeNumber(pixn, L"Interval", &dwValue);
2814
- if (S_OK == hr && dwValue)
2959
+ hr = XmlGetAttributeUInt16(pixn, L"Interval", &pControl->wBillboardInterval);
2960
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying Billboard/@Interval attribute.");
2961
+
2962
+ if (!pControl->wBillboardInterval)
2963
{
2816
- pControl->wBillboardInterval = static_cast<WORD>(dwValue & 0xFFFF);
2964
+ pControl->wBillboardInterval = 5000;
2965
}
2818
- ThmExitOnFailure(hr, "Failed when querying Billboard/@Interval attribute.");
2966
2967
hr = ParseBillboardPanels(hModule, wzRelativePath, pixn, pTheme, pControl, pPage);
2968
ThmExitOnFailure(hr, "Failed to parse billboard children.");
2969
}
2823
- else if (THEME_CONTROL_TYPE_COMMANDLINK == pControl->type)
2824
- {
2825
- hr = ParseIcon(hModule, wzRelativePath, pixn, &pControl->hIcon);
2826
- ThmExitOnFailure(hr, "Failed while parsing control icon.");
2827
- }
2970
else if (THEME_CONTROL_TYPE_EDITBOX == pControl->type)
2971
{
2972
hr = XmlGetYesNoAttribute(pixn, L"FileSystemAutoComplete", &fValue);
2831
- if (E_NOTFOUND == hr)
2832
- {
2833
- hr = S_OK;
2834
- }
2835
- else
2836
- {
2837
- ThmExitOnFailure(hr, "Failed when querying Editbox/@FileSystemAutoComplete attribute.");
2973
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying Editbox/@FileSystemAutoComplete attribute.");
2974
2839
- if (fValue)
2840
- {
2841
- pControl->dwInternalStyle |= INTERNAL_CONTROL_STYLE_FILESYSTEM_AUTOCOMPLETE;
2842
- }
2975
+ if (fXmlFound && fValue)
2976
+ {
2977
+ pControl->dwInternalStyle |= INTERNAL_CONTROL_STYLE_FILESYSTEM_AUTOCOMPLETE;
2978
}
2979
}
2980
else if (THEME_CONTROL_TYPE_HYPERLINK == pControl->type || THEME_CONTROL_TYPE_BUTTON == pControl->type)
2981
{
2847
- hr = XmlGetAttributeNumber(pixn, L"HoverFontId", &pControl->dwFontHoverId);
2848
- ThmExitOnFailure(hr, "Failed when querying control HoverFontId attribute.");
2982
+ hr = GetAttributeFontId(pixn, L"HoverFontId", &pControl->dwFontHoverId);
2983
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying control HoverFontId attribute.");
2984
2850
- hr = XmlGetAttributeNumber(pixn, L"SelectedFontId", &pControl->dwFontSelectedId);
2851
- ThmExitOnFailure(hr, "Failed when querying control SelectedFontId attribute.");
2985
+ hr = GetAttributeFontId(pixn, L"SelectedFontId", &pControl->dwFontSelectedId);
2986
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying control SelectedFontId attribute.");
2987
}
2988
else if (THEME_CONTROL_TYPE_LABEL == pControl->type)
2989
{
2990
hr = XmlGetYesNoAttribute(pixn, L"Center", &fValue);
2856
- if (E_NOTFOUND == hr)
2857
- {
2858
- hr = S_OK;
2859
- }
2860
- else if (fValue)
2991
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying Label/@Center attribute.");
2992
+
2993
+ if (fXmlFound && fValue)
2994
{
2995
pControl->dwStyle |= SS_CENTER;
2996
}
2864
- ThmExitOnFailure(hr, "Failed when querying Label/@Center attribute.");
2997
2998
hr = XmlGetYesNoAttribute(pixn, L"DisablePrefix", &fValue);
2867
- if (E_NOTFOUND == hr)
2868
- {
2869
- hr = S_OK;
2870
- }
2871
- else if (fValue)
2999
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying Label/@DisablePrefix attribute.");
3000
+
3001
+ if (fXmlFound && fValue)
3002
{
3003
pControl->dwStyle |= SS_NOPREFIX;
3004
}
2875
- ThmExitOnFailure(hr, "Failed when querying Label/@DisablePrefix attribute.");
3005
}
3006
else if (THEME_CONTROL_TYPE_LISTVIEW == pControl->type)
3007
{
3008
// Parse the optional extended window style.
3009
hr = XmlGetAttributeNumberBase(pixn, L"HexExtendedStyle", 16, &pControl->dwExtendedStyle);
2881
- ThmExitOnFailure(hr, "Failed when querying ListView/@HexExtendedStyle attribute.");
3010
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying ListView/@HexExtendedStyle attribute.");
3011
3012
hr = XmlGetAttribute(pixn, L"ImageList", &bstrText);
2884
- if (S_FALSE != hr)
2885
- {
2886
- ThmExitOnFailure(hr, "Failed when querying ListView/@ImageList attribute.");
3013
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying ListView/@ImageList attribute.");
3014
3015
+ if (fXmlFound)
3016
+ {
3017
hr = FindImageList(pTheme, bstrText, &pControl->rghImageList[0]);
3018
ThmExitOnFailure(hr, "Failed to find image list %ls while setting ImageList for ListView.", bstrText);
3019
}
3020
3021
hr = XmlGetAttribute(pixn, L"ImageListSmall", &bstrText);
2893
- if (S_FALSE != hr)
2894
- {
2895
- ThmExitOnFailure(hr, "Failed when querying ListView/@ImageListSmall attribute.");
3022
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying ListView/@ImageListSmall attribute.");
3023
3024
+ if (fXmlFound)
3025
+ {
3026
hr = FindImageList(pTheme, bstrText, &pControl->rghImageList[1]);
3027
ThmExitOnFailure(hr, "Failed to find image list %ls while setting ImageListSmall for ListView.", bstrText);
3028
}
3029
3030
hr = XmlGetAttribute(pixn, L"ImageListState", &bstrText);
2902
- if (S_FALSE != hr)
2903
- {
2904
- ThmExitOnFailure(hr, "Failed when querying ListView/@ImageListState attribute.");
3031
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying ListView/@ImageListState attribute.");
3032
3033
+ if (fXmlFound)
3034
+ {
3035
hr = FindImageList(pTheme, bstrText, &pControl->rghImageList[2]);
3036
ThmExitOnFailure(hr, "Failed to find image list %ls while setting ImageListState for ListView.", bstrText);
3037
}
3038
3039
hr = XmlGetAttribute(pixn, L"ImageListGroupHeader", &bstrText);
2911
- if (S_FALSE != hr)
2912
- {
2913
- ThmExitOnFailure(hr, "Failed when querying ListView/@ImageListGroupHeader attribute.");
3040
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying ListView/@ImageListGroupHeader attribute.");
3041
3042
+ if (fXmlFound)
3043
+ {
3044
hr = FindImageList(pTheme, bstrText, &pControl->rghImageList[3]);
3045
ThmExitOnFailure(hr, "Failed to find image list %ls while setting ImageListGroupHeader for ListView.", bstrText);
3046
}
@@ -2927,11 +3056,7 @@ static HRESULT ParseControl(
3056
else if (THEME_CONTROL_TYPE_RADIOBUTTON == pControl->type)
3057
{
3058
hr = XmlGetAttributeEx(pixn, L"Value", &pControl->sczValue);
2930
- if (E_NOTFOUND == hr)
2931
- {
2932
- hr = S_OK;
2933
- }
2934
- ThmExitOnFailure(hr, "Failed when querying RadioButton/@Value attribute.");
3059
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying RadioButton/@Value attribute.");
3060
}
3061
else if (THEME_CONTROL_TYPE_TAB == pControl->type)
3062
{
@@ -2943,70 +3068,52 @@ static HRESULT ParseControl(
3068
pControl->dwStyle |= TVS_DISABLEDRAGDROP;
3069
3070
hr = XmlGetYesNoAttribute(pixn, L"EnableDragDrop", &fValue);
2946
- if (E_NOTFOUND == hr)
2947
- {
2948
- hr = S_OK;
2949
- }
2950
- else if (fValue)
3071
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying TreeView/@EnableDragDrop attribute.");
3072
+
3073
+ if (fXmlFound && fValue)
3074
{
3075
pControl->dwStyle &= ~TVS_DISABLEDRAGDROP;
3076
}
2954
- ThmExitOnFailure(hr, "Failed when querying TreeView/@EnableDragDrop attribute.");
3077
3078
hr = XmlGetYesNoAttribute(pixn, L"FullRowSelect", &fValue);
2957
- if (E_NOTFOUND == hr)
2958
- {
2959
- hr = S_OK;
2960
- }
2961
- else if (fValue)
3079
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying TreeView/@FullRowSelect attribute.");
3080
+
3081
+ if (fXmlFound && fValue)
3082
{
3083
pControl->dwStyle |= TVS_FULLROWSELECT;
3084
}
2965
- ThmExitOnFailure(hr, "Failed when querying TreeView/@FullRowSelect attribute.");
3085
3086
hr = XmlGetYesNoAttribute(pixn, L"HasButtons", &fValue);
2968
- if (E_NOTFOUND == hr)
2969
- {
2970
- hr = S_OK;
2971
- }
2972
- else if (fValue)
3087
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying TreeView/@HasButtons attribute.");
3088
+
3089
+ if (fXmlFound && fValue)
3090
{
3091
pControl->dwStyle |= TVS_HASBUTTONS;
3092
}
2976
- ThmExitOnFailure(hr, "Failed when querying TreeView/@HasButtons attribute.");
3093
3094
hr = XmlGetYesNoAttribute(pixn, L"AlwaysShowSelect", &fValue);
2979
- if (E_NOTFOUND == hr)
2980
- {
2981
- hr = S_OK;
2982
- }
2983
- else if (fValue)
3095
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying TreeView/@AlwaysShowSelect attribute.");
3096
+
3097
+ if (fXmlFound && fValue)
3098
{
3099
pControl->dwStyle |= TVS_SHOWSELALWAYS;
3100
}
2987
- ThmExitOnFailure(hr, "Failed when querying TreeView/@AlwaysShowSelect attribute.");
3101
3102
hr = XmlGetYesNoAttribute(pixn, L"LinesAtRoot", &fValue);
2990
- if (E_NOTFOUND == hr)
2991
- {
2992
- hr = S_OK;
2993
- }
2994
- else if (fValue)
3103
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying TreeView/@LinesAtRoot attribute.");
3104
+
3105
+ if (fXmlFound && fValue)
3106
{
3107
pControl->dwStyle |= TVS_LINESATROOT;
3108
}
2998
- ThmExitOnFailure(hr, "Failed when querying TreeView/@LinesAtRoot attribute.");
3109
3110
hr = XmlGetYesNoAttribute(pixn, L"HasLines", &fValue);
3001
- if (E_NOTFOUND == hr)
3002
- {
3003
- hr = S_OK;
3004
- }
3005
- else if (fValue)
3111
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed when querying TreeView/@HasLines attribute.");
3112
+
3113
+ if (fXmlFound && fValue)
3114
{
3115
pControl->dwStyle |= TVS_HASLINES;
3116
}
3009
- ThmExitOnFailure(hr, "Failed when querying TreeView/@HasLines attribute.");
3117
}
3118
3119
LExit:
@@ -3188,7 +3295,8 @@ static HRESULT ParseColumns(
3295
IXMLDOMNodeList* pixnl = NULL;
3296
IXMLDOMNode* pixnChild = NULL;
3297
BSTR bstrText = NULL;
3191
- DWORD dwValue = 0;
3298
+ int nValue = 0;
3299
+ BOOL fXmlFound = FALSE;
3300
3301
hr = XmlSelectNodes(pixn, L"Column", &pixnl);
3302
ThmExitOnFailure(hr, "Failed to select child column nodes.");
@@ -3209,21 +3317,18 @@ static HRESULT ParseColumns(
3317
hr = XmlGetText(pixnChild, &bstrText);
3318
ThmExitOnFailure(hr, "Failed to get inner text of column element.");
3319
3212
- hr = XmlGetAttributeNumber(pixnChild, L"Width", &dwValue);
3213
- if (S_FALSE == hr)
3320
+ hr = GetAttributeCoordinateOrDimension(pixnChild, L"Width", &nValue);
3321
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get column width attribute.");
3322
+
3323
+ if (!fXmlFound)
3324
{
3215
- dwValue = 100;
3325
+ nValue = 100;
3326
}
3217
- ThmExitOnFailure(hr, "Failed to get column width attribute.");
3327
3219
- pColumn->nBaseWidth = pColumn->nDefaultDpiBaseWidth = dwValue;
3328
+ pColumn->nBaseWidth = pColumn->nDefaultDpiBaseWidth = nValue;
3329
3221
- hr = XmlGetYesNoAttribute(pixnChild, L"Expands", reinterpret_cast<BOOL*>(&pColumn->fExpands));
3222
- if (E_NOTFOUND == hr)
3223
- {
3224
- hr = S_OK;
3225
- }
3226
- ThmExitOnFailure(hr, "Failed to get expands attribute.");
3330
+ hr = XmlGetYesNoAttribute(pixnChild, L"Expands", &pColumn->fExpands);
3331
+ ThmExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get expands attribute.");
3332
3333
hr = StrAllocString(&pColumn->pszName, bstrText, 0);
3334
ThmExitOnFailure(hr, "Failed to copy column name.");
@@ -3305,7 +3410,7 @@ static HRESULT ParseRadioButtons(
3410
pControl->type = THEME_CONTROL_TYPE_RADIOBUTTON;
3411
*pcControls += 1;
3412
3308
- hr = ParseControl(hModule, wzRelativePath, pixnChild, pTheme, pControl, pPage);
3413
+ hr = ParseControl(hModule, wzRelativePath, pixnChild, L"RadioButton", pTheme, pControl, pPage);
3414
ThmExitOnFailure(hr, "Failed to parse control.");
3415
3416
if (fFirst)
@@ -3472,7 +3577,7 @@ static HRESULT ParseTooltips(
3577
__in IXMLDOMNode* pixn,
3578
__in THEME_CONTROL* pControl,
3579
__inout BOOL* pfAnyChildren
3475
-)
3580
+ )
3581
{
3582
HRESULT hr = S_OK;
3583
IXMLDOMNode* pixnChild = NULL;
@@ -3503,6 +3608,32 @@ LExit:
3608
}
3609
3610
3611
+static HRESULT ParseUnexpectedAttribute(
3612
+ __in IXMLDOMNode* pixn,
3613
+ __in_z LPCWSTR wzElementName,
3614
+ __in_z LPCWSTR wzAttribute
3615
+ )
3616
+{
3617
+ HRESULT hr = S_OK;
3618
+ BSTR bstr = NULL;
3619
+
3620
+ hr = XmlGetAttribute(pixn, wzAttribute, &bstr);
3621
+ ThmExitOnFailure(hr, "Failed to get attribute %ls/@%ls", wzElementName, wzAttribute);
3622
+
3623
+ if (S_OK == hr)
3624
+ {
3625
+ ThmExitOnRootFailure(hr = E_INVALIDDATA, "Element '%ls' has unexpected attribute '%ls', value: %ls.", wzElementName, wzAttribute, bstr);
3626
+ }
3627
+
3628
+ hr = S_OK;
3629
+
3630
+LExit:
3631
+ ReleaseBSTR(bstr);
3632
+
3633
+ return hr;
3634
+}
3635
+
3636
+
3637
static HRESULT ParseNotes(
3638
__in IXMLDOMNode* pixn,
3639
__in THEME_CONTROL* pControl,
src/libs/dutil/WixToolset.DUtil/xmlutil.cpp
+113
-8
@@ -793,13 +793,13 @@ LExit:
793
794
795
/********************************************************************
796
- XmlGetAttributeLargeNumber
796
+ XmlGetAttributeUInt16
797
798
*********************************************************************/
799
-extern "C" HRESULT DAPI XmlGetAttributeLargeNumber(
799
+extern "C" HRESULT DAPI XmlGetAttributeUInt16(
800
__in IXMLDOMNode* pixnNode,
801
__in_z LPCWSTR pwzAttribute,
802
- __out DWORD64* pdw64Value
802
+ __out WORD* pwValue
803
)
804
{
805
HRESULT hr = S_OK;
@@ -810,15 +810,120 @@ extern "C" HRESULT DAPI XmlGetAttributeLargeNumber(
810
811
if (S_OK == hr)
812
{
813
- LONGLONG ll = 0;
814
- hr = StrStringToInt64(bstrValue, 0, &ll);
815
- XmlExitOnFailure(hr, "Failed to treat attribute value as number.");
813
+ WORD w = 0;
814
+ hr = StrStringToUInt16(bstrValue, 0, &w);
815
+ XmlExitOnFailure(hr, "Failed to treat attribute value as UInt16.");
816
817
- *pdw64Value = ll;
817
+ *pwValue = w;
818
}
819
else
820
{
821
- *pdw64Value = 0;
821
+ *pwValue = 0;
822
+ }
823
+
824
+LExit:
825
+ ReleaseBSTR(bstrValue);
826
+ return hr;
827
+}
828
+
829
+
830
+/********************************************************************
831
+ XmlGetAttributeInt32
832
+
833
+*********************************************************************/
834
+extern "C" HRESULT DAPI XmlGetAttributeInt32(
835
+ __in IXMLDOMNode* pixnNode,
836
+ __in_z LPCWSTR pwzAttribute,
837
+ __out int* piValue
838
+ )
839
+{
840
+ HRESULT hr = S_OK;
841
+ BSTR bstrValue = NULL;
842
+
843
+ hr = XmlGetAttribute(pixnNode, pwzAttribute, &bstrValue);
844
+ XmlExitOnFailure(hr, "failed XmlGetAttribute");
845
+
846
+ if (S_OK == hr)
847
+ {
848
+ int i = 0;
849
+ hr = StrStringToInt32(bstrValue, 0, &i);
850
+ XmlExitOnFailure(hr, "Failed to treat attribute value as Int32.");
851
+
852
+ *piValue = i;
853
+ }
854
+ else
855
+ {
856
+ *piValue = 0;
857
+ }
858
+
859
+LExit:
860
+ ReleaseBSTR(bstrValue);
861
+ return hr;
862
+}
863
+
864
+
865
+/********************************************************************
866
+ XmlGetAttributeUInt32
867
+
868
+*********************************************************************/
869
+extern "C" HRESULT DAPI XmlGetAttributeUInt32(
870
+ __in IXMLDOMNode* pixnNode,
871
+ __in_z LPCWSTR pwzAttribute,
872
+ __out DWORD* pdwValue
873
+ )
874
+{
875
+ HRESULT hr = S_OK;
876
+ BSTR bstrValue = NULL;
877
+
878
+ hr = XmlGetAttribute(pixnNode, pwzAttribute, &bstrValue);
879
+ XmlExitOnFailure(hr, "failed XmlGetAttribute");
880
+
881
+ if (S_OK == hr)
882
+ {
883
+ UINT dw = 0;
884
+ hr = StrStringToUInt32(bstrValue, 0, &dw);
885
+ XmlExitOnFailure(hr, "Failed to treat attribute value as UInt32.");
886
+
887
+ *pdwValue = dw;
888
+ }
889
+ else
890
+ {
891
+ *pdwValue = 0;
892
+ }
893
+
894
+LExit:
895
+ ReleaseBSTR(bstrValue);
896
+ return hr;
897
+}
898
+
899
+
900
+/********************************************************************
901
+ XmlGetAttributeUInt64
902
+
903
+*********************************************************************/
904
+extern "C" HRESULT DAPI XmlGetAttributeUInt64(
905
+ __in IXMLDOMNode* pixnNode,
906
+ __in_z LPCWSTR pwzAttribute,
907
+ __out DWORD64* pqwValue
908
+ )
909
+{
910
+ HRESULT hr = S_OK;
911
+ BSTR bstrValue = NULL;
912
+
913
+ hr = XmlGetAttribute(pixnNode, pwzAttribute, &bstrValue);
914
+ XmlExitOnFailure(hr, "failed XmlGetAttribute");
915
+
916
+ if (S_OK == hr)
917
+ {
918
+ DWORD64 qw = 0;
919
+ hr = StrStringToUInt64(bstrValue, 0, &qw);
920
+ XmlExitOnFailure(hr, "Failed to treat attribute value as UInt64.");
921
+
922
+ *pqwValue = qw;
923
+ }
924
+ else
925
+ {
926
+ *pqwValue = 0;
927
}
928
929
LExit:
src/libs/dutil/WixToolset.DUtil/xsd/thmutil.xsd
deleted
-1188
@@ -1,1188 +0,0 @@
1
-<?xml version="1.0" encoding="utf-8"?>
2
-<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
-
4
-
5
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
6
- xmlns:xse="http://wixtoolset.org/schemas/XmlSchemaExtension"
7
- xmlns:html="http://www.w3.org/1999/xhtml"
8
- targetNamespace="http://wixtoolset.org/schemas/v4/thmutil"
9
- xmlns="http://wixtoolset.org/schemas/v4/thmutil">
10
- <xs:annotation>
11
- <xs:documentation>
12
- Schema for describing Theme files processed by thmutil.
13
- </xs:documentation>
14
- </xs:annotation>
15
-
16
- <xs:import namespace="http://www.w3.org/1999/xhtml" />
17
-
18
- <xs:element name="Theme">
19
- <xs:annotation>
20
- <xs:documentation>
21
- This is the top-level container element for every thmutil Theme file.
22
- </xs:documentation>
23
- </xs:annotation>
24
- <xs:complexType>
25
- <xs:sequence>
26
- <xs:element ref="Font" maxOccurs="unbounded" />
27
- <xs:element ref="Window" />
28
- </xs:sequence>
29
- <xs:attribute name="ImageFile" type="xs:string">
30
- <xs:annotation>
31
- <xs:documentation>
32
- Relative path to an image file that can serve as a single source for images in the rest of the theme.
33
- This image is referenced by controls using the SourceX and SourceY attributes.
34
- Mutually exclusive with the ImageResource attribute.
35
- </xs:documentation>
36
- </xs:annotation>
37
- </xs:attribute>
38
- <xs:attribute name="ImageResource" type="xs:string">
39
- <xs:annotation>
40
- <xs:documentation>
41
- Identifier that references an image resource in the module for the window.
42
- Mutually exclusive with the ImageFile attribute.
43
- </xs:documentation>
44
- </xs:annotation>
45
- </xs:attribute>
46
- </xs:complexType>
47
- </xs:element>
48
-
49
- <xs:element name="Font">
50
- <xs:annotation>
51
- <xs:documentation>Defines a font including the size and color.</xs:documentation>
52
- </xs:annotation>
53
- <xs:complexType>
54
- <xs:simpleContent>
55
- <xs:extension base="xs:string">
56
- <xs:annotation>
57
- <xs:documentation>Name of the font face (required).</xs:documentation>
58
- </xs:annotation>
59
- <xs:attribute name="Id" type="xs:nonNegativeInteger" use="required">
60
- <xs:annotation>
61
- <xs:documentation>Numeric identifier for the font. Due to limitations in thmutil the first Font must start with "0" and each subsequent Font must increment the Id by 1. Failure to ensure the Font identifiers follow this strict ordering will create unexpected behavior or crashes.</xs:documentation>
62
- </xs:annotation>
63
- </xs:attribute>
64
- <xs:attribute name="Height" type="xs:int" use="required">
65
- <xs:annotation>
66
- <xs:documentation>Font size. Use negative numbers to specify the font in pixels.</xs:documentation>
67
- </xs:annotation>
68
- </xs:attribute>
69
- <xs:attribute name="Weight" type="xs:nonNegativeInteger">
70
- <xs:annotation>
71
- <xs:documentation>Font weight.</xs:documentation>
72
- </xs:annotation>
73
- </xs:attribute>
74
- <xs:attribute name="Foreground" type="FontColorType">
75
- <xs:annotation>
76
- <xs:documentation>
77
- A system color id or a hexadecimal value representing BGR foreground color of the font.
78
- "ffffff" is white, "ff0000" is pure blue, "00ff00" is pure green, "0000ff" is pure red, and "000000" is black.
79
- If this attribute is absent the foreground will be transparent.
80
- Supported system color ids are: btnface, btntext, graytext, highlight, highlighttext, hotlight, window, and windowtext.
81
- </xs:documentation>
82
- </xs:annotation>
83
- </xs:attribute>
84
- <xs:attribute name="Background" type="FontColorType">
85
- <xs:annotation>
86
- <xs:documentation>
87
- A system color id or a hexadecimal value representing BGR background color of the font.
88
- "ffffff" is white, "ff0000" is pure blue, "00ff00" is pure green, "0000ff" is pure red, and "000000" is black.
89
- If this attribute is absent the background will be transparent.
90
- Supported system color ids are: btnface, btntext, graytext, highlight, highlighttext, hotlight, window, and windowtext.
91
- </xs:documentation>
92
- </xs:annotation>
93
- </xs:attribute>
94
- <xs:attribute name="Underline" type="YesNoType">
95
- <xs:annotation>
96
- <xs:documentation>Specifies whether the font is underlined.</xs:documentation>
97
- </xs:annotation>
98
- </xs:attribute>
99
- </xs:extension>
100
- </xs:simpleContent>
101
- </xs:complexType>
102
- </xs:element>
103
-
104
- <xs:element name="ImageList">
105
- <xs:annotation>
106
- <xs:documentation>List of images which can be shared between multiple controls.</xs:documentation>
107
- </xs:annotation>
108
- <xs:complexType>
109
- <xs:choice maxOccurs="unbounded">
110
- <xs:element ref="Image" />
111
- </xs:choice>
112
- <xs:attribute name="Name" type="xs:string" use="required">
113
- <xs:annotation>
114
- <xs:documentation>
115
- Name of the ImageList, to be referenced by other controls.
116
- </xs:documentation>
117
- </xs:annotation>
118
- </xs:attribute>
119
- </xs:complexType>
120
- </xs:element>
121
-
122
- <xs:element name="Page">
123
- <xs:annotation>
124
- <xs:documentation>Named set of controls that can be shown and hidden collectively.</xs:documentation>
125
- </xs:annotation>
126
- <xs:complexType>
127
- <xs:group ref="ControlElements" maxOccurs="unbounded"/>
128
- <xs:attribute name="Name" type="xs:string">
129
- <xs:annotation>
130
- <xs:documentation>
131
- Optional name for the page.
132
- </xs:documentation>
133
- </xs:annotation>
134
- </xs:attribute>
135
- </xs:complexType>
136
- </xs:element>
137
-
138
- <xs:element name="Window">
139
- <xs:annotation>
140
- <xs:documentation>Defines the overall look of the main window.</xs:documentation>
141
- </xs:annotation>
142
- <xs:complexType>
143
- <xs:choice minOccurs="0" maxOccurs="unbounded">
144
- <xs:element ref="ImageList" />
145
- <xs:element ref="Page" />
146
- <xs:group ref="ControlElements" minOccurs="0" maxOccurs="unbounded" />
147
- </xs:choice>
148
- <xs:attribute name="AutoResize" type="YesNoType">
149
- <xs:annotation>
150
- <xs:documentation>Specifies whether the ThmUtil default window proc should process WM_SIZE and WM_SIZING events.</xs:documentation>
151
- </xs:annotation>
152
- </xs:attribute>
153
- <xs:attribute name="Caption" type="xs:string">
154
- <xs:annotation>
155
- <xs:documentation>
156
- Caption for the window.
157
- This is required if not using the StringId attribute.
158
- </xs:documentation>
159
- </xs:annotation>
160
- </xs:attribute>
161
- <xs:attribute name="FontId" type="xs:nonNegativeInteger" use="required">
162
- <xs:annotation>
163
- <xs:documentation>Numeric identifier to the Font element that serves as the default font for the window.</xs:documentation>
164
- </xs:annotation>
165
- </xs:attribute>
166
- <xs:attribute name="Height" type="xs:positiveInteger" use="required">
167
- <xs:annotation>
168
- <xs:documentation>Height of the window's client area.</xs:documentation>
169
- </xs:annotation>
170
- </xs:attribute>
171
- <xs:attribute name="HexStyle" type="xs:hexBinary">
172
- <xs:annotation>
173
- <xs:documentation>
174
- Hexadecimal window style. If this is not specified the default value is: WS_OVERLAPPED | WS_VISIBLE | WS_MINIMIZEBOX | WS_SYSMENU.
175
- If SourceX and SourceY are specified, then WS_OVERLAPPED is replaced with WS_POPUP.
176
- </xs:documentation>
177
- </xs:annotation>
178
- </xs:attribute>
179
- <xs:attribute name="IconFile" type="xs:string">
180
- <xs:annotation>
181
- <xs:documentation>Relative path to an icon file for the window. Mutually exclusive with IconResource and SourceX and SourceY attributes.</xs:documentation>
182
- </xs:annotation>
183
- </xs:attribute>
184
- <xs:attribute name="IconResource" type="xs:string">
185
- <xs:annotation>
186
- <xs:documentation>
187
- Identifier that references an icon resource in the module for the icon for the window.
188
- Mutually exclusive with IconFile and SourceX and SourceY attributes.
189
- </xs:documentation>
190
- </xs:annotation>
191
- </xs:attribute>
192
- <xs:attribute name="MinimumHeight" type="xs:positiveInteger">
193
- <xs:annotation>
194
- <xs:documentation>Minimum height of the window. Only functions if AutoResize is enabled.</xs:documentation>
195
- </xs:annotation>
196
- </xs:attribute>
197
- <xs:attribute name="MinimumWidth" type="xs:positiveInteger">
198
- <xs:annotation>
199
- <xs:documentation>Minimum width of the window. Only functions if AutoResize is enabled.</xs:documentation>
200
- </xs:annotation>
201
- </xs:attribute>
202
- <xs:attribute name="SourceX" type="xs:nonNegativeInteger">
203
- <xs:annotation>
204
- <xs:documentation>X offset of the window background in the Theme/@ImageFile. Mutually exclusive with IconFile and IconResource.</xs:documentation>
205
- </xs:annotation>
206
- </xs:attribute>
207
- <xs:attribute name="SourceY" type="xs:nonNegativeInteger">
208
- <xs:annotation>
209
- <xs:documentation>Y offset of the window background in the Theme/@ImageFile. Mutually exclusive with IconFile and IconResource.</xs:documentation>
210
- </xs:annotation>
211
- </xs:attribute>
212
- <xs:attribute name="StringId" type="xs:nonNegativeInteger">
213
- <xs:annotation>
214
- <xs:documentation>
215
- Identifier that references a string resource in the module to define the window caption.
216
- Mutually exclusive with the Caption attribute.
217
- </xs:documentation>
218
- </xs:annotation>
219
- </xs:attribute>
220
- <xs:attribute name="Width" type="xs:positiveInteger" use="required">
221
- <xs:annotation>
222
- <xs:documentation>Width of the window's client area.</xs:documentation>
223
- </xs:annotation>
224
- </xs:attribute>
225
- </xs:complexType>
226
- </xs:element>
227
-
228
- <xs:element name="Billboard">
229
- <xs:annotation>
230
- <xs:documentation>Defines a control that rotates through a set of images on a specified interval.</xs:documentation>
231
- </xs:annotation>
232
- <xs:complexType>
233
- <xs:sequence>
234
- <xs:element ref="Image" />
235
- </xs:sequence>
236
- <xs:attributeGroup ref="CommonControlAttributes" />
237
- <xs:attribute name="Interval" type="xs:positiveInteger">
238
- <xs:annotation>
239
- <xs:documentation>
240
- Specifies the time to wait before showing the next image, in milliseconds.
241
- </xs:documentation>
242
- </xs:annotation>
243
- </xs:attribute>
244
- <xs:attribute name="Loop" type="YesNoType">
245
- <xs:annotation>
246
- <xs:documentation>Specifies whether the billboard should loop through the images infinitely.</xs:documentation>
247
- </xs:annotation>
248
- </xs:attribute>
249
- </xs:complexType>
250
- </xs:element>
251
-
252
- <xs:element name="Button">
253
- <xs:annotation>
254
- <xs:documentation>Defines a button.</xs:documentation>
255
- </xs:annotation>
256
- <xs:complexType mixed="true">
257
- <xs:annotation>
258
- <xs:documentation>
259
- Text to display in the button.
260
- Mutually exclusive with the StringId attribute and child Text elements.
261
- </xs:documentation>
262
- </xs:annotation>
263
- <xs:choice minOccurs="0" maxOccurs="unbounded">
264
- <xs:annotation>
265
- <xs:documentation>
266
- If multiple Action elements are given, the conditions should be mutually exclusive (when multiple conditions are true, the behavior is undefined and could be changed at any time).
267
- If none of the conditions of the Action elements are true, then it uses the Action element without the Condition attribute.
268
- </xs:documentation>
269
- </xs:annotation>
270
- <xs:element ref="BrowseDirectoryAction" />
271
- <xs:element ref="ChangePageAction" />
272
- <xs:element ref="CloseWindowAction" />
273
- <xs:element ref="Text" />
274
- <xs:element ref="Tooltip" maxOccurs="1" />
275
- </xs:choice>
276
- <xs:attributeGroup ref="CommonControlAttributes" />
277
- <xs:attribute name="FontId" type="xs:nonNegativeInteger" use="required">
278
- <xs:annotation>
279
- <xs:documentation>Numeric identifier to the Font element that serves as the font for the control. Only valid when using graphic buttons.</xs:documentation>
280
- </xs:annotation>
281
- </xs:attribute>
282
- <xs:attribute name="HoverFontId" type="xs:nonNegativeInteger">
283
- <xs:annotation>
284
- <xs:documentation>Numeric identifier to the Font element that serves as the font when the control is hovered over. Only valid when using graphic buttons.</xs:documentation>
285
- </xs:annotation>
286
- </xs:attribute>
287
- <xs:attribute name="ImageFile" type="xs:string">
288
- <xs:annotation>
289
- <xs:documentation>
290
- Relative path to an image file to define a graphic button.
291
- The image must be 4x the height to represent the button in 4 states: unselected, hover, selected, focused.
292
- Mutually exclusive with ImageResource and SourceX and SourceY attributes.
293
- </xs:documentation>
294
- </xs:annotation>
295
- </xs:attribute>
296
- <xs:attribute name="ImageResource" type="xs:string">
297
- <xs:annotation>
298
- <xs:documentation>
299
- Identifier that references an image resource in the module to define a graphic button.
300
- The image must be 4x the height to represent the button in 4 states: unselected, hover, selected, focused.
301
- Mutually exclusive with ImageFile and SourceX and SourceY attributes.
302
- </xs:documentation>
303
- </xs:annotation>
304
- </xs:attribute>
305
- <xs:attribute name="SelectedFontId" type="xs:nonNegativeInteger">
306
- <xs:annotation>
307
- <xs:documentation>Numeric identifier to the Font element that serves as the font when the control is selected. Only valid when using graphic buttons.</xs:documentation>
308
- </xs:annotation>
309
- </xs:attribute>
310
- <xs:attribute name="StringId" type="xs:nonNegativeInteger">
311
- <xs:annotation>
312
- <xs:documentation>
313
- Identifier that references a string resource in the module to define the text for the control.
314
- </xs:documentation>
315
- </xs:annotation>
316
- </xs:attribute>
317
- </xs:complexType>
318
- </xs:element>
319
-
320
- <xs:element name="BrowseDirectoryAction">
321
- <xs:annotation>
322
- <xs:documentation>
323
- When the button is pressed, a directory browser dialog is shown.
324
- </xs:documentation>
325
- </xs:annotation>
326
- <xs:complexType>
327
- <xs:attribute name="Condition" type="xs:string">
328
- <xs:annotation>
329
- <xs:documentation>
330
- The condition that determines if the parent control will execute this action.
331
- </xs:documentation>
332
- </xs:annotation>
333
- </xs:attribute>
334
- <xs:attribute name="VariableName" type="xs:string" use="required">
335
- <xs:annotation>
336
- <xs:documentation>
337
- The name of the variable to update when the user selects a directory from the dialog.
338
- </xs:documentation>
339
- </xs:annotation>
340
- </xs:attribute>
341
- </xs:complexType>
342
- </xs:element>
343
-
344
- <xs:element name="ChangePageAction">
345
- <xs:annotation>
346
- <xs:documentation>
347
- When the button is pressed, the specified page is shown.
348
- </xs:documentation>
349
- </xs:annotation>
350
- <xs:complexType>
351
- <xs:attribute name="Cancel" type="YesNoType">
352
- <xs:annotation>
353
- <xs:documentation>
354
- When set to 'yes', none of the variable changes made on the current page are saved.
355
- </xs:documentation>
356
- </xs:annotation>
357
- </xs:attribute>
358
- <xs:attribute name="Condition" type="xs:string">
359
- <xs:annotation>
360
- <xs:documentation>
361
- The condition that determines if the parent control will execute this action.
362
- </xs:documentation>
363
- </xs:annotation>
364
- </xs:attribute>
365
- <xs:attribute name="Page" type="xs:string" use="required">
366
- <xs:annotation>
367
- <xs:documentation>
368
- The Name of the Page to show.
369
- </xs:documentation>
370
- </xs:annotation>
371
- </xs:attribute>
372
- </xs:complexType>
373
- </xs:element>
374
-
375
- <xs:element name="CloseWindowAction">
376
- <xs:annotation>
377
- <xs:documentation>
378
- When the button is pressed, the WM_CLOSE message is sent to the window.
379
- </xs:documentation>
380
- </xs:annotation>
381
- <xs:complexType>
382
- <xs:attribute name="Condition" type="xs:string">
383
- <xs:annotation>
384
- <xs:documentation>
385
- The condition that determines if the parent control will execute this action.
386
- </xs:documentation>
387
- </xs:annotation>
388
- </xs:attribute>
389
- </xs:complexType>
390
- </xs:element>
391
-
392
- <xs:element name="Checkbox">
393
- <xs:annotation>
394
- <xs:documentation>Defines a checkbox.</xs:documentation>
395
- </xs:annotation>
396
- <xs:complexType mixed="true">
397
- <xs:annotation>
398
- <xs:documentation>
399
- Text to display beside the checkbox.
400
- Mutually exclusive with the StringId attribute and child Text elements.
401
- </xs:documentation>
402
- </xs:annotation>
403
- <xs:choice minOccurs="0" maxOccurs="unbounded">
404
- <xs:element ref="Text" />
405
- <xs:element ref="Tooltip" maxOccurs="1" />
406
- </xs:choice>
407
- <xs:attributeGroup ref="CommonControlAttributes" />
408
- <xs:attribute name="FontId" type="xs:nonNegativeInteger" use="required">
409
- <xs:annotation>
410
- <xs:documentation>Numeric identifier to the Font element that serves as the font for the control.</xs:documentation>
411
- </xs:annotation>
412
- </xs:attribute>
413
- <xs:attribute name="StringId" type="xs:nonNegativeInteger">
414
- <xs:annotation>
415
- <xs:documentation>
416
- Identifier that references a string resource in the module to define the text for the control.
417
- </xs:documentation>
418
- </xs:annotation>
419
- </xs:attribute>
420
- </xs:complexType>
421
- </xs:element>
422
-
423
- <xs:element name="Combobox">
424
- <xs:annotation>
425
- <xs:documentation>Defines a combobox.</xs:documentation>
426
- </xs:annotation>
427
- <xs:complexType>
428
- <xs:attributeGroup ref="CommonControlAttributes" />
429
- <xs:attribute name="FontId" type="xs:nonNegativeInteger" use="required">
430
- <xs:annotation>
431
- <xs:documentation>Numeric identifier to the Font element that serves as the font for the control.</xs:documentation>
432
- </xs:annotation>
433
- </xs:attribute>
434
- </xs:complexType>
435
- </xs:element>
436
-
437
- <xs:element name="CommandLink">
438
- <xs:annotation>
439
- <xs:documentation>Defines a button.</xs:documentation>
440
- </xs:annotation>
441
- <xs:complexType mixed="true">
442
- <xs:annotation>
443
- <xs:documentation>
444
- Text to display in the button.
445
- Mutually exclusive with the StringId attribute and child Text elements.
446
- </xs:documentation>
447
- </xs:annotation>
448
- <xs:choice minOccurs="0" maxOccurs="unbounded">
449
- <xs:annotation>
450
- <xs:documentation>
451
- If multiple Action elements are given, the conditions should be mutually exclusive (when multiple conditions are true, the behavior is undefined and could be changed at any time).
452
- If none of the conditions of the Action elements are true, then it uses the Action element without the Condition attribute.
453
- </xs:documentation>
454
- </xs:annotation>
455
- <xs:element ref="BrowseDirectoryAction" />
456
- <xs:element ref="ChangePageAction" />
457
- <xs:element ref="CloseWindowAction" />
458
- <xs:element ref="Note" />
459
- <xs:element ref="Text" />
460
- </xs:choice>
461
- <xs:attributeGroup ref="CommonControlAttributes" />
462
- <xs:attribute name="FontId" type="xs:nonNegativeInteger" use="required">
463
- <xs:annotation>
464
- <xs:documentation>Numeric identifier to the Font element that serves as the font for the control. Only valid when using graphic buttons.</xs:documentation>
465
- </xs:annotation>
466
- </xs:attribute>
467
- <xs:attribute name="IconFile" type="xs:string">
468
- <xs:annotation>
469
- <xs:documentation>
470
- Relative path to an icon file to define a command link glyph.
471
- Mutually exclusive with ImageResource and SourceX and SourceY attributes.
472
- </xs:documentation>
473
- </xs:annotation>
474
- </xs:attribute>
475
- <xs:attribute name="IconResource" type="xs:string">
476
- <xs:annotation>
477
- <xs:documentation>
478
- Identifier that references an icon resource in the module to define a command link glyph.
479
- Mutually exclusive with ImageFile and SourceX and SourceY attributes.
480
- </xs:documentation>
481
- </xs:annotation>
482
- </xs:attribute>
483
- <xs:attribute name="ImageFile" type="xs:string">
484
- <xs:annotation>
485
- <xs:documentation>
486
- Relative path to an image file to define a command link glyph.
487
- Mutually exclusive with ImageResource and SourceX and SourceY attributes.
488
- </xs:documentation>
489
- </xs:annotation>
490
- </xs:attribute>
491
- <xs:attribute name="ImageResource" type="xs:string">
492
- <xs:annotation>
493
- <xs:documentation>
494
- Identifier that references an image resource in the module to define a command link glyph.
495
- Mutually exclusive with ImageFile and SourceX and SourceY attributes.
496
- </xs:documentation>
497
- </xs:annotation>
498
- </xs:attribute>
499
- <xs:attribute name="StringId" type="xs:nonNegativeInteger">
500
- <xs:annotation>
501
- <xs:documentation>
502
- Identifier that references a string resource in the module to define the text for the control.
503
- </xs:documentation>
504
- </xs:annotation>
505
- </xs:attribute>
506
- </xs:complexType>
507
- </xs:element>
508
-
509
- <xs:element name="Editbox">
510
- <xs:annotation>
511
- <xs:documentation>Defines an edit box.</xs:documentation>
512
- </xs:annotation>
513
- <xs:complexType>
514
- <xs:simpleContent>
515
- <xs:extension base="xs:string">
516
- <xs:annotation>
517
- <xs:documentation>
518
- Initial text for the control.
519
- Mutually exclusive with the StringId attribute.
520
- </xs:documentation>
521
- </xs:annotation>
522
- <xs:attributeGroup ref="CommonControlAttributes" />
523
- <xs:attribute name="FileSystemAutoComplete" type="YesNoType">
524
- <xs:annotation>
525
- <xs:documentation>Specifies whether the edit box should auto-complete with file system paths.</xs:documentation>
526
- </xs:annotation>
527
- </xs:attribute>
528
- <xs:attribute name="FontId" type="xs:nonNegativeInteger" use="required">
529
- <xs:annotation>
530
- <xs:documentation>Numeric identifier to the Font element that serves as the font for the control.</xs:documentation>
531
- </xs:annotation>
532
- </xs:attribute>
533
- <xs:attribute name="StringId" type="xs:nonNegativeInteger">
534
- <xs:annotation>
535
- <xs:documentation>
536
- Identifier that references a string resource in the module to define the initial text for the control.
537
- </xs:documentation>
538
- </xs:annotation>
539
- </xs:attribute>
540
- </xs:extension>
541
- </xs:simpleContent>
542
- </xs:complexType>
543
- </xs:element>
544
-
545
- <xs:element name="Hyperlink">
546
- <xs:annotation>
547
- <xs:documentation>Defines a hyperlink.</xs:documentation>
548
- </xs:annotation>
549
- <xs:complexType mixed="true">
550
- <xs:annotation>
551
- <xs:documentation>
552
- Text to display as the link.
553
- Mutually exclusive with the StringId attribute and child Text elements.
554
- </xs:documentation>
555
- </xs:annotation>
556
- <xs:choice minOccurs="0" maxOccurs="unbounded">
557
- <xs:element ref="Text" />
558
- <xs:element ref="Tooltip" maxOccurs="1" />
559
- </xs:choice>
560
- <xs:attributeGroup ref="CommonControlAttributes" />
561
- <xs:attribute name="FontId" type="xs:nonNegativeInteger" use="required">
562
- <xs:annotation>
563
- <xs:documentation>Numeric identifier to the Font element that serves as the unselected font.</xs:documentation>
564
- </xs:annotation>
565
- </xs:attribute>
566
- <xs:attribute name="HoverFontId" type="xs:nonNegativeInteger" use="required">
567
- <xs:annotation>
568
- <xs:documentation>Numeric identifier to the Font element that serves as the font when the control is hovered over.</xs:documentation>
569
- </xs:annotation>
570
- </xs:attribute>
571
- <xs:attribute name="SelectedFontId" type="xs:nonNegativeInteger" use="required">
572
- <xs:annotation>
573
- <xs:documentation>Numeric identifier to the Font element that serves as the font when the control is selected.</xs:documentation>
574
- </xs:annotation>
575
- </xs:attribute>
576
- <xs:attribute name="StringId" type="xs:nonNegativeInteger">
577
- <xs:annotation>
578
- <xs:documentation>
579
- Identifier that references a string resource in the module to define the text for the control.
580
- </xs:documentation>
581
- </xs:annotation>
582
- </xs:attribute>
583
- </xs:complexType>
584
- </xs:element>
585
-
586
- <xs:element name="Hypertext">
587
- <xs:annotation>
588
- <xs:documentation>Defines a text block with support for HTML <a> tags.</xs:documentation>
589
- </xs:annotation>
590
- <xs:complexType mixed="true">
591
- <xs:annotation>
592
- <xs:documentation>
593
- Text to display as the link.
594
- Use HTML <a href="URL"> to create a link.
595
- Mutually exclusive with the StringId attribute and child Text elements.
596
- </xs:documentation>
597
- </xs:annotation>
598
- <xs:choice minOccurs="0" maxOccurs="unbounded">
599
- <xs:element ref="Text" />
600
- <xs:element ref="Tooltip" maxOccurs="1" />
601
- </xs:choice>
602
- <xs:attributeGroup ref="CommonControlAttributes" />
603
- <xs:attribute name="FontId" type="xs:nonNegativeInteger" use="required">
604
- <xs:annotation>
605
- <xs:documentation>Numeric identifier to the Font element that serves as the font for the control.</xs:documentation>
606
- </xs:annotation>
607
- </xs:attribute>
608
- <xs:attribute name="StringId" type="xs:nonNegativeInteger">
609
- <xs:annotation>
610
- <xs:documentation>
611
- Identifier that references a string resource in the module to define the text for the control.
612
- </xs:documentation>
613
- </xs:annotation>
614
- </xs:attribute>
615
- </xs:complexType>
616
- </xs:element>
617
-
618
- <xs:element name="Image">
619
- <xs:annotation>
620
- <xs:documentation>Defines an image for an ImageList or Billboard.</xs:documentation>
621
- </xs:annotation>
622
- <xs:complexType>
623
- <xs:attribute name="ImageFile" type="xs:string">
624
- <xs:annotation>
625
- <xs:documentation>Relative path to an image file. Mutually exclusive with ImageResource.</xs:documentation>
626
- </xs:annotation>
627
- </xs:attribute>
628
- <xs:attribute name="ImageResource" type="xs:string">
629
- <xs:annotation>
630
- <xs:documentation>Identifier that references an image resource in the module. Mutually exclusive with ImageFile.</xs:documentation>
631
- </xs:annotation>
632
- </xs:attribute>
633
- </xs:complexType>
634
- </xs:element>
635
-
636
- <xs:element name="ImageControl">
637
- <xs:annotation>
638
- <xs:documentation>Defines an image.</xs:documentation>
639
- </xs:annotation>
640
- <xs:complexType>
641
- <xs:attributeGroup ref="CommonControlAttributes" />
642
- <xs:attribute name="ImageFile" type="xs:string">
643
- <xs:annotation>
644
- <xs:documentation>Relative path to an image file. Mutually exclusive with ImageResource and SourceX and SourceY attributes.</xs:documentation>
645
- </xs:annotation>
646
- </xs:attribute>
647
- <xs:attribute name="ImageResource" type="xs:string">
648
- <xs:annotation>
649
- <xs:documentation>Identifier that references an image resource in the module. Mutually exclusive with ImageFile and SourceX and SourceY attributes.</xs:documentation>
650
- </xs:annotation>
651
- </xs:attribute>
652
- </xs:complexType>
653
- </xs:element>
654
-
655
- <xs:element name="Label">
656
- <xs:annotation>
657
- <xs:documentation>Defines a label.</xs:documentation>
658
- </xs:annotation>
659
- <xs:complexType mixed="true">
660
- <xs:annotation>
661
- <xs:documentation>
662
- Text for the label to display.
663
- Mutually exclusive with the StringId attribute and child Text elements.
664
- </xs:documentation>
665
- </xs:annotation>
666
- <xs:choice minOccurs="0" maxOccurs="unbounded">
667
- <xs:element ref="Text" />
668
- <xs:element ref="Tooltip" maxOccurs="1" />
669
- </xs:choice>
670
- <xs:attributeGroup ref="CommonControlAttributes" />
671
- <xs:attribute name="Center" type="YesNoType" use="optional">
672
- <xs:annotation>
673
- <xs:documentation>Specifies whether the text should be centered horizontally in the width of the control. Default is "no".</xs:documentation>
674
- </xs:annotation>
675
- </xs:attribute>
676
- <xs:attribute name="DisablePrefix" type="YesNoType" use="optional">
677
- <xs:annotation>
678
- <xs:documentation>By default ampersands (&) in the text will underline the next character and treat it as an accelerator key. Set this attribute to "yes" to disable that behavior. Default is "no".</xs:documentation>
679
- </xs:annotation>
680
- </xs:attribute>
681
- <xs:attribute name="FontId" type="xs:nonNegativeInteger" use="required">
682
- <xs:annotation>
683
- <xs:documentation>Numeric identifier to the Font element that serves as the font for the control.</xs:documentation>
684
- </xs:annotation>
685
- </xs:attribute>
686
- <xs:attribute name="StringId" type="xs:nonNegativeInteger">
687
- <xs:annotation>
688
- <xs:documentation>
689
- Identifier that references a string resource in the module to define the text for the label.
690
- </xs:documentation>
691
- </xs:annotation>
692
- </xs:attribute>
693
- </xs:complexType>
694
- </xs:element>
695
-
696
- <xs:element name="ListView">
697
- <xs:annotation>
698
- <xs:documentation>Defines a listview.</xs:documentation>
699
- </xs:annotation>
700
- <xs:complexType>
701
- <xs:choice maxOccurs="unbounded">
702
- <xs:element ref="Column" />
703
- </xs:choice>
704
- <xs:attributeGroup ref="CommonControlAttributes" />
705
- <xs:attribute name="FontId" type="xs:nonNegativeInteger">
706
- <xs:annotation>
707
- <xs:documentation>Numeric identifier to the Font element that serves as the default font for the ListView.</xs:documentation>
708
- </xs:annotation>
709
- </xs:attribute>
710
- <xs:attribute name="HexExtendedStyle" type="xs:hexBinary">
711
- <xs:annotation>
712
- <xs:documentation>Hexadecimal extended window style.</xs:documentation>
713
- </xs:annotation>
714
- </xs:attribute>
715
- <xs:attribute name="ImageList" type="xs:string">
716
- <xs:annotation>
717
- <xs:documentation>
718
- The name of the ImageList to assign to this listview with type LVSIL_NORMAL.
719
- </xs:documentation>
720
- </xs:annotation>
721
- </xs:attribute>
722
- <xs:attribute name="ImageListSmall" type="xs:string">
723
- <xs:annotation>
724
- <xs:documentation>
725
- The name of the ImageList to assign to this listview with type LVSIL_SMALL.
726
- </xs:documentation>
727
- </xs:annotation>
728
- </xs:attribute>
729
- <xs:attribute name="ImageListState" type="xs:string">
730
- <xs:annotation>
731
- <xs:documentation>
732
- The name of the ImageList to assign to this listview with type LVSIL_STATE.
733
- </xs:documentation>
734
- </xs:annotation>
735
- </xs:attribute>
736
- <xs:attribute name="ImageListGroupHeader" type="xs:string">
737
- <xs:annotation>
738
- <xs:documentation>
739
- The name of the ImageList to assign to this listview with type LVSIL_GROUPHEADER.
740
- </xs:documentation>
741
- </xs:annotation>
742
- </xs:attribute>
743
- </xs:complexType>
744
- </xs:element>
745
-
746
- <xs:element name="Note">
747
- <xs:annotation>
748
- <xs:documentation>
749
- Defines note text for a command link control based on an optional condition.
750
- If multiple Note elements are given for one control, the conditions should be mutually exclusive (when multiple conditions are true, the behavior is undefined and may be changed at any time).
751
- If none of the conditions of a control's Note elements are true, then it uses the text of the Note element without the Condition attribute.
752
- </xs:documentation>
753
- </xs:annotation>
754
- <xs:complexType>
755
- <xs:simpleContent>
756
- <xs:extension base="xs:string">
757
- <xs:annotation>
758
- <xs:documentation>
759
- Note text for the parent command link control.
760
- </xs:documentation>
761
- </xs:annotation>
762
- <xs:attribute name="Condition" type="xs:string">
763
- <xs:annotation>
764
- <xs:documentation>
765
- The condition that determines when the parent control will use this note text.
766
- </xs:documentation>
767
- </xs:annotation>
768
- </xs:attribute>
769
- </xs:extension>
770
- </xs:simpleContent>
771
- </xs:complexType>
772
- </xs:element>
773
-
774
- <xs:element name="Panel">
775
- <xs:annotation>
776
- <xs:documentation>Defines a collection of controls.</xs:documentation>
777
- </xs:annotation>
778
- <xs:complexType>
779
- <xs:group ref="ControlElements" maxOccurs="unbounded"/>
780
- <xs:attributeGroup ref="CommonControlAttributes" />
781
- </xs:complexType>
782
- </xs:element>
783
-
784
- <xs:element name="Progressbar">
785
- <xs:annotation>
786
- <xs:documentation>Defines a progress bar.</xs:documentation>
787
- </xs:annotation>
788
- <xs:complexType>
789
- <xs:attributeGroup ref="CommonControlAttributes" />
790
- <xs:attribute name="ImageFile" type="xs:string">
791
- <xs:annotation>
792
- <xs:documentation>Relative path to an image file for the control. The image must be 4 pixels wide: left pixel is the left side of progress bar, left middle pixel is progress used, right middle pixel is progress unused, right pixel is right side of progress bar. Mutually exclusive with ImageResource and SourceX and SourceY attributes.</xs:documentation>
793
- </xs:annotation>
794
- </xs:attribute>
795
- <xs:attribute name="ImageResource" type="xs:string">
796
- <xs:annotation>
797
- <xs:documentation>Identifier that references an image resource in the module for the control. The image must be 4 pixels wide: left pixel is the left side of progress bar, left middle pixel is progress used, right middle pixel is progress unused, right pixel is right side of progress bar. Mutually exclusive with ImageFile and SourceX and SourceY attributes.</xs:documentation>
798
- </xs:annotation>
799
- </xs:attribute>
800
- </xs:complexType>
801
- </xs:element>
802
-
803
- <xs:element name="RadioButton">
804
- <xs:annotation>
805
- <xs:documentation>Defines an individual radio button within a set of radio buttons.</xs:documentation>
806
- </xs:annotation>
807
- <xs:complexType mixed="true">
808
- <xs:annotation>
809
- <xs:documentation>
810
- Text to display beside the radio button.
811
- Mutually exclusive with the StringId attribute and child Text elements.
812
- </xs:documentation>
813
- </xs:annotation>
814
- <xs:choice minOccurs="0" maxOccurs="unbounded">
815
- <xs:element ref="Text" />
816
- <xs:element ref="Tooltip" maxOccurs="1" />
817
- </xs:choice>
818
- <xs:attributeGroup ref="CommonControlAttributes" />
819
- <xs:attribute name="FontId" type="xs:nonNegativeInteger" use="required">
820
- <xs:annotation>
821
- <xs:documentation>Numeric identifier to the Font element that serves as the font for the control.</xs:documentation>
822
- </xs:annotation>
823
- </xs:attribute>
824
- <xs:attribute name="StringId" type="xs:nonNegativeInteger">
825
- <xs:annotation>
826
- <xs:documentation>
827
- Identifier that references a string resource in the module to define the text for the control.
828
- </xs:documentation>
829
- </xs:annotation>
830
- </xs:attribute>
831
- <xs:attribute name="Value" type="xs:string">
832
- <xs:annotation>
833
- <xs:documentation>Optional value used when setting the variable associated with the set of radio buttons.</xs:documentation>
834
- </xs:annotation>
835
- </xs:attribute>
836
- </xs:complexType>
837
- </xs:element>
838
-
839
- <xs:element name="RadioButtons">
840
- <xs:annotation>
841
- <xs:documentation>Defines a set of radio buttons.</xs:documentation>
842
- </xs:annotation>
843
- <xs:complexType>
844
- <xs:choice maxOccurs="unbounded">
845
- <xs:element ref="RadioButton" />
846
- </xs:choice>
847
- <xs:attribute name="Name" type="xs:string">
848
- <xs:annotation>
849
- <xs:documentation>Optional variable name for the set of radio buttons.</xs:documentation>
850
- </xs:annotation>
851
- </xs:attribute>
852
- </xs:complexType>
853
- </xs:element>
854
-
855
- <xs:element name="Richedit">
856
- <xs:annotation>
857
- <xs:documentation>Defines a rich edit control.</xs:documentation>
858
- </xs:annotation>
859
- <xs:complexType mixed="true">
860
- <xs:annotation>
861
- <xs:documentation>
862
- Initial text for the control.
863
- Mutually exclusive with the StringId attribute.
864
- </xs:documentation>
865
- </xs:annotation>
866
- <xs:choice minOccurs="0" maxOccurs="unbounded">
867
- <xs:element ref="Text" />
868
- <xs:element ref="Tooltip" maxOccurs="1" />
869
- </xs:choice>
870
- <xs:attributeGroup ref="CommonControlAttributes" />
871
- <xs:attribute name="FontId" type="xs:nonNegativeInteger" use="required">
872
- <xs:annotation>
873
- <xs:documentation>
874
- Numeric identifier to the Font element that serves as the font for the control.
875
- </xs:documentation>
876
- </xs:annotation>
877
- </xs:attribute>
878
- <xs:attribute name="StringId" type="xs:nonNegativeInteger">
879
- <xs:annotation>
880
- <xs:documentation>
881
- Identifier that references a string resource in the module to define the initial text for the control.
882
- </xs:documentation>
883
- </xs:annotation>
884
- </xs:attribute>
885
- </xs:complexType>
886
- </xs:element>
887
-
888
- <xs:element name="Static">
889
- <xs:annotation>
890
- <xs:documentation>Defines a straight line.</xs:documentation>
891
- </xs:annotation>
892
- <xs:complexType>
893
- <xs:attributeGroup ref="CommonControlAttributes" />
894
- </xs:complexType>
895
- </xs:element>
896
-
897
- <xs:element name="Tab">
898
- <xs:annotation>
899
- <xs:documentation>Defines an individual tab within a set of tabs.</xs:documentation>
900
- </xs:annotation>
901
- <xs:complexType>
902
- <xs:simpleContent>
903
- <xs:extension base="xs:string">
904
- <xs:annotation>
905
- <xs:documentation>
906
- Caption of the tab.
907
- Mutually exclusive with the StringId attribute.
908
- </xs:documentation>
909
- </xs:annotation>
910
- <xs:attribute name="StringId" type="xs:nonNegativeInteger">
911
- <xs:annotation>
912
- <xs:documentation>
913
- Identifier that references a string resource in the module to define the caption of the tab.
914
- </xs:documentation>
915
- </xs:annotation>
916
- </xs:attribute>
917
- </xs:extension>
918
- </xs:simpleContent>
919
- </xs:complexType>
920
- </xs:element>
921
-
922
- <xs:element name="Tabs">
923
- <xs:annotation>
924
- <xs:documentation>Defines a set of tabs.</xs:documentation>
925
- </xs:annotation>
926
- <xs:complexType>
927
- <xs:choice maxOccurs="unbounded">
928
- <xs:element ref="Tab" />
929
- </xs:choice>
930
- <xs:attributeGroup ref="CommonControlAttributes" />
931
- <xs:attribute name="FontId" type="xs:nonNegativeInteger" use="required">
932
- <xs:annotation>
933
- <xs:documentation>Numeric identifier to the Font element that serves as the font for the control.</xs:documentation>
934
- </xs:annotation>
935
- </xs:attribute>
936
- </xs:complexType>
937
- </xs:element>
938
-
939
- <xs:element name="Text">
940
- <xs:annotation>
941
- <xs:documentation>
942
- Defines text for the parent control based on an optional condition.
943
- If multiple Text elements are given for one control, the conditions should be mutually exclusive (when multiple conditions are true, the behavior is undefined and may be changed at any time).
944
- If none of the conditions of a control's Text elements are true, then it uses the text of the Text element without the Condition attribute.
945
- </xs:documentation>
946
- </xs:annotation>
947
- <xs:complexType>
948
- <xs:simpleContent>
949
- <xs:extension base="xs:string">
950
- <xs:annotation>
951
- <xs:documentation>
952
- Text for the parent control.
953
- </xs:documentation>
954
- </xs:annotation>
955
- <xs:attribute name="Condition" type="xs:string">
956
- <xs:annotation>
957
- <xs:documentation>
958
- The condition that determines when the parent control will use this text.
959
- </xs:documentation>
960
- </xs:annotation>
961
- </xs:attribute>
962
- </xs:extension>
963
- </xs:simpleContent>
964
- </xs:complexType>
965
- </xs:element>
966
-
967
- <xs:element name="Tooltip">
968
- <xs:annotation>
969
- <xs:documentation>
970
- Defines text for the parent control's tooltip.
971
- </xs:documentation>
972
- </xs:annotation>
973
- <xs:complexType>
974
- <xs:simpleContent>
975
- <xs:extension base="xs:string">
976
- <xs:annotation>
977
- <xs:documentation>
978
- Text for the parent control's tooltip.
979
- </xs:documentation>
980
- </xs:annotation>
981
- </xs:extension>
982
- </xs:simpleContent>
983
- </xs:complexType>
984
- </xs:element>
985
-
986
- <xs:element name="TreeView">
987
- <xs:annotation>
988
- <xs:documentation>Defines a treeview.</xs:documentation>
989
- </xs:annotation>
990
- <xs:complexType>
991
- <xs:attributeGroup ref="CommonControlAttributes"/>
992
- <xs:attribute name="AlwaysShowSelect">
993
- <xs:annotation>
994
- <xs:documentation>Specifies whether the row always appears selected even when the treeview has lost focus.</xs:documentation>
995
- </xs:annotation>
996
- </xs:attribute>
997
- <xs:attribute name="EnableDragDrop">
998
- <xs:annotation>
999
- <xs:documentation>Specifies whether drag and drop is enabled for the treeview.</xs:documentation>
1000
- </xs:annotation>
1001
- </xs:attribute>
1002
- <xs:attribute name="FullRowSelect">
1003
- <xs:annotation>
1004
- <xs:documentation>Specifies whether an entire row is selected for the treeview.</xs:documentation>
1005
- </xs:annotation>
1006
- </xs:attribute>
1007
- <xs:attribute name="HasButtons">
1008
- <xs:annotation>
1009
- <xs:documentation>Specifies whether the treeview will show buttons.</xs:documentation>
1010
- </xs:annotation>
1011
- </xs:attribute>
1012
- <xs:attribute name="HasLines">
1013
- <xs:annotation>
1014
- <xs:documentation>Specifies whether lines appear for all treeview items.</xs:documentation>
1015
- </xs:annotation>
1016
- </xs:attribute>
1017
- <xs:attribute name="LinesAtRoot">
1018
- <xs:annotation>
1019
- <xs:documentation>Specifies whether the root nodes have lines beside them.</xs:documentation>
1020
- </xs:annotation>
1021
- </xs:attribute>
1022
- </xs:complexType>
1023
- </xs:element>
1024
-
1025
- <xs:element name="Column">
1026
- <xs:annotation>
1027
- <xs:documentation>A column of a list.</xs:documentation>
1028
- </xs:annotation>
1029
- <xs:complexType>
1030
- <xs:simpleContent>
1031
- <xs:extension base="xs:string">
1032
- <xs:annotation>
1033
- <xs:documentation>
1034
- Text for the column header.
1035
- Mutually exclusive with the StringId attribute.
1036
- </xs:documentation>
1037
- </xs:annotation>
1038
- <xs:attribute name="Width" type="xs:int">
1039
- <xs:annotation>
1040
- <xs:documentation>Width of the column.</xs:documentation>
1041
- </xs:annotation>
1042
- </xs:attribute>
1043
- <xs:attribute name="Expands" type="YesNoType">
1044
- <xs:annotation>
1045
- <xs:documentation>
1046
- Whether or not this column can grow to fill available width of the listview.
1047
- More than one column can be marked with yes - all expandable columns will share available extra space.
1048
- This is especially useful if the Window/@AutoResize is yes.
1049
- </xs:documentation>
1050
- </xs:annotation>
1051
- </xs:attribute>
1052
- <xs:attribute name="StringId" type="xs:nonNegativeInteger">
1053
- <xs:annotation>
1054
- <xs:documentation>
1055
- Identifier that references a string resource in the module to define the text for the column header.
1056
- </xs:documentation>
1057
- </xs:annotation>
1058
- </xs:attribute>
1059
- </xs:extension>
1060
- </xs:simpleContent>
1061
- </xs:complexType>
1062
- </xs:element>
1063
-
1064
- <xs:group name="ControlElements">
1065
- <xs:choice>
1066
- <xs:element ref="Billboard" />
1067
- <xs:element ref="Button" />
1068
- <xs:element ref="Checkbox" />
1069
- <xs:element ref="Combobox" />
1070
- <xs:element ref="CommandLink" />
1071
- <xs:element ref="Editbox" />
1072
- <xs:element ref="Hyperlink" />
1073
- <xs:element ref="Hypertext" />
1074
- <xs:element ref="ImageControl" />
1075
- <xs:element ref="Label" />
1076
- <xs:element ref="ListView" />
1077
- <xs:element ref="Panel" />
1078
- <xs:element ref="Progressbar" />
1079
- <xs:element ref="RadioButtons" />
1080
- <xs:element ref="Richedit" />
1081
- <xs:element ref="Static" />
1082
- <xs:element ref="Tabs" />
1083
- <xs:element ref="TreeView" />
1084
- </xs:choice>
1085
- </xs:group>
1086
-
1087
- <xs:attributeGroup name="CommonControlAttributes">
1088
- <xs:attribute name="Name" type="xs:string">
1089
- <xs:annotation>
1090
- <xs:documentation>Optional name for the control.</xs:documentation>
1091
- </xs:annotation>
1092
- </xs:attribute>
1093
- <xs:attribute name="DisableAutomaticBehavior" type="YesNoType">
1094
- <xs:annotation>
1095
- <xs:documentation>Set to 'yes' to disable automatic variable getting and setting, EnableCondition, VisibleCondition, and conditional Text elements. The default is 'no'.</xs:documentation>
1096
- </xs:annotation>
1097
- </xs:attribute>
1098
- <xs:attribute name="EnableCondition" type="xs:string">
1099
- <xs:annotation>
1100
- <xs:documentation>A condition that determines if the control is enabled. If this condition is true or omitted, then the control will be enabled.</xs:documentation>
1101
- </xs:annotation>
1102
- </xs:attribute>
1103
- <xs:attribute name="Height" type="xs:int" use="required">
1104
- <xs:annotation>
1105
- <xs:documentation>Height of the control. Non-positive values extend the control to the bottom of the window minus the value.</xs:documentation>
1106
- </xs:annotation>
1107
- </xs:attribute>
1108
- <xs:attribute name="HexStyle" type="xs:hexBinary">
1109
- <xs:annotation>
1110
- <xs:documentation>Hexadecimal window style for the control.</xs:documentation>
1111
- </xs:annotation>
1112
- </xs:attribute>
1113
- <xs:attribute name="HideWhenDisabled" type="YesNoType">
1114
- <xs:annotation>
1115
- <xs:documentation>Specifies whether the control should be hidden when disabled.</xs:documentation>
1116
- </xs:annotation>
1117
- </xs:attribute>
1118
- <xs:attribute name="TabStop" type="YesNoType">
1119
- <xs:annotation>
1120
- <xs:documentation>Specifies whether the control is part of the tab sequence of controls.</xs:documentation>
1121
- </xs:annotation>
1122
- </xs:attribute>
1123
- <xs:attribute name="Visible" type="YesNoType">
1124
- <xs:annotation>
1125
- <xs:documentation>Specifies whether the control is initially visible.</xs:documentation>
1126
- </xs:annotation>
1127
- </xs:attribute>
1128
- <xs:attribute name="VisibleCondition" type="xs:string">
1129
- <xs:annotation>
1130
- <xs:documentation>
1131
- A condition that determines if the control is visible. If this condition is true or omitted, then the control will be visible.
1132
- </xs:documentation>
1133
- </xs:annotation>
1134
- </xs:attribute>
1135
- <xs:attribute name="Width" type="xs:int" use="required">
1136
- <xs:annotation>
1137
- <xs:documentation>Width of the control. Non-positive values extend the control to the right of the window minus the value.</xs:documentation>
1138
- </xs:annotation>
1139
- </xs:attribute>
1140
- <xs:attribute name="X" type="xs:int" use="required">
1141
- <xs:annotation>
1142
- <xs:documentation>X coordinate for the control from the left of the window. Negative values are coordinates from the right of the window minus the width of the control.</xs:documentation>
1143
- </xs:annotation>
1144
- </xs:attribute>
1145
- <xs:attribute name="Y" type="xs:int" use="required">
1146
- <xs:annotation>
1147
- <xs:documentation>Y coordinate for the control from the top of the window. Negative values are coordinates from the bottom of the window minus the height of the control.</xs:documentation>
1148
- </xs:annotation>
1149
- </xs:attribute>
1150
- </xs:attributeGroup>
1151
-
1152
- <xs:simpleType name="YesNoType">
1153
- <xs:annotation>
1154
- <xs:documentation>Values of this type will either be "yes" or "no".</xs:documentation>
1155
- </xs:annotation>
1156
- <xs:restriction base="xs:NMTOKEN">
1157
- <xs:enumeration value="no"/>
1158
- <xs:enumeration value="yes"/>
1159
- </xs:restriction>
1160
- </xs:simpleType>
1161
-
1162
- <xs:simpleType name="SystemColorType">
1163
- <xs:annotation>
1164
- <xs:documentation>
1165
- Indicates a system color for a font.
1166
- </xs:documentation>
1167
- </xs:annotation>
1168
- <xs:restriction base="xs:NMTOKEN">
1169
- <xs:enumeration value="btnface" />
1170
- <xs:enumeration value="btntext" />
1171
- <xs:enumeration value="graytext" />
1172
- <xs:enumeration value="highlight" />
1173
- <xs:enumeration value="highlighttext" />
1174
- <xs:enumeration value="hotlight" />
1175
- <xs:enumeration value="window" />
1176
- <xs:enumeration value="windowtext" />
1177
- </xs:restriction>
1178
- </xs:simpleType>
1179
-
1180
- <xs:simpleType name="FontColorType">
1181
- <xs:annotation>
1182
- <xs:documentation>
1183
- Indicates the foreground or background color of a font.
1184
- </xs:documentation>
1185
- </xs:annotation>
1186
- <xs:union memberTypes="SystemColorType xs:string"/>
1187
- </xs:simpleType>
1188
-</xs:schema>