Add ThmExit macros to allow capturing thmutil specific errors.
Sean Hall committed
Jun 22, 2020 at 19:07 UTC
4725cea30832be9113269ef567f196ea3d91cb78
6 files changed
+354
-277
src/dutil/dutil.vcxproj
+1
@@ -140,6 +140,7 @@
140
<ClInclude Include="inc\dirutil.h" />
141
<ClInclude Include="inc\dlutil.h" />
142
<ClInclude Include="inc\dutil.h" />
143
+ <ClInclude Include="inc\dutilsources.h" />
144
<ClInclude Include="inc\eseutil.h" />
145
<ClInclude Include="inc\fileutil.h" />
146
<ClInclude Include="inc\gdiputil.h" />
src/dutil/dutil.vcxproj.filters
+3
@@ -344,6 +344,9 @@
344
<ClInclude Include="inc\deputil.h">
345
<Filter>Header Files</Filter>
346
</ClInclude>
347
+ <ClInclude Include="inc\dutilsources.h">
348
+ <Filter>Header Files</Filter>
349
+ </ClInclude>
350
</ItemGroup>
351
<ItemGroup>
352
<None Include="xsd\thmutil.xsd">
src/dutil/inc/dutil.h
+1
-7
@@ -1,6 +1,7 @@
1
#pragma once
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
+#include "dutilsources.h"
5
6
#define DAPI __stdcall
7
#define DAPIV __cdecl // used only for functions taking variable length arguments
@@ -20,13 +21,6 @@ typedef enum REPORT_LEVEL
21
REPORT_ERROR, // always gets reported, but can never be specified
22
} REPORT_LEVEL;
23
23
-typedef enum DUTIL_SOURCE
24
-{
25
- DUTIL_SOURCE_UNKNOWN,
26
-
27
- DUTIL_SOURCE_EXTERNAL = 256,
28
-} DUTIL_SOURCE;
29
-
24
// asserts and traces
25
typedef BOOL (DAPI *DUTIL_ASSERTDISPLAYFUNCTION)(__in_z LPCSTR sz);
26
src/dutil/inc/dutilsources.h
new
+64
@@ -0,0 +1,64 @@
1
+#pragma once
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
+typedef enum DUTIL_SOURCE
5
+{
6
+ DUTIL_SOURCE_UNKNOWN,
7
+ DUTIL_SOURCE_ACLUTIL,
8
+ DUTIL_SOURCE_APPUTIL,
9
+ DUTIL_SOURCE_APUPUTIL,
10
+ DUTIL_SOURCE_ATOMUTIL,
11
+ DUTIL_SOURCE_BUFFUTIL,
12
+ DUTIL_SOURCE_BUTIL,
13
+ DUTIL_SOURCE_CABCUTIL,
14
+ DUTIL_SOURCE_CABUTIL,
15
+ DUTIL_SOURCE_CERTUTIL,
16
+ DUTIL_SOURCE_CONUTIL,
17
+ DUTIL_SOURCE_CRYPUTIL,
18
+ DUTIL_SOURCE_DEPUTIL,
19
+ DUTIL_SOURCE_DICTUTIL,
20
+ DUTIL_SOURCE_DIRUTIL,
21
+ DUTIL_SOURCE_DLUTIL,
22
+ DUTIL_SOURCE_DUTIL,
23
+ DUTIL_SOURCE_ESEUTIL,
24
+ DUTIL_SOURCE_FILEUTIL,
25
+ DUTIL_SOURCE_GDIPUTIL,
26
+ DUTIL_SOURCE_GUIDUTIL,
27
+ DUTIL_SOURCE_IIS7UTIL,
28
+ DUTIL_SOURCE_INETUTIL,
29
+ DUTIL_SOURCE_INIUTIL,
30
+ DUTIL_SOURCE_JSONUTIL,
31
+ DUTIL_SOURCE_LOCUTIL,
32
+ DUTIL_SOURCE_LOGUTIL,
33
+ DUTIL_SOURCE_MEMUTIL,
34
+ DUTIL_SOURCE_METAUTIL,
35
+ DUTIL_SOURCE_MONUTIL,
36
+ DUTIL_SOURCE_OSUTIL,
37
+ DUTIL_SOURCE_PATHUTIL,
38
+ DUTIL_SOURCE_PERFUTIL,
39
+ DUTIL_SOURCE_POLCUTIL,
40
+ DUTIL_SOURCE_PROCUTIL,
41
+ DUTIL_SOURCE_REGUTIL,
42
+ DUTIL_SOURCE_RESRUTIL,
43
+ DUTIL_SOURCE_RESWUTIL,
44
+ DUTIL_SOURCE_REXUTIL,
45
+ DUTIL_SOURCE_RMUTIL,
46
+ DUTIL_SOURCE_RSSUTIL,
47
+ DUTIL_SOURCE_SCEUTIL,
48
+ DUTIL_SOURCE_SCZUTIL,
49
+ DUTIL_SOURCE_SHELUTIL,
50
+ DUTIL_SOURCE_SQLUTIL,
51
+ DUTIL_SOURCE_SRPUTIL,
52
+ DUTIL_SOURCE_STRUTIL,
53
+ DUTIL_SOURCE_SVCUTIL,
54
+ DUTIL_SOURCE_THMUTIL,
55
+ DUTIL_SOURCE_TIMEUTIL,
56
+ DUTIL_SOURCE_UNCUTIL,
57
+ DUTIL_SOURCE_URIUTIL,
58
+ DUTIL_SOURCE_USERUTIL,
59
+ DUTIL_SOURCE_WIUTIL,
60
+ DUTIL_SOURCE_WUAUTIL,
61
+ DUTIL_SOURCE_XMLUTIL,
62
+
63
+ DUTIL_SOURCE_EXTERNAL = 256,
64
+} DUTIL_SOURCE;
src/dutil/precomp.h
+1
@@ -40,6 +40,7 @@
40
#include <commctrl.h>
41
#include <dbt.h>
42
43
+#include "dutilsources.h"
44
#include "dutil.h"
45
#include "aclutil.h"
46
#include "atomutil.h"
src/dutil/thmutil.cpp
+284
-270
@@ -3,6 +3,20 @@
3
#include "precomp.h"
4
5
6
+// Exit macros
7
+#define ThmExitOnLastError(x, s, ...) ExitOnLastErrorSource(DUTIL_SOURCE_THMUTIL, x, s, __VA_ARGS__)
8
+#define ThmExitOnLastErrorDebugTrace(x, s, ...) ExitOnLastErrorDebugTraceSource(DUTIL_SOURCE_THMUTIL, x, s, __VA_ARGS__)
9
+#define ThmExitWithLastError(x, s, ...) ExitWithLastErrorSource(DUTIL_SOURCE_THMUTIL, x, s, __VA_ARGS__)
10
+#define ThmExitOnFailure(x, s, ...) ExitOnFailureSource(DUTIL_SOURCE_THMUTIL, x, s, __VA_ARGS__)
11
+#define ThmExitOnRootFailure(x, s, ...) ExitOnRootFailureSource(DUTIL_SOURCE_THMUTIL, x, s, __VA_ARGS__)
12
+#define ThmExitOnFailureDebugTrace(x, s, ...) ExitOnFailureDebugTraceSource(DUTIL_SOURCE_THMUTIL, x, s, __VA_ARGS__)
13
+#define ThmExitOnNull(p, x, e, s, ...) ExitOnNullSource(DUTIL_SOURCE_THMUTIL, p, x, e, s, __VA_ARGS__)
14
+#define ThmExitOnNullWithLastError(p, x, s, ...) ExitOnNullWithLastErrorSource(DUTIL_SOURCE_THMUTIL, p, x, s, __VA_ARGS__)
15
+#define ThmExitOnNullDebugTrace(p, x, e, s, ...) ExitOnNullDebugTraceSource(DUTIL_SOURCE_THMUTIL, p, x, e, s, __VA_ARGS__)
16
+#define ThmExitOnInvalidHandleWithLastError(p, x, s, ...) ExitOnInvalidHandleWithLastErrorSource(DUTIL_SOURCE_THMUTIL, p, x, s, __VA_ARGS__)
17
+#define ThmExitOnWin32Error(e, x, s, ...) ExitOnWin32ErrorSource(DUTIL_SOURCE_THMUTIL, e, x, s, __VA_ARGS__)
18
+#define ThmExitOnGdipFailure(g, x, s, ...) ExitOnGdipFailureSource(DUTIL_SOURCE_THMUTIL, g, x, s, __VA_ARGS__)
19
+
20
#ifndef BS_COMMANDLINK
21
#define BS_COMMANDLINK 0x0000000EL
22
#endif
@@ -362,16 +376,16 @@ DAPI_(HRESULT) ThemeInitialize(
376
INITCOMMONCONTROLSEX icex = { };
377
378
hr = XmlInitialize();
365
- ExitOnFailure(hr, "Failed to initialize XML.");
379
+ ThmExitOnFailure(hr, "Failed to initialize XML.");
380
381
hr = RegisterWindowClasses(hModule);
368
- ExitOnFailure(hr, "Failed to register theme window classes.");
382
+ ThmExitOnFailure(hr, "Failed to register theme window classes.");
383
384
// Initialize GDI+ and common controls.
385
vgsi.SuppressBackgroundThread = TRUE;
386
387
hr = GdipInitialize(&vgsi, &vgdiToken, &vgso);
374
- ExitOnFailure(hr, "Failed to initialize GDI+.");
388
+ ThmExitOnFailure(hr, "Failed to initialize GDI+.");
389
390
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
391
icex.dwICC = ICC_STANDARD_CLASSES | ICC_PROGRESS_CLASS | ICC_LISTVIEW_CLASSES | ICC_TREEVIEW_CLASSES | ICC_TAB_CLASSES | ICC_LINK_CLASS;
@@ -424,13 +438,13 @@ DAPI_(HRESULT) ThemeLoadFromFile(
438
LPWSTR sczRelativePath = NULL;
439
440
hr = XmlLoadDocumentFromFile(wzThemeFile, &pixd);
427
- ExitOnFailure(hr, "Failed to load theme resource as XML document.");
441
+ ThmExitOnFailure(hr, "Failed to load theme resource as XML document.");
442
443
hr = PathGetDirectory(wzThemeFile, &sczRelativePath);
430
- ExitOnFailure(hr, "Failed to get relative path from theme file.");
444
+ ThmExitOnFailure(hr, "Failed to get relative path from theme file.");
445
446
hr = ParseTheme(NULL, sczRelativePath, pixd, ppTheme);
433
- ExitOnFailure(hr, "Failed to parse theme.");
447
+ ThmExitOnFailure(hr, "Failed to parse theme.");
448
449
LExit:
450
ReleaseStr(sczRelativePath);
@@ -453,16 +467,16 @@ DAPI_(HRESULT) ThemeLoadFromResource(
467
IXMLDOMDocument* pixd = NULL;
468
469
hr = ResReadData(hModule, szResource, &pvResource, &cbResource);
456
- ExitOnFailure(hr, "Failed to read theme from resource.");
470
+ ThmExitOnFailure(hr, "Failed to read theme from resource.");
471
472
hr = StrAllocStringAnsi(&sczXml, reinterpret_cast<LPCSTR>(pvResource), cbResource, CP_UTF8);
459
- ExitOnFailure(hr, "Failed to convert XML document data from UTF-8 to unicode string.");
473
+ ThmExitOnFailure(hr, "Failed to convert XML document data from UTF-8 to unicode string.");
474
475
hr = XmlLoadDocument(sczXml, &pixd);
462
- ExitOnFailure(hr, "Failed to load theme resource as XML document.");
476
+ ThmExitOnFailure(hr, "Failed to load theme resource as XML document.");
477
478
hr = ParseTheme(hModule, NULL, pixd, ppTheme);
465
- ExitOnFailure(hr, "Failed to parse theme.");
479
+ ThmExitOnFailure(hr, "Failed to parse theme.");
480
481
LExit:
482
ReleaseObject(pixd);
@@ -524,7 +538,7 @@ DAPI_(HRESULT) ThemeRegisterVariableCallbacks(
538
)
539
{
540
HRESULT hr = S_OK;
527
- ExitOnNull(pTheme, hr, S_FALSE, "Theme must be loaded first.");
541
+ ThmExitOnNull(pTheme, hr, S_FALSE, "Theme must be loaded first.");
542
543
pTheme->pfnEvaluateCondition = pfnEvaluateCondition;
544
pTheme->pfnFormatString = pfnFormatString;
@@ -569,7 +583,7 @@ DAPI_(HRESULT) ThemeLocalize(
583
LPWSTR sczCaption = NULL;
584
585
hr = LocLocalizeString(pWixLoc, &pTheme->sczCaption);
572
- ExitOnFailure(hr, "Failed to localize theme caption.");
586
+ ThmExitOnFailure(hr, "Failed to localize theme caption.");
587
588
if (pTheme->pfnFormatString)
589
{
@@ -599,12 +613,12 @@ DAPI_(HRESULT) ThemeLoadStrings(
613
)
614
{
615
HRESULT hr = S_OK;
602
- ExitOnNull(pTheme, hr, S_FALSE, "Theme must be loaded first.");
616
+ ThmExitOnNull(pTheme, hr, S_FALSE, "Theme must be loaded first.");
617
618
if (UINT_MAX != pTheme->uStringId)
619
{
620
hr = ResReadString(hResModule, pTheme->uStringId, &pTheme->sczCaption);
607
- ExitOnFailure(hr, "Failed to load theme caption.");
621
+ ThmExitOnFailure(hr, "Failed to load theme caption.");
622
}
623
624
hr = LoadControlsString(pTheme->cControls, pTheme->rgControls, hResModule);
@@ -627,12 +641,12 @@ DAPI_(HRESULT) ThemeLoadRichEditFromFile(
641
HWND hWnd = ::GetDlgItem(pTheme->hwndParent, dwControl);
642
643
hr = PathRelativeToModule(&sczFile, wzFileName, hModule);
630
- ExitOnFailure(hr, "Failed to read resource data.");
644
+ ThmExitOnFailure(hr, "Failed to read resource data.");
645
646
hFile = ::CreateFileW(sczFile, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
647
if (INVALID_HANDLE_VALUE == hFile)
648
{
635
- ExitWithLastError(hr, "Failed to open RTF file.");
649
+ ThmExitWithLastError(hr, "Failed to open RTF file.");
650
}
651
else
652
{
@@ -649,7 +663,7 @@ DAPI_(HRESULT) ThemeLoadRichEditFromFile(
663
664
::SendMessageW(hWnd, EM_STREAMIN, SF_RTF, reinterpret_cast<LPARAM>(&es));
665
hr = es.dwError;
652
- ExitOnFailure(hr, "Failed to update RTF stream.");
666
+ ThmExitOnFailure(hr, "Failed to update RTF stream.");
667
}
668
669
LExit:
@@ -682,14 +696,14 @@ DAPI_(HRESULT) ThemeLoadRichEditFromResourceToHWnd(
696
EDITSTREAM es = { };
697
698
hr = ResReadData(hModule, szResourceName, reinterpret_cast<LPVOID*>(&buffer.rgbData), &buffer.cbData);
685
- ExitOnFailure(hr, "Failed to read resource data.");
699
+ ThmExitOnFailure(hr, "Failed to read resource data.");
700
701
es.pfnCallback = RichEditStreamFromMemoryCallback;
702
es.dwCookie = reinterpret_cast<DWORD_PTR>(&buffer);
703
704
::SendMessageW(hWnd, EM_STREAMIN, SF_RTF, reinterpret_cast<LPARAM>(&es));
705
hr = es.dwError;
692
- ExitOnFailure(hr, "Failed to update RTF stream.");
706
+ ThmExitOnFailure(hr, "Failed to update RTF stream.");
707
708
LExit:
709
return hr;
@@ -985,7 +999,7 @@ DAPI_(HRESULT) ThemeShowPageEx(
999
else
1000
{
1001
hr = MemEnsureArraySize(reinterpret_cast<LPVOID*>(&pPage->rgSavedVariables), pPage->cControlIndices, sizeof(THEME_SAVEDVARIABLE), pPage->cControlIndices);
988
- ExitOnNull(pPage->rgSavedVariables, hr, E_OUTOFMEMORY, "Failed to allocate memory for saved variables.");
1002
+ ThmExitOnNull(pPage->rgSavedVariables, hr, E_OUTOFMEMORY, "Failed to allocate memory for saved variables.");
1003
1004
SecureZeroMemory(pPage->rgSavedVariables, MemSize(pPage->rgSavedVariables));
1005
pPage->cSavedVariables = pPage->cControlIndices;
@@ -998,7 +1012,7 @@ DAPI_(HRESULT) ThemeShowPageEx(
1012
}
1013
1014
hr = ShowControls(pTheme, NULL, nCmdShow, fSaveEditboxes, reason, dwPage);
1001
- ExitOnFailure(hr, "Failed to show page controls.");
1015
+ ThmExitOnFailure(hr, "Failed to show page controls.");
1016
1017
LExit:
1018
return hr;
@@ -1184,27 +1198,27 @@ DAPI_(HRESULT) ThemeDrawControl(
1198
{
1199
case THEME_CONTROL_TYPE_BUTTON:
1200
hr = DrawButton(pTheme, pdis, pControl);
1187
- ExitOnFailure(hr, "Failed to draw button.");
1201
+ ThmExitOnFailure(hr, "Failed to draw button.");
1202
break;
1203
1204
case THEME_CONTROL_TYPE_HYPERLINK:
1205
hr = DrawHyperlink(pTheme, pdis, pControl);
1192
- ExitOnFailure(hr, "Failed to draw hyperlink.");
1206
+ ThmExitOnFailure(hr, "Failed to draw hyperlink.");
1207
break;
1208
1209
case THEME_CONTROL_TYPE_IMAGE:
1210
hr = DrawImage(pTheme, pdis, pControl);
1197
- ExitOnFailure(hr, "Failed to draw image.");
1211
+ ThmExitOnFailure(hr, "Failed to draw image.");
1212
break;
1213
1214
case THEME_CONTROL_TYPE_PROGRESSBAR:
1215
hr = DrawProgressBar(pTheme, pdis, pControl);
1202
- ExitOnFailure(hr, "Failed to draw progress bar.");
1216
+ ThmExitOnFailure(hr, "Failed to draw progress bar.");
1217
break;
1218
1219
default:
1220
hr = E_UNEXPECTED;
1207
- ExitOnRootFailure(hr, "Did not specify an owner draw control to draw.");
1221
+ ThmExitOnRootFailure(hr, "Did not specify an owner draw control to draw.");
1222
}
1223
1224
LExit:
@@ -1321,7 +1335,7 @@ DAPI_(HRESULT) ThemeSetProgressControl(
1335
{
1336
if (!::InvalidateRect(hWnd, NULL, FALSE))
1337
{
1324
- ExitWithLastError(hr, "Failed to invalidate progress bar window.");
1338
+ ThmExitWithLastError(hr, "Failed to invalidate progress bar window.");
1339
}
1340
}
1341
else
@@ -1367,7 +1381,7 @@ DAPI_(HRESULT) ThemeSetProgressControlColor(
1381
1382
if (!::InvalidateRect(hWnd, NULL, FALSE))
1383
{
1370
- ExitWithLastError(hr, "Failed to invalidate progress bar window.");
1384
+ ThmExitWithLastError(hr, "Failed to invalidate progress bar window.");
1385
}
1386
1387
hr = S_OK;
@@ -1409,7 +1423,7 @@ DAPI_(HRESULT) ThemeSetTextControlEx(
1423
1424
if (!::SetWindowTextW(hWnd, wzText))
1425
{
1412
- ExitWithLastError(hr, "Failed to set control text.");
1426
+ ThmExitWithLastError(hr, "Failed to set control text.");
1427
}
1428
1429
if (fUpdate)
@@ -1436,14 +1450,14 @@ DAPI_(HRESULT) ThemeGetTextControl(
1450
1451
// Ensure the string has room for at least one character.
1452
hr = StrMaxLength(*psczText, reinterpret_cast<DWORD_PTR*>(&cchText));
1439
- ExitOnFailure(hr, "Failed to get text buffer length.");
1453
+ ThmExitOnFailure(hr, "Failed to get text buffer length.");
1454
1455
if (!cchText)
1456
{
1457
cchText = GROW_WINDOW_TEXT;
1458
1459
hr = StrAlloc(psczText, cchText);
1446
- ExitOnFailure(hr, "Failed to grow text buffer.");
1460
+ ThmExitOnFailure(hr, "Failed to grow text buffer.");
1461
}
1462
1463
// Read (and keep growing buffer) until we finally read less than there
@@ -1460,7 +1474,7 @@ DAPI_(HRESULT) ThemeGetTextControl(
1474
cchText = cchTextRead + GROW_WINDOW_TEXT;
1475
1476
hr = StrAlloc(psczText, cchText);
1463
- ExitOnFailure(hr, "Failed to grow text buffer again.");
1477
+ ThmExitOnFailure(hr, "Failed to grow text buffer again.");
1478
}
1479
}
1480
@@ -1477,7 +1491,7 @@ DAPI_(HRESULT) ThemeUpdateCaption(
1491
HRESULT hr = S_OK;
1492
1493
hr = StrAllocString(&pTheme->sczCaption, wzCaption, 0);
1480
- ExitOnFailure(hr, "Failed to update theme caption.");
1494
+ ThmExitOnFailure(hr, "Failed to update theme caption.");
1495
1496
LExit:
1497
return hr;
@@ -1532,7 +1546,7 @@ static HRESULT RegisterWindowClasses(
1546
// Base the theme hyperlink class on a button but give it the "hand" icon.
1547
if (!::GetClassInfoW(NULL, WC_BUTTONW, &wcHyperlink))
1548
{
1535
- ExitWithLastError(hr, "Failed to get button window class.");
1549
+ ThmExitWithLastError(hr, "Failed to get button window class.");
1550
}
1551
1552
wcHyperlink.lpszClassName = THEME_WC_HYPERLINK;
@@ -1543,7 +1557,7 @@ static HRESULT RegisterWindowClasses(
1557
1558
if (!::RegisterClassW(&wcHyperlink))
1559
{
1546
- ExitWithLastError(hr, "Failed to get button window class.");
1560
+ ThmExitWithLastError(hr, "Failed to get button window class.");
1561
}
1562
vhHyperlinkRegisteredModule = hModule;
1563
@@ -1554,7 +1568,7 @@ static HRESULT RegisterWindowClasses(
1568
wcPanel.lpszClassName = THEME_WC_PANEL;
1569
if (!::RegisterClassW(&wcPanel))
1570
{
1557
- ExitWithLastError(hr, "Failed to register window.");
1571
+ ThmExitWithLastError(hr, "Failed to register window.");
1572
}
1573
vhPanelRegisteredModule = hModule;
1574
@@ -1577,24 +1591,24 @@ static HRESULT ParseTheme(
1591
IXMLDOMElement *pThemeElement = NULL;
1592
1593
hr = pixd->get_documentElement(&pThemeElement);
1580
- ExitOnFailure(hr, "Failed to get theme element.");
1594
+ ThmExitOnFailure(hr, "Failed to get theme element.");
1595
1596
pTheme = static_cast<THEME*>(MemAlloc(sizeof(THEME), TRUE));
1583
- ExitOnNull(pTheme, hr, E_OUTOFMEMORY, "Failed to allocate memory for theme.");
1597
+ ThmExitOnNull(pTheme, hr, E_OUTOFMEMORY, "Failed to allocate memory for theme.");
1598
1599
pTheme->wId = ++wThemeId;
1600
1601
// Parse the optional background resource image.
1602
hr = ParseImage(hModule, wzRelativePath, pThemeElement, &pTheme->hImage);
1589
- ExitOnFailure(hr, "Failed while parsing theme image.");
1603
+ ThmExitOnFailure(hr, "Failed while parsing theme image.");
1604
1605
// Parse the fonts.
1606
hr = ParseFonts(pThemeElement, pTheme);
1593
- ExitOnFailure(hr, "Failed to parse theme fonts.");
1607
+ ThmExitOnFailure(hr, "Failed to parse theme fonts.");
1608
1609
// Parse the window element.
1610
hr = ParseWindow(hModule, wzRelativePath, pThemeElement, pTheme);
1597
- ExitOnFailure(hr, "Failed to parse theme window element.");
1611
+ ThmExitOnFailure(hr, "Failed to parse theme window element.");
1612
1613
*ppTheme = pTheme;
1614
pTheme = NULL;
@@ -1624,7 +1638,7 @@ static HRESULT ParseImage(
1638
Gdiplus::Bitmap* pBitmap = NULL;
1639
1640
hr = XmlGetAttribute(pElement, L"ImageResource", &bstr);
1627
- ExitOnFailure(hr, "Failed to get image resource attribute.");
1641
+ ThmExitOnFailure(hr, "Failed to get image resource attribute.");
1642
1643
if (S_OK == hr)
1644
{
@@ -1640,19 +1654,19 @@ static HRESULT ParseImage(
1654
if (!pBitmap)
1655
{
1656
hr = XmlGetAttribute(pElement, L"ImageFile", &bstr);
1643
- ExitOnFailure(hr, "Failed to get image file attribute.");
1657
+ ThmExitOnFailure(hr, "Failed to get image file attribute.");
1658
1659
if (S_OK == hr)
1660
{
1661
if (wzRelativePath)
1662
{
1663
hr = PathConcat(wzRelativePath, bstr, &sczImageFile);
1650
- ExitOnFailure(hr, "Failed to combine image file path.");
1664
+ ThmExitOnFailure(hr, "Failed to combine image file path.");
1665
}
1666
else
1667
{
1668
hr = PathRelativeToModule(&sczImageFile, bstr, hModule);
1655
- ExitOnFailure(hr, "Failed to get image filename.");
1669
+ ThmExitOnFailure(hr, "Failed to get image filename.");
1670
}
1671
1672
hr = GdipBitmapFromFile(sczImageFile, &pBitmap);
@@ -1665,7 +1679,7 @@ static HRESULT ParseImage(
1679
{
1680
Gdiplus::Color black;
1681
Gdiplus::Status gs = pBitmap->GetHBITMAP(black, phImage);
1668
- ExitOnGdipFailure(gs, hr, "Failed to convert GDI+ bitmap into HBITMAP.");
1682
+ ThmExitOnGdipFailure(gs, hr, "Failed to convert GDI+ bitmap into HBITMAP.");
1683
}
1684
1685
hr = S_OK;
@@ -1696,37 +1710,37 @@ static HRESULT ParseIcon(
1710
int iResourceId = 0;
1711
1712
hr = XmlGetAttribute(pElement, L"IconResource", &bstr);
1699
- ExitOnFailure(hr, "Failed to get icon resource attribute.");
1713
+ ThmExitOnFailure(hr, "Failed to get icon resource attribute.");
1714
1715
if (S_OK == hr)
1716
{
1717
iResourceId = wcstol(bstr, NULL, 10);
1718
1719
*phIcon = reinterpret_cast<HICON>(::LoadImageW(hModule, MAKEINTRESOURCEW(iResourceId), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE));
1706
- ExitOnNullWithLastError(*phIcon, hr, "Failed to load icon.");
1720
+ ThmExitOnNullWithLastError(*phIcon, hr, "Failed to load icon.");
1721
}
1722
else
1723
{
1724
ReleaseNullBSTR(bstr);
1725
1726
hr = XmlGetAttribute(pElement, L"IconFile", &bstr);
1713
- ExitOnFailure(hr, "Failed to get icon file attribute.");
1727
+ ThmExitOnFailure(hr, "Failed to get icon file attribute.");
1728
1729
if (S_OK == hr)
1730
{
1731
if (wzRelativePath)
1732
{
1733
hr = PathConcat(wzRelativePath, bstr, &sczImageFile);
1720
- ExitOnFailure(hr, "Failed to combine image file path.");
1734
+ ThmExitOnFailure(hr, "Failed to combine image file path.");
1735
}
1736
else
1737
{
1738
hr = PathRelativeToModule(&sczImageFile, bstr, hModule);
1725
- ExitOnFailure(hr, "Failed to get image filename.");
1739
+ ThmExitOnFailure(hr, "Failed to get image filename.");
1740
}
1741
1742
*phIcon = reinterpret_cast<HICON>(::LoadImageW(NULL, sczImageFile, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE));
1729
- ExitOnNullWithLastError(*phIcon, hr, "Failed to load icon: %ls.", sczImageFile);
1743
+ ThmExitOnNullWithLastError(*phIcon, hr, "Failed to load icon: %ls.", sczImageFile);
1744
}
1745
}
1746
@@ -1755,84 +1769,84 @@ static HRESULT ParseWindow(
1769
{
1770
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
1771
}
1758
- ExitOnFailure(hr, "Failed to find window element.");
1772
+ ThmExitOnFailure(hr, "Failed to find window element.");
1773
1774
hr = XmlGetYesNoAttribute(pixn, L"AutoResize", &pTheme->fAutoResize);
1775
if (E_NOTFOUND == hr)
1776
{
1777
hr = S_OK;
1778
}
1765
- ExitOnFailure(hr, "Failed to get window AutoResize attribute.");
1779
+ ThmExitOnFailure(hr, "Failed to get window AutoResize attribute.");
1780
1781
hr = XmlGetAttributeNumber(pixn, L"Width", reinterpret_cast<DWORD*>(&pTheme->nWidth));
1782
if (S_FALSE == hr)
1783
{
1784
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
1771
- ExitOnRootFailure(hr, "Failed to find window Width attribute.");
1785
+ ThmExitOnRootFailure(hr, "Failed to find window Width attribute.");
1786
}
1773
- ExitOnFailure(hr, "Failed to get window Width attribute.");
1787
+ ThmExitOnFailure(hr, "Failed to get window Width attribute.");
1788
1789
hr = XmlGetAttributeNumber(pixn, L"Height", reinterpret_cast<DWORD*>(&pTheme->nHeight));
1790
if (S_FALSE == hr)
1791
{
1792
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
1779
- ExitOnRootFailure(hr, "Failed to find window Height attribute.");
1793
+ ThmExitOnRootFailure(hr, "Failed to find window Height attribute.");
1794
}
1781
- ExitOnFailure(hr, "Failed to get window Height attribute.");
1795
+ ThmExitOnFailure(hr, "Failed to get window Height attribute.");
1796
1797
hr = XmlGetAttributeNumber(pixn, L"MinimumWidth", reinterpret_cast<DWORD*>(&pTheme->nMinimumWidth));
1798
if (S_FALSE == hr)
1799
{
1800
hr = S_OK;
1801
}
1788
- ExitOnFailure(hr, "Failed to get window MinimumWidth attribute.");
1802
+ ThmExitOnFailure(hr, "Failed to get window MinimumWidth attribute.");
1803
1804
hr = XmlGetAttributeNumber(pixn, L"MinimumHeight", reinterpret_cast<DWORD*>(&pTheme->nMinimumHeight));
1805
if (S_FALSE == hr)
1806
{
1807
hr = S_OK;
1808
}
1795
- ExitOnFailure(hr, "Failed to get window MinimumHeight attribute.");
1809
+ ThmExitOnFailure(hr, "Failed to get window MinimumHeight attribute.");
1810
1811
hr = XmlGetAttributeNumber(pixn, L"FontId", &pTheme->dwFontId);
1812
if (S_FALSE == hr)
1813
{
1814
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
1801
- ExitOnRootFailure(hr, "Failed to find window FontId attribute.");
1815
+ ThmExitOnRootFailure(hr, "Failed to find window FontId attribute.");
1816
}
1803
- ExitOnFailure(hr, "Failed to get window FontId attribute.");
1817
+ ThmExitOnFailure(hr, "Failed to get window FontId attribute.");
1818
1819
// Get the optional window icon from a resource.
1820
hr = XmlGetAttribute(pixn, L"IconResource", &bstr);
1807
- ExitOnFailure(hr, "Failed to get window IconResource attribute.");
1821
+ ThmExitOnFailure(hr, "Failed to get window IconResource attribute.");
1822
1823
if (S_OK == hr)
1824
{
1825
pTheme->hIcon = ::LoadIconW(hModule, bstr);
1812
- ExitOnNullWithLastError(pTheme->hIcon, hr, "Failed to load window icon from IconResource.");
1826
+ ThmExitOnNullWithLastError(pTheme->hIcon, hr, "Failed to load window icon from IconResource.");
1827
1828
ReleaseNullBSTR(bstr);
1829
}
1830
1831
// Get the optional window icon from a file.
1832
hr = XmlGetAttribute(pixn, L"IconFile", &bstr);
1819
- ExitOnFailure(hr, "Failed to get window IconFile attribute.");
1833
+ ThmExitOnFailure(hr, "Failed to get window IconFile attribute.");
1834
1835
if (S_OK == hr)
1836
{
1837
if (wzRelativePath)
1838
{
1839
hr = PathConcat(wzRelativePath, bstr, &sczIconFile);
1826
- ExitOnFailure(hr, "Failed to combine icon file path.");
1840
+ ThmExitOnFailure(hr, "Failed to combine icon file path.");
1841
}
1842
else
1843
{
1844
hr = PathRelativeToModule(&sczIconFile, bstr, hModule);
1831
- ExitOnFailure(hr, "Failed to get icon filename.");
1845
+ ThmExitOnFailure(hr, "Failed to get icon filename.");
1846
}
1847
1848
pTheme->hIcon = ::LoadImageW(NULL, sczIconFile, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE);
1835
- ExitOnNullWithLastError(pTheme->hIcon, hr, "Failed to load window icon from IconFile: %ls.", bstr);
1849
+ ThmExitOnNullWithLastError(pTheme->hIcon, hr, "Failed to load window icon from IconFile: %ls.", bstr);
1850
1851
ReleaseNullBSTR(bstr);
1852
}
@@ -1842,18 +1856,18 @@ static HRESULT ParseWindow(
1856
{
1857
pTheme->nSourceX = -1;
1858
}
1845
- ExitOnFailure(hr, "Failed to get window SourceX attribute.");
1859
+ ThmExitOnFailure(hr, "Failed to get window SourceX attribute.");
1860
1861
hr = XmlGetAttributeNumber(pixn, L"SourceY", reinterpret_cast<DWORD*>(&pTheme->nSourceY));
1862
if (S_FALSE == hr)
1863
{
1864
pTheme->nSourceY = -1;
1865
}
1852
- ExitOnFailure(hr, "Failed to get window SourceY attribute.");
1866
+ ThmExitOnFailure(hr, "Failed to get window SourceY attribute.");
1867
1868
// Parse the optional window style.
1869
hr = XmlGetAttributeNumberBase(pixn, L"HexStyle", 16, &pTheme->dwStyle);
1856
- ExitOnFailure(hr, "Failed to get theme window style (Window@HexStyle) attribute.");
1870
+ ThmExitOnFailure(hr, "Failed to get theme window style (Window@HexStyle) attribute.");
1871
1872
if (S_FALSE == hr)
1873
{
@@ -1862,36 +1876,36 @@ static HRESULT ParseWindow(
1876
}
1877
1878
hr = XmlGetAttributeNumber(pixn, L"StringId", reinterpret_cast<DWORD*>(&pTheme->uStringId));
1865
- ExitOnFailure(hr, "Failed to get window StringId attribute.");
1879
+ ThmExitOnFailure(hr, "Failed to get window StringId attribute.");
1880
1881
if (S_FALSE == hr)
1882
{
1883
pTheme->uStringId = UINT_MAX;
1884
1885
hr = XmlGetAttribute(pixn, L"Caption", &bstr);
1872
- ExitOnFailure(hr, "Failed to get window Caption attribute.");
1886
+ ThmExitOnFailure(hr, "Failed to get window Caption attribute.");
1887
1888
if (S_FALSE == hr)
1889
{
1890
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
1877
- ExitOnRootFailure(hr, "Window elements must contain the Caption or StringId attribute.");
1891
+ ThmExitOnRootFailure(hr, "Window elements must contain the Caption or StringId attribute.");
1892
}
1893
1894
hr = StrAllocString(&pTheme->sczCaption, bstr, 0);
1881
- ExitOnFailure(hr, "Failed to copy window Caption attribute.");
1895
+ ThmExitOnFailure(hr, "Failed to copy window Caption attribute.");
1896
}
1897
1898
// Parse any image lists.
1899
hr = ParseImageLists(hModule, wzRelativePath, pixn, pTheme);
1886
- ExitOnFailure(hr, "Failed to parse image lists.");
1900
+ ThmExitOnFailure(hr, "Failed to parse image lists.");
1901
1902
// Parse the pages.
1903
hr = ParsePages(hModule, wzRelativePath, pixn, pTheme);
1890
- ExitOnFailure(hr, "Failed to parse theme pages.");
1904
+ ThmExitOnFailure(hr, "Failed to parse theme pages.");
1905
1906
// Parse the non-paged controls.
1907
hr = ParseControls(hModule, wzRelativePath, pixn, pTheme, NULL, NULL);
1894
- ExitOnFailure(hr, "Failed to parse theme controls.");
1908
+ ThmExitOnFailure(hr, "Failed to parse theme controls.");
1909
1910
LExit:
1911
ReleaseStr(sczIconFile);
@@ -1919,10 +1933,10 @@ static HRESULT ParseFonts(
1933
DWORD dwSystemBackgroundColor = FALSE;
1934
1935
hr = XmlSelectNodes(pElement, L"Font", &pixnl);
1922
- ExitOnFailure(hr, "Failed to find font elements.");
1936
+ ThmExitOnFailure(hr, "Failed to find font elements.");
1937
1938
hr = pixnl->get_length(reinterpret_cast<long*>(&pTheme->cFonts));
1925
- ExitOnFailure(hr, "Failed to count the number of theme fonts.");
1939
+ ThmExitOnFailure(hr, "Failed to count the number of theme fonts.");
1940
1941
if (!pTheme->cFonts)
1942
{
@@ -1930,7 +1944,7 @@ static HRESULT ParseFonts(
1944
}
1945
1946
pTheme->rgFonts = static_cast<THEME_FONT*>(MemAlloc(sizeof(THEME_FONT) * pTheme->cFonts, TRUE));
1933
- ExitOnNull(pTheme->rgFonts, hr, E_OUTOFMEMORY, "Failed to allocate theme fonts.");
1947
+ ThmExitOnNull(pTheme->rgFonts, hr, E_OUTOFMEMORY, "Failed to allocate theme fonts.");
1948
1949
lf.lfQuality = CLEARTYPE_QUALITY;
1950
@@ -1941,12 +1955,12 @@ static HRESULT ParseFonts(
1955
{
1956
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
1957
}
1944
- ExitOnFailure(hr, "Failed to find font id.");
1958
+ ThmExitOnFailure(hr, "Failed to find font id.");
1959
1960
if (pTheme->cFonts <= dwId)
1961
{
1962
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
1949
- ExitOnRootFailure(hr, "Invalid theme font id.");
1963
+ ThmExitOnRootFailure(hr, "Invalid theme font id.");
1964
}
1965
1966
hr = XmlGetText(pixn, &bstrName);
@@ -1954,17 +1968,17 @@ static HRESULT ParseFonts(
1968
{
1969
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
1970
}
1957
- ExitOnFailure(hr, "Failed to get font name.");
1971
+ ThmExitOnFailure(hr, "Failed to get font name.");
1972
1973
hr = ::StringCchCopyW(lf.lfFaceName, countof(lf.lfFaceName), bstrName);
1960
- ExitOnFailure(hr, "Failed to copy font name.");
1974
+ ThmExitOnFailure(hr, "Failed to copy font name.");
1975
1976
hr = XmlGetAttributeNumber(pixn, L"Height", reinterpret_cast<DWORD*>(&lf.lfHeight));
1977
if (S_FALSE == hr)
1978
{
1979
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
1980
}
1967
- ExitOnFailure(hr, "Failed to find font height attribute.");
1981
+ ThmExitOnFailure(hr, "Failed to find font height attribute.");
1982
1983
hr = XmlGetAttributeNumber(pixn, L"Weight", reinterpret_cast<DWORD*>(&lf.lfWeight));
1984
if (S_FALSE == hr)
@@ -1972,7 +1986,7 @@ static HRESULT ParseFonts(
1986
lf.lfWeight = FW_DONTCARE;
1987
hr = S_OK;
1988
}
1975
- ExitOnFailure(hr, "Failed to find font weight attribute.");
1989
+ ThmExitOnFailure(hr, "Failed to find font weight attribute.");
1990
1991
hr = XmlGetYesNoAttribute(pixn, L"Underline", reinterpret_cast<BOOL*>(&lf.lfUnderline));
1992
if (E_NOTFOUND == hr)
@@ -1980,42 +1994,42 @@ static HRESULT ParseFonts(
1994
lf.lfUnderline = FALSE;
1995
hr = S_OK;
1996
}
1983
- ExitOnFailure(hr, "Failed to find font underline attribute.");
1997
+ ThmExitOnFailure(hr, "Failed to find font underline attribute.");
1998
1999
hr = GetFontColor(pixn, L"Foreground", &crForeground, &dwSystemForegroundColor);
1986
- ExitOnFailure(hr, "Failed to find font foreground color.");
2000
+ ThmExitOnFailure(hr, "Failed to find font foreground color.");
2001
2002
hr = GetFontColor(pixn, L"Background", &crBackground, &dwSystemBackgroundColor);
1989
- ExitOnFailure(hr, "Failed to find font background color.");
2003
+ ThmExitOnFailure(hr, "Failed to find font background color.");
2004
2005
THEME_FONT* pFont = pTheme->rgFonts + dwId;
2006
if (pFont->hFont)
2007
{
2008
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
1995
- ExitOnRootFailure(hr, "Theme font id duplicated.");
2009
+ ThmExitOnRootFailure(hr, "Theme font id duplicated.");
2010
}
2011
2012
pFont->hFont = ::CreateFontIndirectW(&lf);
1999
- ExitOnNullWithLastError(pFont->hFont, hr, "Failed to create font %u.", dwId);
2013
+ ThmExitOnNullWithLastError(pFont->hFont, hr, "Failed to create font %u.", dwId);
2014
2015
pFont->crForeground = crForeground;
2016
if (THEME_INVISIBLE_COLORREF != pFont->crForeground)
2017
{
2018
pFont->hForeground = dwSystemForegroundColor ? ::GetSysColorBrush(dwSystemForegroundColor) : ::CreateSolidBrush(pFont->crForeground);
2005
- ExitOnNullWithLastError(pFont->hForeground, hr, "Failed to create text foreground brush.");
2019
+ ThmExitOnNullWithLastError(pFont->hForeground, hr, "Failed to create text foreground brush.");
2020
}
2021
2022
pFont->crBackground = crBackground;
2023
if (THEME_INVISIBLE_COLORREF != pFont->crBackground)
2024
{
2025
pFont->hBackground = dwSystemBackgroundColor ? ::GetSysColorBrush(dwSystemBackgroundColor) : ::CreateSolidBrush(pFont->crBackground);
2012
- ExitOnNullWithLastError(pFont->hBackground, hr, "Failed to create text background brush.");
2026
+ ThmExitOnNullWithLastError(pFont->hBackground, hr, "Failed to create text background brush.");
2027
}
2028
2029
ReleaseNullBSTR(bstrName);
2030
ReleaseNullObject(pixn);
2031
}
2018
- ExitOnFailure(hr, "Failed to enumerate all fonts.");
2032
+ ThmExitOnFailure(hr, "Failed to enumerate all fonts.");
2033
2034
if (S_FALSE == hr)
2035
{
@@ -2049,7 +2063,7 @@ static HRESULT GetFontColor(
2063
*pColorRef = THEME_INVISIBLE_COLORREF;
2064
ExitFunction1(hr = S_OK);
2065
}
2052
- ExitOnFailure(hr, "Failed to find font %ls color.", wzAttributeName);
2066
+ ThmExitOnFailure(hr, "Failed to find font %ls color.", wzAttributeName);
2067
2068
if (pdwSystemColor)
2069
{
@@ -2117,10 +2131,10 @@ static HRESULT ParsePages(
2131
DWORD iPage = 0;
2132
2133
hr = XmlSelectNodes(pElement, L"Page", &pixnl);
2120
- ExitOnFailure(hr, "Failed to find page elements.");
2134
+ ThmExitOnFailure(hr, "Failed to find page elements.");
2135
2136
hr = pixnl->get_length(reinterpret_cast<long*>(&pTheme->cPages));
2123
- ExitOnFailure(hr, "Failed to count the number of theme pages.");
2137
+ ThmExitOnFailure(hr, "Failed to count the number of theme pages.");
2138
2139
if (!pTheme->cPages)
2140
{
@@ -2128,7 +2142,7 @@ static HRESULT ParsePages(
2142
}
2143
2144
pTheme->rgPages = static_cast<THEME_PAGE*>(MemAlloc(sizeof(THEME_PAGE) * pTheme->cPages, TRUE));
2131
- ExitOnNull(pTheme->rgPages, hr, E_OUTOFMEMORY, "Failed to allocate theme pages.");
2145
+ ThmExitOnNull(pTheme->rgPages, hr, E_OUTOFMEMORY, "Failed to allocate theme pages.");
2146
2147
while (S_OK == (hr = XmlNextElement(pixnl, &pixn, &bstrType)))
2148
{
@@ -2141,17 +2155,17 @@ static HRESULT ParsePages(
2155
{
2156
hr = S_OK;
2157
}
2144
- ExitOnFailure(hr, "Failed when querying page Name.");
2158
+ ThmExitOnFailure(hr, "Failed when querying page Name.");
2159
2160
hr = ParseControls(hModule, wzRelativePath, pixn, pTheme, NULL, pPage);
2147
- ExitOnFailure(hr, "Failed to parse page controls.");
2161
+ ThmExitOnFailure(hr, "Failed to parse page controls.");
2162
2163
++iPage;
2164
2165
ReleaseNullBSTR(bstrType);
2166
ReleaseNullObject(pixn);
2167
}
2154
- ExitOnFailure(hr, "Failed to enumerate all pages.");
2168
+ ThmExitOnFailure(hr, "Failed to enumerate all pages.");
2169
2170
if (S_FALSE == hr)
2171
{
@@ -2188,10 +2202,10 @@ static HRESULT ParseImageLists(
2202
int iRetVal = 0;
2203
2204
hr = XmlSelectNodes(pElement, L"ImageList", &pixnlImageLists);
2191
- ExitOnFailure(hr, "Failed to find ImageList elements.");
2205
+ ThmExitOnFailure(hr, "Failed to find ImageList elements.");
2206
2207
hr = pixnlImageLists->get_length(reinterpret_cast<long*>(&pTheme->cImageLists));
2194
- ExitOnFailure(hr, "Failed to count the number of image lists.");
2208
+ ThmExitOnFailure(hr, "Failed to count the number of image lists.");
2209
2210
if (!pTheme->cImageLists)
2211
{
@@ -2199,7 +2213,7 @@ static HRESULT ParseImageLists(
2213
}
2214
2215
pTheme->rgImageLists = static_cast<THEME_IMAGELIST*>(MemAlloc(sizeof(THEME_IMAGELIST) * pTheme->cImageLists, TRUE));
2202
- ExitOnNull(pTheme->rgImageLists, hr, E_OUTOFMEMORY, "Failed to allocate theme image lists.");
2216
+ ThmExitOnNull(pTheme->rgImageLists, hr, E_OUTOFMEMORY, "Failed to allocate theme image lists.");
2217
2218
while (S_OK == (hr = XmlNextElement(pixnlImageLists, &pixnImageList, NULL)))
2219
{
@@ -2208,16 +2222,16 @@ static HRESULT ParseImageLists(
2222
{
2223
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
2224
}
2211
- ExitOnFailure(hr, "Failed to find ImageList/@Name attribute.");
2225
+ ThmExitOnFailure(hr, "Failed to find ImageList/@Name attribute.");
2226
2227
hr = StrAllocString(&pTheme->rgImageLists[dwImageListIndex].sczName, bstr, 0);
2214
- ExitOnFailure(hr, "Failed to make copy of ImageList name.");
2228
+ ThmExitOnFailure(hr, "Failed to make copy of ImageList name.");
2229
2230
hr = XmlSelectNodes(pixnImageList, L"Image", &pixnlImages);
2217
- ExitOnFailure(hr, "Failed to select child Image nodes.");
2231
+ ThmExitOnFailure(hr, "Failed to select child Image nodes.");
2232
2233
hr = pixnlImages->get_length(reinterpret_cast<long*>(&dwImageCount));
2220
- ExitOnFailure(hr, "Failed to count the number of images in list.");
2234
+ ThmExitOnFailure(hr, "Failed to count the number of images in list.");
2235
2236
if (0 < dwImageCount)
2237
{
@@ -2230,20 +2244,20 @@ static HRESULT ParseImageLists(
2244
hBitmap = NULL;
2245
}
2246
hr = ParseImage(hModule, wzRelativePath, pixnImage, &hBitmap);
2233
- ExitOnFailure(hr, "Failed to parse image: %u", i);
2247
+ ThmExitOnFailure(hr, "Failed to parse image: %u", i);
2248
2249
if (0 == i)
2250
{
2251
::GetObjectW(hBitmap, sizeof(BITMAP), &bm);
2252
2253
pTheme->rgImageLists[dwImageListIndex].hImageList = ImageList_Create(bm.bmWidth, bm.bmHeight, ILC_COLOR24, dwImageCount, 0);
2240
- ExitOnNullWithLastError(pTheme->rgImageLists[dwImageListIndex].hImageList, hr, "Failed to create image list.");
2254
+ ThmExitOnNullWithLastError(pTheme->rgImageLists[dwImageListIndex].hImageList, hr, "Failed to create image list.");
2255
}
2256
2257
iRetVal = ImageList_Add(pTheme->rgImageLists[dwImageListIndex].hImageList, hBitmap, NULL);
2258
if (-1 == iRetVal)
2259
{
2246
- ExitWithLastError(hr, "Failed to add image %u to image list.", i);
2260
+ ThmExitWithLastError(hr, "Failed to add image %u to image list.", i);
2261
}
2262
2263
++i;
@@ -2326,13 +2340,13 @@ static HRESULT ParseControls(
2340
GetControls(pTheme, pParentControl, &pcControls, &prgControls);
2341
2342
hr = ParseRadioButtons(hModule, wzRelativePath, pElement, pTheme, pParentControl, pPage);
2329
- ExitOnFailure(hr, "Failed to parse radio buttons.");
2343
+ ThmExitOnFailure(hr, "Failed to parse radio buttons.");
2344
2345
hr = XmlSelectNodes(pElement, L"Billboard|Button|Checkbox|Combobox|CommandLink|Editbox|Hyperlink|Hypertext|ImageControl|Label|ListView|Panel|Progressbar|Richedit|Static|Tabs|TreeView", &pixnl);
2332
- ExitOnFailure(hr, "Failed to find control elements.");
2346
+ ThmExitOnFailure(hr, "Failed to find control elements.");
2347
2348
hr = pixnl->get_length(reinterpret_cast<long*>(&cNewControls));
2335
- ExitOnFailure(hr, "Failed to count the number of theme controls.");
2349
+ ThmExitOnFailure(hr, "Failed to count the number of theme controls.");
2350
2351
if (!cNewControls)
2352
{
@@ -2340,7 +2354,7 @@ static HRESULT ParseControls(
2354
}
2355
2356
hr = MemReAllocArray(reinterpret_cast<LPVOID*>(prgControls), *pcControls, sizeof(THEME_CONTROL), cNewControls);
2343
- ExitOnFailure(hr, "Failed to reallocate theme controls.");
2357
+ ThmExitOnFailure(hr, "Failed to reallocate theme controls.");
2358
2359
cNewControls += *pcControls;
2360
@@ -2360,7 +2374,7 @@ static HRESULT ParseControls(
2374
if (!bstrType)
2375
{
2376
hr = E_UNEXPECTED;
2363
- ExitOnFailure(hr, "Null element encountered!");
2377
+ ThmExitOnFailure(hr, "Null element encountered!");
2378
}
2379
2380
if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"Billboard", -1))
@@ -2441,7 +2455,7 @@ static HRESULT ParseControls(
2455
BOOL fBillboardSizing = pParentControl && THEME_CONTROL_TYPE_BILLBOARD == pParentControl->type;
2456
2457
hr = ParseControl(hModule, wzRelativePath, pixn, pTheme, pControl, fBillboardSizing, pPage);
2444
- ExitOnFailure(hr, "Failed to parse control.");
2458
+ ThmExitOnFailure(hr, "Failed to parse control.");
2459
2460
if (fBillboardSizing)
2461
{
@@ -2463,7 +2477,7 @@ static HRESULT ParseControls(
2477
ReleaseNullBSTR(bstrType);
2478
ReleaseNullObject(pixn);
2479
}
2466
- ExitOnFailure(hr, "Failed to enumerate all controls.");
2480
+ ThmExitOnFailure(hr, "Failed to enumerate all controls.");
2481
2482
if (S_FALSE == hr)
2483
{
@@ -2503,21 +2517,21 @@ static HRESULT ParseControl(
2517
{
2518
hr = S_OK;
2519
}
2506
- ExitOnFailure(hr, "Failed when querying control Name attribute.");
2520
+ ThmExitOnFailure(hr, "Failed when querying control Name attribute.");
2521
2522
hr = XmlGetAttributeEx(pixn, L"EnableCondition", &pControl->sczEnableCondition);
2523
if (E_NOTFOUND == hr)
2524
{
2525
hr = S_OK;
2526
}
2513
- ExitOnFailure(hr, "Failed when querying control EnableCondition attribute.");
2527
+ ThmExitOnFailure(hr, "Failed when querying control EnableCondition attribute.");
2528
2529
hr = XmlGetAttributeEx(pixn, L"VisibleCondition", &pControl->sczVisibleCondition);
2530
if (E_NOTFOUND == hr)
2531
{
2532
hr = S_OK;
2533
}
2520
- ExitOnFailure(hr, "Failed when querying control VisibleCondition attribute.");
2534
+ ThmExitOnFailure(hr, "Failed when querying control VisibleCondition attribute.");
2535
2536
if (!fSkipDimensions)
2537
{
@@ -2526,58 +2540,58 @@ static HRESULT ParseControl(
2540
{
2541
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
2542
}
2529
- ExitOnFailure(hr, "Failed to find control X attribute.");
2543
+ ThmExitOnFailure(hr, "Failed to find control X attribute.");
2544
2545
hr = XmlGetAttributeNumber(pixn, L"Y", reinterpret_cast<DWORD*>(&pControl->nY));
2546
if (S_FALSE == hr)
2547
{
2548
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
2549
}
2536
- ExitOnFailure(hr, "Failed to find control Y attribute.");
2550
+ ThmExitOnFailure(hr, "Failed to find control Y attribute.");
2551
2552
hr = XmlGetAttributeNumber(pixn, L"Height", reinterpret_cast<DWORD*>(&pControl->nHeight));
2553
if (S_FALSE == hr)
2554
{
2555
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
2556
}
2543
- ExitOnFailure(hr, "Failed to find control Height attribute.");
2557
+ ThmExitOnFailure(hr, "Failed to find control Height attribute.");
2558
2559
hr = XmlGetAttributeNumber(pixn, L"Width", reinterpret_cast<DWORD*>(&pControl->nWidth));
2560
if (S_FALSE == hr)
2561
{
2562
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
2563
}
2550
- ExitOnFailure(hr, "Failed to find control Width attribute.");
2564
+ ThmExitOnFailure(hr, "Failed to find control Width attribute.");
2565
}
2566
2567
// Parse the optional background resource image.
2568
hr = ParseImage(hModule, wzRelativePath, pixn, &pControl->hImage);
2555
- ExitOnFailure(hr, "Failed while parsing control image.");
2569
+ ThmExitOnFailure(hr, "Failed while parsing control image.");
2570
2571
hr = XmlGetAttributeNumber(pixn, L"SourceX", reinterpret_cast<DWORD*>(&pControl->nSourceX));
2572
if (S_FALSE == hr)
2573
{
2574
pControl->nSourceX = -1;
2575
}
2562
- ExitOnFailure(hr, "Failed when querying control SourceX attribute.");
2576
+ ThmExitOnFailure(hr, "Failed when querying control SourceX attribute.");
2577
2578
hr = XmlGetAttributeNumber(pixn, L"SourceY", reinterpret_cast<DWORD*>(&pControl->nSourceY));
2579
if (S_FALSE == hr)
2580
{
2581
pControl->nSourceY = -1;
2582
}
2569
- ExitOnFailure(hr, "Failed when querying control SourceY attribute.");
2583
+ ThmExitOnFailure(hr, "Failed when querying control SourceY attribute.");
2584
2585
hr = XmlGetAttributeNumber(pixn, L"FontId", &pControl->dwFontId);
2586
if (S_FALSE == hr)
2587
{
2588
pControl->dwFontId = THEME_INVALID_ID;
2589
}
2576
- ExitOnFailure(hr, "Failed when querying control FontId attribute.");
2590
+ ThmExitOnFailure(hr, "Failed when querying control FontId attribute.");
2591
2592
// Parse the optional window style.
2593
hr = XmlGetAttributeNumberBase(pixn, L"HexStyle", 16, &pControl->dwStyle);
2580
- ExitOnFailure(hr, "Failed when querying control HexStyle attribute.");
2594
+ ThmExitOnFailure(hr, "Failed when querying control HexStyle attribute.");
2595
2596
// Parse the tabstop bit "shortcut nomenclature", this could have been set with the style above.
2597
hr = XmlGetYesNoAttribute(pixn, L"TabStop", &fValue);
@@ -2587,7 +2601,7 @@ static HRESULT ParseControl(
2601
}
2602
else
2603
{
2590
- ExitOnFailure(hr, "Failed when querying control TabStop attribute.");
2604
+ ThmExitOnFailure(hr, "Failed when querying control TabStop attribute.");
2605
2606
if (fValue)
2607
{
@@ -2602,7 +2616,7 @@ static HRESULT ParseControl(
2616
}
2617
else
2618
{
2605
- ExitOnFailure(hr, "Failed when querying control Visible attribute.");
2619
+ ThmExitOnFailure(hr, "Failed when querying control Visible attribute.");
2620
2621
if (fValue)
2622
{
@@ -2617,7 +2631,7 @@ static HRESULT ParseControl(
2631
}
2632
else
2633
{
2620
- ExitOnFailure(hr, "Failed when querying control HideWhenDisabled attribute.");
2634
+ ThmExitOnFailure(hr, "Failed when querying control HideWhenDisabled attribute.");
2635
2636
if (fValue)
2637
{
@@ -2632,22 +2646,22 @@ static HRESULT ParseControl(
2646
}
2647
else
2648
{
2635
- ExitOnFailure(hr, "Failed when querying control DisableAutomaticBehavior attribute.");
2649
+ ThmExitOnFailure(hr, "Failed when querying control DisableAutomaticBehavior attribute.");
2650
}
2651
2652
hr = ParseActions(pixn, pControl);
2639
- ExitOnFailure(hr, "Failed to parse action nodes of the control.");
2653
+ ThmExitOnFailure(hr, "Failed to parse action nodes of the control.");
2654
2655
hr = ParseText(pixn, pControl, &fAnyTextChildren);
2642
- ExitOnFailure(hr, "Failed to parse text nodes of the control.");
2656
+ ThmExitOnFailure(hr, "Failed to parse text nodes of the control.");
2657
2658
hr = ParseTooltips(pixn, pControl, &fAnyTextChildren);
2645
- ExitOnFailure(hr, "Failed to parse control Tooltip.");
2659
+ ThmExitOnFailure(hr, "Failed to parse control Tooltip.");
2660
2661
if (THEME_CONTROL_TYPE_COMMANDLINK == pControl->type)
2662
{
2663
hr = ParseNotes(pixn, pControl, &fAnyNoteChildren);
2650
- ExitOnFailure(hr, "Failed to parse note text nodes of the control.");
2664
+ ThmExitOnFailure(hr, "Failed to parse note text nodes of the control.");
2665
}
2666
2667
if (fAnyTextChildren || fAnyNoteChildren)
@@ -2657,7 +2671,7 @@ static HRESULT ParseControl(
2671
else
2672
{
2673
hr = XmlGetAttributeNumber(pixn, L"StringId", reinterpret_cast<DWORD*>(&pControl->uStringId));
2660
- ExitOnFailure(hr, "Failed when querying control StringId attribute.");
2674
+ ThmExitOnFailure(hr, "Failed when querying control StringId attribute.");
2675
2676
if (S_FALSE == hr)
2677
{
@@ -2671,12 +2685,12 @@ static HRESULT ParseControl(
2685
else
2686
{
2687
hr = XmlGetText(pixn, &bstrText);
2674
- ExitOnFailure(hr, "Failed to get control inner text.");
2688
+ ThmExitOnFailure(hr, "Failed to get control inner text.");
2689
2690
if (S_OK == hr)
2691
{
2692
hr = StrAllocString(&pControl->sczText, bstrText, 0);
2679
- ExitOnFailure(hr, "Failed to copy control text.");
2693
+ ThmExitOnFailure(hr, "Failed to copy control text.");
2694
2695
ReleaseNullBSTR(bstrText);
2696
}
@@ -2695,7 +2709,7 @@ static HRESULT ParseControl(
2709
{
2710
hr = S_OK;
2711
}
2698
- ExitOnFailure(hr, "Failed when querying Billboard/@Loop attribute.");
2712
+ ThmExitOnFailure(hr, "Failed when querying Billboard/@Loop attribute.");
2713
2714
pControl->wBillboardInterval = 5000;
2715
hr = XmlGetAttributeNumber(pixn, L"Interval", &dwValue);
@@ -2703,15 +2717,15 @@ static HRESULT ParseControl(
2717
{
2718
pControl->wBillboardInterval = static_cast<WORD>(dwValue & 0xFFFF);
2719
}
2706
- ExitOnFailure(hr, "Failed when querying Billboard/@Interval attribute.");
2720
+ ThmExitOnFailure(hr, "Failed when querying Billboard/@Interval attribute.");
2721
2722
hr = ParseControls(hModule, wzRelativePath, pixn, pTheme, pControl, pPage);
2709
- ExitOnFailure(hr, "Failed to parse billboard children.");
2723
+ ThmExitOnFailure(hr, "Failed to parse billboard children.");
2724
}
2725
else if (THEME_CONTROL_TYPE_COMMANDLINK == pControl->type)
2726
{
2727
hr = ParseIcon(hModule, wzRelativePath, pixn, &pControl->hIcon);
2714
- ExitOnFailure(hr, "Failed while parsing control icon.");
2728
+ ThmExitOnFailure(hr, "Failed while parsing control icon.");
2729
}
2730
else if (THEME_CONTROL_TYPE_EDITBOX == pControl->type)
2731
{
@@ -2722,7 +2736,7 @@ static HRESULT ParseControl(
2736
}
2737
else
2738
{
2725
- ExitOnFailure(hr, "Failed when querying Editbox/@FileSystemAutoComplete attribute.");
2739
+ ThmExitOnFailure(hr, "Failed when querying Editbox/@FileSystemAutoComplete attribute.");
2740
2741
if (fValue)
2742
{
@@ -2737,14 +2751,14 @@ static HRESULT ParseControl(
2751
{
2752
pControl->dwFontHoverId = THEME_INVALID_ID;
2753
}
2740
- ExitOnFailure(hr, "Failed when querying control HoverFontId attribute.");
2754
+ ThmExitOnFailure(hr, "Failed when querying control HoverFontId attribute.");
2755
2756
hr = XmlGetAttributeNumber(pixn, L"SelectedFontId", &pControl->dwFontSelectedId);
2757
if (S_FALSE == hr)
2758
{
2759
pControl->dwFontSelectedId = THEME_INVALID_ID;
2760
}
2747
- ExitOnFailure(hr, "Failed when querying control SelectedFontId attribute.");
2761
+ ThmExitOnFailure(hr, "Failed when querying control SelectedFontId attribute.");
2762
}
2763
else if (THEME_CONTROL_TYPE_LABEL == pControl->type)
2764
{
@@ -2757,7 +2771,7 @@ static HRESULT ParseControl(
2771
{
2772
pControl->dwStyle |= SS_CENTER;
2773
}
2760
- ExitOnFailure(hr, "Failed when querying Label/@Center attribute.");
2774
+ ThmExitOnFailure(hr, "Failed when querying Label/@Center attribute.");
2775
2776
hr = XmlGetYesNoAttribute(pixn, L"DisablePrefix", &fValue);
2777
if (E_NOTFOUND == hr)
@@ -2768,57 +2782,57 @@ static HRESULT ParseControl(
2782
{
2783
pControl->dwStyle |= SS_NOPREFIX;
2784
}
2771
- ExitOnFailure(hr, "Failed when querying Label/@DisablePrefix attribute.");
2785
+ ThmExitOnFailure(hr, "Failed when querying Label/@DisablePrefix attribute.");
2786
}
2787
else if (THEME_CONTROL_TYPE_LISTVIEW == pControl->type)
2788
{
2789
// Parse the optional extended window style.
2790
hr = XmlGetAttributeNumberBase(pixn, L"HexExtendedStyle", 16, &pControl->dwExtendedStyle);
2777
- ExitOnFailure(hr, "Failed when querying ListView/@HexExtendedStyle attribute.");
2791
+ ThmExitOnFailure(hr, "Failed when querying ListView/@HexExtendedStyle attribute.");
2792
2793
hr = XmlGetAttribute(pixn, L"ImageList", &bstrText);
2794
if (S_FALSE != hr)
2795
{
2782
- ExitOnFailure(hr, "Failed when querying ListView/@ImageList attribute.");
2796
+ ThmExitOnFailure(hr, "Failed when querying ListView/@ImageList attribute.");
2797
2798
hr = FindImageList(pTheme, bstrText, &pControl->rghImageList[0]);
2785
- ExitOnFailure(hr, "Failed to find image list %ls while setting ImageList for ListView.", bstrText);
2799
+ ThmExitOnFailure(hr, "Failed to find image list %ls while setting ImageList for ListView.", bstrText);
2800
}
2801
2802
hr = XmlGetAttribute(pixn, L"ImageListSmall", &bstrText);
2803
if (S_FALSE != hr)
2804
{
2791
- ExitOnFailure(hr, "Failed when querying ListView/@ImageListSmall attribute.");
2805
+ ThmExitOnFailure(hr, "Failed when querying ListView/@ImageListSmall attribute.");
2806
2807
hr = FindImageList(pTheme, bstrText, &pControl->rghImageList[1]);
2794
- ExitOnFailure(hr, "Failed to find image list %ls while setting ImageListSmall for ListView.", bstrText);
2808
+ ThmExitOnFailure(hr, "Failed to find image list %ls while setting ImageListSmall for ListView.", bstrText);
2809
}
2810
2811
hr = XmlGetAttribute(pixn, L"ImageListState", &bstrText);
2812
if (S_FALSE != hr)
2813
{
2800
- ExitOnFailure(hr, "Failed when querying ListView/@ImageListState attribute.");
2814
+ ThmExitOnFailure(hr, "Failed when querying ListView/@ImageListState attribute.");
2815
2816
hr = FindImageList(pTheme, bstrText, &pControl->rghImageList[2]);
2803
- ExitOnFailure(hr, "Failed to find image list %ls while setting ImageListState for ListView.", bstrText);
2817
+ ThmExitOnFailure(hr, "Failed to find image list %ls while setting ImageListState for ListView.", bstrText);
2818
}
2819
2820
hr = XmlGetAttribute(pixn, L"ImageListGroupHeader", &bstrText);
2821
if (S_FALSE != hr)
2822
{
2809
- ExitOnFailure(hr, "Failed when querying ListView/@ImageListGroupHeader attribute.");
2823
+ ThmExitOnFailure(hr, "Failed when querying ListView/@ImageListGroupHeader attribute.");
2824
2825
hr = FindImageList(pTheme, bstrText, &pControl->rghImageList[3]);
2812
- ExitOnFailure(hr, "Failed to find image list %ls while setting ImageListGroupHeader for ListView.", bstrText);
2826
+ ThmExitOnFailure(hr, "Failed to find image list %ls while setting ImageListGroupHeader for ListView.", bstrText);
2827
}
2828
2829
hr = ParseColumns(pixn, pControl);
2816
- ExitOnFailure(hr, "Failed to parse columns.");
2830
+ ThmExitOnFailure(hr, "Failed to parse columns.");
2831
}
2832
else if (THEME_CONTROL_TYPE_PANEL == pControl->type)
2833
{
2834
hr = ParseControls(hModule, wzRelativePath, pixn, pTheme, pControl, pPage);
2821
- ExitOnFailure(hr, "Failed to parse panel children.");
2835
+ ThmExitOnFailure(hr, "Failed to parse panel children.");
2836
}
2837
else if (THEME_CONTROL_TYPE_RADIOBUTTON == pControl->type)
2838
{
@@ -2827,12 +2841,12 @@ static HRESULT ParseControl(
2841
{
2842
hr = S_OK;
2843
}
2830
- ExitOnFailure(hr, "Failed when querying RadioButton/@Value attribute.");
2844
+ ThmExitOnFailure(hr, "Failed when querying RadioButton/@Value attribute.");
2845
}
2846
else if (THEME_CONTROL_TYPE_TAB == pControl->type)
2847
{
2848
hr = ParseTabs(pixn, pControl);
2835
- ExitOnFailure(hr, "Failed to parse tabs");
2849
+ ThmExitOnFailure(hr, "Failed to parse tabs");
2850
}
2851
else if (THEME_CONTROL_TYPE_TREEVIEW == pControl->type)
2852
{
@@ -2847,7 +2861,7 @@ static HRESULT ParseControl(
2861
{
2862
pControl->dwStyle &= ~TVS_DISABLEDRAGDROP;
2863
}
2850
- ExitOnFailure(hr, "Failed when querying TreeView/@EnableDragDrop attribute.");
2864
+ ThmExitOnFailure(hr, "Failed when querying TreeView/@EnableDragDrop attribute.");
2865
2866
hr = XmlGetYesNoAttribute(pixn, L"FullRowSelect", &fValue);
2867
if (E_NOTFOUND == hr)
@@ -2858,7 +2872,7 @@ static HRESULT ParseControl(
2872
{
2873
pControl->dwStyle |= TVS_FULLROWSELECT;
2874
}
2861
- ExitOnFailure(hr, "Failed when querying TreeView/@FullRowSelect attribute.");
2875
+ ThmExitOnFailure(hr, "Failed when querying TreeView/@FullRowSelect attribute.");
2876
2877
hr = XmlGetYesNoAttribute(pixn, L"HasButtons", &fValue);
2878
if (E_NOTFOUND == hr)
@@ -2869,7 +2883,7 @@ static HRESULT ParseControl(
2883
{
2884
pControl->dwStyle |= TVS_HASBUTTONS;
2885
}
2872
- ExitOnFailure(hr, "Failed when querying TreeView/@HasButtons attribute.");
2886
+ ThmExitOnFailure(hr, "Failed when querying TreeView/@HasButtons attribute.");
2887
2888
hr = XmlGetYesNoAttribute(pixn, L"AlwaysShowSelect", &fValue);
2889
if (E_NOTFOUND == hr)
@@ -2880,7 +2894,7 @@ static HRESULT ParseControl(
2894
{
2895
pControl->dwStyle |= TVS_SHOWSELALWAYS;
2896
}
2883
- ExitOnFailure(hr, "Failed when querying TreeView/@AlwaysShowSelect attribute.");
2897
+ ThmExitOnFailure(hr, "Failed when querying TreeView/@AlwaysShowSelect attribute.");
2898
2899
hr = XmlGetYesNoAttribute(pixn, L"LinesAtRoot", &fValue);
2900
if (E_NOTFOUND == hr)
@@ -2891,7 +2905,7 @@ static HRESULT ParseControl(
2905
{
2906
pControl->dwStyle |= TVS_LINESATROOT;
2907
}
2894
- ExitOnFailure(hr, "Failed when querying TreeView/@LinesAtRoot attribute.");
2908
+ ThmExitOnFailure(hr, "Failed when querying TreeView/@LinesAtRoot attribute.");
2909
2910
hr = XmlGetYesNoAttribute(pixn, L"HasLines", &fValue);
2911
if (E_NOTFOUND == hr)
@@ -2902,7 +2916,7 @@ static HRESULT ParseControl(
2916
{
2917
pControl->dwStyle |= TVS_HASLINES;
2918
}
2905
- ExitOnFailure(hr, "Failed when querying TreeView/@HasLines attribute.");
2919
+ ThmExitOnFailure(hr, "Failed when querying TreeView/@HasLines attribute.");
2920
}
2921
2922
LExit:
@@ -2924,15 +2938,15 @@ static HRESULT ParseActions(
2938
BSTR bstrType = NULL;
2939
2940
hr = XmlSelectNodes(pixn, L"BrowseDirectoryAction|ChangePageAction|CloseWindowAction", &pixnl);
2927
- ExitOnFailure(hr, "Failed to select child action nodes.");
2941
+ ThmExitOnFailure(hr, "Failed to select child action nodes.");
2942
2943
hr = pixnl->get_length(reinterpret_cast<long*>(&pControl->cActions));
2930
- ExitOnFailure(hr, "Failed to count the number of action nodes.");
2944
+ ThmExitOnFailure(hr, "Failed to count the number of action nodes.");
2945
2946
if (0 < pControl->cActions)
2947
{
2948
MemAllocArray(reinterpret_cast<LPVOID*>(&pControl->rgActions), sizeof(THEME_ACTION), pControl->cActions);
2935
- ExitOnNull(pControl->rgActions, hr, E_OUTOFMEMORY, "Failed to allocate THEME_ACTION structs.");
2949
+ ThmExitOnNull(pControl->rgActions, hr, E_OUTOFMEMORY, "Failed to allocate THEME_ACTION structs.");
2950
2951
i = 0;
2952
while (S_OK == (hr = XmlNextElement(pixnl, &pixnChild, &bstrType)))
@@ -2940,7 +2954,7 @@ static HRESULT ParseActions(
2954
if (!bstrType)
2955
{
2956
hr = E_UNEXPECTED;
2943
- ExitOnFailure(hr, "Null element encountered!");
2957
+ ThmExitOnFailure(hr, "Null element encountered!");
2958
}
2959
2960
THEME_ACTION* pAction = pControl->rgActions + i;
@@ -2950,19 +2964,19 @@ static HRESULT ParseActions(
2964
pAction->type = THEME_ACTION_TYPE_BROWSE_DIRECTORY;
2965
2966
hr = XmlGetAttributeEx(pixnChild, L"VariableName", &pAction->BrowseDirectory.sczVariableName);
2953
- ExitOnFailure(hr, "Failed when querying BrowseDirectoryAction/@VariableName attribute.");
2967
+ ThmExitOnFailure(hr, "Failed when querying BrowseDirectoryAction/@VariableName attribute.");
2968
}
2969
else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"ChangePageAction", -1))
2970
{
2971
pAction->type = THEME_ACTION_TYPE_CHANGE_PAGE;
2972
2973
hr = XmlGetAttributeEx(pixnChild, L"Page", &pAction->ChangePage.sczPageName);
2960
- ExitOnFailure(hr, "Failed when querying ChangePageAction/@Page attribute.");
2974
+ ThmExitOnFailure(hr, "Failed when querying ChangePageAction/@Page attribute.");
2975
2976
hr = XmlGetYesNoAttribute(pixnChild, L"Cancel", &pAction->ChangePage.fCancel);
2977
if (E_NOTFOUND != hr)
2978
{
2965
- ExitOnFailure(hr, "Failed when querying ChangePageAction/@Cancel attribute.");
2979
+ ThmExitOnFailure(hr, "Failed when querying ChangePageAction/@Cancel attribute.");
2980
}
2981
}
2982
else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrType, -1, L"CloseWindowAction", -1))
@@ -2972,13 +2986,13 @@ static HRESULT ParseActions(
2986
else
2987
{
2988
hr = E_UNEXPECTED;
2975
- ExitOnFailure(hr, "Unexpected element encountered: %ls", bstrType);
2989
+ ThmExitOnFailure(hr, "Unexpected element encountered: %ls", bstrType);
2990
}
2991
2992
hr = XmlGetAttributeEx(pixnChild, L"Condition", &pAction->sczCondition);
2993
if (E_NOTFOUND != hr)
2994
{
2981
- ExitOnFailure(hr, "Failed when querying %ls/@Condition attribute.", bstrType);
2995
+ ThmExitOnFailure(hr, "Failed when querying %ls/@Condition attribute.", bstrType);
2996
}
2997
2998
if (!pAction->sczCondition)
@@ -2986,7 +3000,7 @@ static HRESULT ParseActions(
3000
if (pControl->pDefaultAction)
3001
{
3002
hr = E_INVALIDDATA;
2989
- ExitOnFailure(hr, "Control '%ls' has multiple actions without a condition.", pControl->sczName);
3003
+ ThmExitOnFailure(hr, "Control '%ls' has multiple actions without a condition.", pControl->sczName);
3004
}
3005
3006
pControl->pDefaultAction = pAction;
@@ -3019,38 +3033,38 @@ static HRESULT ParseColumns(
3033
BSTR bstrText = NULL;
3034
3035
hr = XmlSelectNodes(pixn, L"Column", &pixnl);
3022
- ExitOnFailure(hr, "Failed to select child column nodes.");
3036
+ ThmExitOnFailure(hr, "Failed to select child column nodes.");
3037
3038
hr = pixnl->get_length(reinterpret_cast<long*>(&pControl->cColumns));
3025
- ExitOnFailure(hr, "Failed to count the number of control columns.");
3039
+ ThmExitOnFailure(hr, "Failed to count the number of control columns.");
3040
3041
if (0 < pControl->cColumns)
3042
{
3043
hr = MemAllocArray(reinterpret_cast<LPVOID*>(&pControl->ptcColumns), sizeof(THEME_COLUMN), pControl->cColumns);
3030
- ExitOnFailure(hr, "Failed to allocate column structs.");
3044
+ ThmExitOnFailure(hr, "Failed to allocate column structs.");
3045
3046
i = 0;
3047
while (S_OK == (hr = XmlNextElement(pixnl, &pixnChild, NULL)))
3048
{
3049
hr = XmlGetText(pixnChild, &bstrText);
3036
- ExitOnFailure(hr, "Failed to get inner text of column element.");
3050
+ ThmExitOnFailure(hr, "Failed to get inner text of column element.");
3051
3052
hr = XmlGetAttributeNumber(pixnChild, L"Width", reinterpret_cast<DWORD*>(&pControl->ptcColumns[i].nBaseWidth));
3053
if (S_FALSE == hr)
3054
{
3055
pControl->ptcColumns[i].nBaseWidth = 100;
3056
}
3043
- ExitOnFailure(hr, "Failed to get column width attribute.");
3057
+ ThmExitOnFailure(hr, "Failed to get column width attribute.");
3058
3059
hr = XmlGetYesNoAttribute(pixnChild, L"Expands", reinterpret_cast<BOOL*>(&pControl->ptcColumns[i].fExpands));
3060
if (E_NOTFOUND == hr)
3061
{
3062
hr = S_OK;
3063
}
3050
- ExitOnFailure(hr, "Failed to get expands attribute.");
3064
+ ThmExitOnFailure(hr, "Failed to get expands attribute.");
3065
3066
hr = StrAllocString(&(pControl->ptcColumns[i].pszName), bstrText, 0);
3053
- ExitOnFailure(hr, "Failed to copy column name.");
3067
+ ThmExitOnFailure(hr, "Failed to copy column name.");
3068
3069
++i;
3070
ReleaseNullBSTR(bstrText);
@@ -3092,7 +3106,7 @@ static HRESULT ParseRadioButtons(
3106
GetControls(pTheme, pParentControl, &pcControls, &prgControls);
3107
3108
hr = XmlSelectNodes(pixn, L"RadioButtons", &pixnlRadioButtons);
3095
- ExitOnFailure(hr, "Failed to select RadioButtons nodes.");
3109
+ ThmExitOnFailure(hr, "Failed to select RadioButtons nodes.");
3110
3111
while (S_OK == (hr = XmlNextElement(pixnlRadioButtons, &pixnRadioButtons, NULL)))
3112
{
@@ -3101,13 +3115,13 @@ static HRESULT ParseRadioButtons(
3115
{
3116
hr = S_OK;
3117
}
3104
- ExitOnFailure(hr, "Failed when querying RadioButtons Name.");
3118
+ ThmExitOnFailure(hr, "Failed when querying RadioButtons Name.");
3119
3120
hr = XmlSelectNodes(pixnRadioButtons, L"RadioButton", &pixnl);
3107
- ExitOnFailure(hr, "Failed to select RadioButton nodes.");
3121
+ ThmExitOnFailure(hr, "Failed to select RadioButton nodes.");
3122
3123
hr = pixnl->get_length(reinterpret_cast<long*>(&cRadioButtons));
3110
- ExitOnFailure(hr, "Failed to count the number of RadioButton nodes.");
3124
+ ThmExitOnFailure(hr, "Failed to count the number of RadioButton nodes.");
3125
3126
if (cRadioButtons)
3127
{
@@ -3118,7 +3132,7 @@ static HRESULT ParseRadioButtons(
3132
}
3133
3134
hr = MemReAllocArray(reinterpret_cast<LPVOID*>(prgControls), *pcControls, sizeof(THEME_CONTROL), cRadioButtons);
3121
- ExitOnFailure(hr, "Failed to reallocate theme controls.");
3135
+ ThmExitOnFailure(hr, "Failed to reallocate theme controls.");
3136
3137
iControl = *pcControls;
3138
*pcControls += cRadioButtons;
@@ -3131,7 +3145,7 @@ static HRESULT ParseRadioButtons(
3145
pControl->type = THEME_CONTROL_TYPE_RADIOBUTTON;
3146
3147
hr = ParseControl(hModule, wzRelativePath, pixnChild, pTheme, pControl, FALSE, pPage);
3134
- ExitOnFailure(hr, "Failed to parse control.");
3148
+ ThmExitOnFailure(hr, "Failed to parse control.");
3149
3150
if (fFirst)
3151
{
@@ -3140,7 +3154,7 @@ static HRESULT ParseRadioButtons(
3154
}
3155
3156
hr = StrAllocString(&pControl->sczVariable, sczName, 0);
3143
- ExitOnFailure(hr, "Failed to copy radio button variable.");
3157
+ ThmExitOnFailure(hr, "Failed to copy radio button variable.");
3158
3159
if (pPage)
3160
{
@@ -3181,24 +3195,24 @@ static HRESULT ParseTabs(
3195
BSTR bstrText = NULL;
3196
3197
hr = XmlSelectNodes(pixn, L"Tab", &pixnl);
3184
- ExitOnFailure(hr, "Failed to select child tab nodes.");
3198
+ ThmExitOnFailure(hr, "Failed to select child tab nodes.");
3199
3200
hr = pixnl->get_length(reinterpret_cast<long*>(&pControl->cTabs));
3187
- ExitOnFailure(hr, "Failed to count the number of tabs.");
3201
+ ThmExitOnFailure(hr, "Failed to count the number of tabs.");
3202
3203
if (0 < pControl->cTabs)
3204
{
3205
hr = MemAllocArray(reinterpret_cast<LPVOID*>(&pControl->pttTabs), sizeof(THEME_TAB), pControl->cTabs);
3192
- ExitOnFailure(hr, "Failed to allocate tab structs.");
3206
+ ThmExitOnFailure(hr, "Failed to allocate tab structs.");
3207
3208
i = 0;
3209
while (S_OK == (hr = XmlNextElement(pixnl, &pixnChild, NULL)))
3210
{
3211
hr = XmlGetText(pixnChild, &bstrText);
3198
- ExitOnFailure(hr, "Failed to get inner text of tab element.");
3212
+ ThmExitOnFailure(hr, "Failed to get inner text of tab element.");
3213
3214
hr = StrAllocString(&(pControl->pttTabs[i].pszName), bstrText, 0);
3201
- ExitOnFailure(hr, "Failed to copy tab name.");
3215
+ ThmExitOnFailure(hr, "Failed to copy tab name.");
3216
3217
++i;
3218
ReleaseNullBSTR(bstrText);
@@ -3227,17 +3241,17 @@ static HRESULT ParseText(
3241
BSTR bstrText = NULL;
3242
3243
hr = XmlSelectNodes(pixn, L"Text", &pixnl);
3230
- ExitOnFailure(hr, "Failed to select child Text nodes.");
3244
+ ThmExitOnFailure(hr, "Failed to select child Text nodes.");
3245
3246
hr = pixnl->get_length(reinterpret_cast<long*>(&pControl->cConditionalText));
3233
- ExitOnFailure(hr, "Failed to count the number of Text nodes.");
3247
+ ThmExitOnFailure(hr, "Failed to count the number of Text nodes.");
3248
3249
*pfAnyChildren |= 0 < pControl->cConditionalText;
3250
3251
if (0 < pControl->cConditionalText)
3252
{
3253
MemAllocArray(reinterpret_cast<LPVOID*>(&pControl->rgConditionalText), sizeof(THEME_CONDITIONAL_TEXT), pControl->cConditionalText);
3240
- ExitOnNull(pControl->rgConditionalText, hr, E_OUTOFMEMORY, "Failed to allocate THEME_CONDITIONAL_TEXT structs.");
3254
+ ThmExitOnNull(pControl->rgConditionalText, hr, E_OUTOFMEMORY, "Failed to allocate THEME_CONDITIONAL_TEXT structs.");
3255
3256
i = 0;
3257
while (S_OK == (hr = XmlNextElement(pixnl, &pixnChild, NULL)))
@@ -3249,17 +3263,17 @@ static HRESULT ParseText(
3263
{
3264
hr = S_OK;
3265
}
3252
- ExitOnFailure(hr, "Failed when querying Text/@Condition attribute.");
3266
+ ThmExitOnFailure(hr, "Failed when querying Text/@Condition attribute.");
3267
3268
hr = XmlGetText(pixnChild, &bstrText);
3255
- ExitOnFailure(hr, "Failed to get inner text of Text element.");
3269
+ ThmExitOnFailure(hr, "Failed to get inner text of Text element.");
3270
3271
if (S_OK == hr)
3272
{
3273
if (pConditionalText->sczCondition)
3274
{
3275
hr = StrAllocString(&pConditionalText->sczText, bstrText, 0);
3262
- ExitOnFailure(hr, "Failed to copy text to conditional text.");
3276
+ ThmExitOnFailure(hr, "Failed to copy text to conditional text.");
3277
3278
++i;
3279
}
@@ -3268,11 +3282,11 @@ static HRESULT ParseText(
3282
if (pControl->sczText)
3283
{
3284
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
3271
- ExitOnFailure(hr, "Unconditional text for the '%ls' control is specified multiple times.", pControl->sczName);
3285
+ ThmExitOnFailure(hr, "Unconditional text for the '%ls' control is specified multiple times.", pControl->sczName);
3286
}
3287
3288
hr = StrAllocString(&pControl->sczText, bstrText, 0);
3275
- ExitOnFailure(hr, "Failed to copy text to control.");
3289
+ ThmExitOnFailure(hr, "Failed to copy text to control.");
3290
3291
// Unconditional text entries aren't stored in the conditional text list.
3292
--pControl->cConditionalText;
@@ -3303,19 +3317,19 @@ static HRESULT ParseTooltips(
3317
BSTR bstrText = NULL;
3318
3319
hr = XmlSelectSingleNode(pixn, L"Tooltip", &pixnChild);
3306
- ExitOnFailure(hr, "Failed to select child Tooltip node.");
3320
+ ThmExitOnFailure(hr, "Failed to select child Tooltip node.");
3321
3322
if (S_OK == hr)
3323
{
3324
*pfAnyChildren |= TRUE;
3325
3326
hr = XmlGetText(pixnChild, &bstrText);
3313
- ExitOnFailure(hr, "Failed to get inner text of Tooltip element.");
3327
+ ThmExitOnFailure(hr, "Failed to get inner text of Tooltip element.");
3328
3329
if (S_OK == hr)
3330
{
3331
hr = StrAllocString(&pControl->sczTooltip, bstrText, 0);
3318
- ExitOnFailure(hr, "Failed to copy tooltip text to control.");
3332
+ ThmExitOnFailure(hr, "Failed to copy tooltip text to control.");
3333
}
3334
}
3335
@@ -3340,10 +3354,10 @@ static HRESULT ParseNotes(
3354
BSTR bstrText = NULL;
3355
3356
hr = XmlSelectNodes(pixn, L"Note", &pixnl);
3343
- ExitOnFailure(hr, "Failed to select child Note nodes.");
3357
+ ThmExitOnFailure(hr, "Failed to select child Note nodes.");
3358
3359
hr = pixnl->get_length(reinterpret_cast<long*>(&pControl->cConditionalNotes));
3346
- ExitOnFailure(hr, "Failed to count the number of Note nodes.");
3360
+ ThmExitOnFailure(hr, "Failed to count the number of Note nodes.");
3361
3362
if (pfAnyChildren)
3363
{
@@ -3353,7 +3367,7 @@ static HRESULT ParseNotes(
3367
if (0 < pControl->cConditionalNotes)
3368
{
3369
MemAllocArray(reinterpret_cast<LPVOID*>(&pControl->rgConditionalNotes), sizeof(THEME_CONDITIONAL_TEXT), pControl->cConditionalNotes);
3356
- ExitOnNull(pControl->rgConditionalNotes, hr, E_OUTOFMEMORY, "Failed to allocate note THEME_CONDITIONAL_TEXT structs.");
3370
+ ThmExitOnNull(pControl->rgConditionalNotes, hr, E_OUTOFMEMORY, "Failed to allocate note THEME_CONDITIONAL_TEXT structs.");
3371
3372
i = 0;
3373
while (S_OK == (hr = XmlNextElement(pixnl, &pixnChild, NULL)))
@@ -3365,17 +3379,17 @@ static HRESULT ParseNotes(
3379
{
3380
hr = S_OK;
3381
}
3368
- ExitOnFailure(hr, "Failed when querying Note/@Condition attribute.");
3382
+ ThmExitOnFailure(hr, "Failed when querying Note/@Condition attribute.");
3383
3384
hr = XmlGetText(pixnChild, &bstrText);
3371
- ExitOnFailure(hr, "Failed to get inner text of Note element.");
3385
+ ThmExitOnFailure(hr, "Failed to get inner text of Note element.");
3386
3387
if (S_OK == hr)
3388
{
3389
if (pConditionalNote->sczCondition)
3390
{
3391
hr = StrAllocString(&pConditionalNote->sczText, bstrText, 0);
3378
- ExitOnFailure(hr, "Failed to copy text to conditional note text.");
3392
+ ThmExitOnFailure(hr, "Failed to copy text to conditional note text.");
3393
3394
++i;
3395
}
@@ -3384,11 +3398,11 @@ static HRESULT ParseNotes(
3398
if (pControl->sczNote)
3399
{
3400
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
3387
- ExitOnFailure(hr, "Unconditional note text for the '%ls' control is specified multiple times.", pControl->sczName);
3401
+ ThmExitOnFailure(hr, "Unconditional note text for the '%ls' control is specified multiple times.", pControl->sczName);
3402
}
3403
3404
hr = StrAllocString(&pControl->sczNote, bstrText, 0);
3391
- ExitOnFailure(hr, "Failed to copy text to command link control.");
3405
+ ThmExitOnFailure(hr, "Failed to copy text to command link control.");
3406
3407
// Unconditional note entries aren't stored in the conditional notes list.
3408
--pControl->cConditionalNotes;
@@ -3427,7 +3441,7 @@ static HRESULT StartBillboard(
3441
3442
if (!::SetTimer(pTheme->hwndParent, pControl->wId, pControl->wBillboardInterval, NULL))
3443
{
3430
- ExitWithLastError(hr, "Failed to start billboard.");
3444
+ ThmExitWithLastError(hr, "Failed to start billboard.");
3445
}
3446
3447
hr = S_OK;
@@ -3865,7 +3879,7 @@ static DWORD CALLBACK RichEditStreamFromFileHandleCallback(
3879
3880
if (!::ReadFile(hFile, pbBuff, cb, reinterpret_cast<DWORD*>(pcb), NULL))
3881
{
3868
- ExitWithLastError(hr, "Failed to read file");
3882
+ ThmExitWithLastError(hr, "Failed to read file");
3883
}
3884
3885
LExit:
@@ -3967,17 +3981,17 @@ static void OnBrowseDirectory(
3981
if (pTargetControl && THEME_CONTROL_TYPE_EDITBOX == pTargetControl->type && !pTargetControl->fDisableVariableFunctionality)
3982
{
3983
hr = ThemeSetTextControl(pTheme, pTargetControl->wId, wzPath);
3970
- ExitOnFailure(hr, "Failed to set text on editbox: %ls", pTargetControl->sczName);
3984
+ ThmExitOnFailure(hr, "Failed to set text on editbox: %ls", pTargetControl->sczName);
3985
}
3986
else if (pTheme->pfnSetStringVariable)
3987
{
3988
hr = pTheme->pfnSetStringVariable(pAction->BrowseDirectory.sczVariableName, wzPath, pTheme->pvVariableContext);
3975
- ExitOnFailure(hr, "Failed to set variable: %ls", pAction->BrowseDirectory.sczVariableName);
3989
+ ThmExitOnFailure(hr, "Failed to set variable: %ls", pAction->BrowseDirectory.sczVariableName);
3990
}
3991
else if (pTargetControl)
3992
{
3993
hr = ThemeSetTextControl(pTheme, pTargetControl->wId, wzPath);
3980
- ExitOnFailure(hr, "Failed to set text on control: %ls", pTargetControl->sczName);
3994
+ ThmExitOnFailure(hr, "Failed to set text on control: %ls", pTargetControl->sczName);
3995
}
3996
3997
ThemeShowPageEx(pTheme, pTheme->dwCurrentPageId, SW_SHOW, THEME_SHOW_PAGE_REASON_REFRESH);
@@ -4019,7 +4033,7 @@ static BOOL OnButtonClicked(
4033
BOOL fCondition = FALSE;
4034
4035
hr = pTheme->pfnEvaluateCondition(pAction->sczCondition, &fCondition, pTheme->pvVariableContext);
4022
- ExitOnFailure(hr, "Failed to evaluate condition: %ls", pAction->sczCondition);
4036
+ ThmExitOnFailure(hr, "Failed to evaluate condition: %ls", pAction->sczCondition);
4037
4038
if (fCondition)
4039
{
@@ -4049,7 +4063,7 @@ static BOOL OnButtonClicked(
4063
4064
if (!dwPageId)
4065
{
4052
- ExitOnFailure(E_INVALIDDATA, "Unknown page: %ls", pChosenAction->ChangePage.sczPageName);
4066
+ ThmExitOnFailure(E_INVALIDDATA, "Unknown page: %ls", pChosenAction->ChangePage.sczPageName);
4067
}
4068
4069
ThemeShowPageEx(pTheme, pTheme->dwCurrentPageId, SW_HIDE, pChosenAction->ChangePage.fCancel ? THEME_SHOW_PAGE_REASON_CANCEL : THEME_SHOW_PAGE_REASON_DEFAULT);
@@ -4108,7 +4122,7 @@ static HRESULT OnRichEditEnLink(
4122
case WM_LBUTTONDOWN:
4123
{
4124
hr = StrAlloc(&sczLink, link->chrg.cpMax - link->chrg.cpMin + 2);
4111
- ExitOnFailure(hr, "Failed to allocate string for link.");
4125
+ ThmExitOnFailure(hr, "Failed to allocate string for link.");
4126
4127
TEXTRANGEW tr;
4128
tr.chrg.cpMin = link->chrg.cpMin;
@@ -4118,7 +4132,7 @@ static HRESULT OnRichEditEnLink(
4132
if (0 < ::SendMessageW(hWndRichEdit, EM_GETTEXTRANGE, 0, reinterpret_cast<LPARAM>(&tr)))
4133
{
4134
hr = ShelExec(sczLink, NULL, L"open", NULL, SW_SHOWDEFAULT, hWnd, NULL);
4121
- ExitOnFailure(hr, "Failed to launch link: %ls", sczLink);
4135
+ ThmExitOnFailure(hr, "Failed to launch link: %ls", sczLink);
4136
}
4137
4138
break;
@@ -4209,7 +4223,7 @@ static HRESULT SizeListViewColumns(
4223
4224
if (!::GetWindowRect(pControl->hWnd, &rcParent))
4225
{
4212
- ExitWithLastError(hr, "Failed to get window rect of listview control.");
4226
+ ThmExitWithLastError(hr, "Failed to get window rect of listview control.");
4227
}
4228
4229
iExtraAvailableSize = rcParent.right - rcParent.left;
@@ -4270,10 +4284,10 @@ static HRESULT ShowControl(
4284
fSaveEditboxes && THEME_CONTROL_TYPE_EDITBOX == pControl->type && pControl->sczName && *pControl->sczName)
4285
{
4286
hr = ThemeGetTextControl(pTheme, pControl->wId, &sczText);
4273
- ExitOnFailure(hr, "Failed to get the text for control: %ls", pControl->sczName);
4287
+ ThmExitOnFailure(hr, "Failed to get the text for control: %ls", pControl->sczName);
4288
4289
hr = pTheme->pfnSetStringVariable(pControl->sczName, sczText, pTheme->pvVariableContext);
4276
- ExitOnFailure(hr, "Failed to set the variable '%ls' to '%ls'", pControl->sczName, sczText);
4290
+ ThmExitOnFailure(hr, "Failed to set the variable '%ls' to '%ls'", pControl->sczName, sczText);
4291
}
4292
4293
HWND hWnd = pControl->hWnd;
@@ -4301,14 +4315,14 @@ static HRESULT ShowControl(
4315
if (pControl->sczVisibleCondition)
4316
{
4317
hr = pTheme->pfnEvaluateCondition(pControl->sczVisibleCondition, &fVisible, pTheme->pvVariableContext);
4304
- ExitOnFailure(hr, "Failed to evaluate VisibleCondition: %ls", pControl->sczVisibleCondition);
4318
+ ThmExitOnFailure(hr, "Failed to evaluate VisibleCondition: %ls", pControl->sczVisibleCondition);
4319
}
4320
4321
// If the control has an EnableCondition, check if it's true.
4322
if (pControl->sczEnableCondition)
4323
{
4324
hr = pTheme->pfnEvaluateCondition(pControl->sczEnableCondition, &fEnabled, pTheme->pvVariableContext);
4311
- ExitOnFailure(hr, "Failed to evaluate EnableCondition: %ls", pControl->sczEnableCondition);
4325
+ ThmExitOnFailure(hr, "Failed to evaluate EnableCondition: %ls", pControl->sczEnableCondition);
4326
}
4327
}
4328
@@ -4332,7 +4346,7 @@ static HRESULT ShowControl(
4346
BOOL fCondition = FALSE;
4347
4348
hr = pTheme->pfnEvaluateCondition(pConditionalText->sczCondition, &fCondition, pTheme->pvVariableContext);
4335
- ExitOnFailure(hr, "Failed to evaluate condition: %ls", pConditionalText->sczCondition);
4349
+ ThmExitOnFailure(hr, "Failed to evaluate condition: %ls", pConditionalText->sczCondition);
4350
4351
if (fCondition)
4352
{
@@ -4352,7 +4366,7 @@ static HRESULT ShowControl(
4366
BOOL fCondition = FALSE;
4367
4368
hr = pTheme->pfnEvaluateCondition(pConditionalNote->sczCondition, &fCondition, pTheme->pvVariableContext);
4355
- ExitOnFailure(hr, "Failed to evaluate note condition: %ls", pConditionalNote->sczCondition);
4369
+ ThmExitOnFailure(hr, "Failed to evaluate note condition: %ls", pConditionalNote->sczCondition);
4370
4371
if (fCondition)
4372
{
@@ -4366,7 +4380,7 @@ static HRESULT ShowControl(
4380
if (wzText && *wzText)
4381
{
4382
hr = pTheme->pfnFormatString(wzText, &sczText, pTheme->pvVariableContext);
4369
- ExitOnFailure(hr, "Failed to format string: %ls", wzText);
4383
+ ThmExitOnFailure(hr, "Failed to format string: %ls", wzText);
4384
}
4385
else
4386
{
@@ -4378,7 +4392,7 @@ static HRESULT ShowControl(
4392
if (wzNote && *wzNote)
4393
{
4394
hr = pTheme->pfnFormatString(wzNote, &sczText, pTheme->pvVariableContext);
4381
- ExitOnFailure(hr, "Failed to format note: %ls", wzNote);
4395
+ ThmExitOnFailure(hr, "Failed to format note: %ls", wzNote);
4396
}
4397
else
4398
{
@@ -4401,7 +4415,7 @@ static HRESULT ShowControl(
4415
{
4416
hr = S_OK;
4417
}
4404
- ExitOnFailure(hr, "Failed to get numeric variable: %ls", pControl->sczName);
4418
+ ThmExitOnFailure(hr, "Failed to get numeric variable: %ls", pControl->sczName);
4419
4420
if (THEME_SHOW_PAGE_REASON_REFRESH != reason && pPage && pControl->wPageId)
4421
{
@@ -4411,7 +4425,7 @@ static HRESULT ShowControl(
4425
if (SUCCEEDED(hr))
4426
{
4427
hr = StrAllocFormattedSecure(&pSavedVariable->sczValue, L"%lld", llValue);
4414
- ExitOnFailure(hr, "Failed to save variable: %ls", pControl->sczName);
4428
+ ThmExitOnFailure(hr, "Failed to save variable: %ls", pControl->sczName);
4429
}
4430
4431
++iPageControl;
@@ -4431,7 +4445,7 @@ static HRESULT ShowControl(
4445
}
4446
else
4447
{
4434
- ExitOnFailure(hr, "Failed to get string variable: %ls", pControl->sczName);
4448
+ ThmExitOnFailure(hr, "Failed to get string variable: %ls", pControl->sczName);
4449
}
4450
4451
if (THEME_SHOW_PAGE_REASON_REFRESH != reason && pPage && pControl->wPageId)
@@ -4442,7 +4456,7 @@ static HRESULT ShowControl(
4456
if (SUCCEEDED(hr))
4457
{
4458
hr = StrAllocStringSecure(&pSavedVariable->sczValue, sczText, 0);
4445
- ExitOnFailure(hr, "Failed to save variable: %ls", pControl->sczName);
4459
+ ThmExitOnFailure(hr, "Failed to save variable: %ls", pControl->sczName);
4460
}
4461
4462
++iPageControl;
@@ -4463,7 +4477,7 @@ static HRESULT ShowControl(
4477
}
4478
else
4479
{
4466
- ExitOnFailure(hr, "Failed to get string variable: %ls", pControl->sczVariable);
4480
+ ThmExitOnFailure(hr, "Failed to get string variable: %ls", pControl->sczVariable);
4481
}
4482
4483
if (THEME_SHOW_PAGE_REASON_REFRESH != reason && pPage && pControl->wPageId && pControl->fLastRadioButton)
@@ -4474,7 +4488,7 @@ static HRESULT ShowControl(
4488
if (SUCCEEDED(hr))
4489
{
4490
hr = StrAllocStringSecure(&pSavedVariable->sczValue, sczText, 0);
4477
- ExitOnFailure(hr, "Failed to save variable: %ls", pControl->sczVariable);
4491
+ ThmExitOnFailure(hr, "Failed to save variable: %ls", pControl->sczVariable);
4492
}
4493
4494
++iPageControl;
@@ -4552,7 +4566,7 @@ static HRESULT ShowControls(
4566
if (!pControl->wPageId || pControl->wPageId == dwPageId)
4567
{
4568
hr = ShowControl(pTheme, pControl, nCmdShow, fSaveEditboxes, reason, dwPageId, &hwndFocus);
4555
- ExitOnFailure(hr, "Failed to show control '%ls' at index %d.", pControl->sczName, i);
4569
+ ThmExitOnFailure(hr, "Failed to show control '%ls' at index %d.", pControl->sczName, i);
4570
}
4571
}
4572
@@ -4702,7 +4716,7 @@ static HRESULT LoadControls(
4716
else
4717
{
4718
hr = HRESULT_FROM_WIN32(ERROR_INVALID_DATA);
4705
- ExitOnRootFailure(hr, "Invalid image or image list coordinates.");
4719
+ ThmExitOnRootFailure(hr, "Invalid image or image list coordinates.");
4720
}
4721
break;
4722
@@ -4746,7 +4760,7 @@ static HRESULT LoadControls(
4760
if (!vhModuleRichEd)
4761
{
4762
hr = LoadSystemLibrary(L"Riched20.dll", &vhModuleRichEd);
4749
- ExitOnFailure(hr, "Failed to load Rich Edit control library.");
4763
+ ThmExitOnFailure(hr, "Failed to load Rich Edit control library.");
4764
}
4765
wzWindowClass = RICHEDIT_CLASSW;
4766
dwWindowBits |= ES_AUTOVSCROLL | ES_MULTILINE | WS_VSCROLL | ES_READONLY;
@@ -4765,7 +4779,7 @@ static HRESULT LoadControls(
4779
wzWindowClass = WC_TREEVIEWW;
4780
break;
4781
}
4768
- ExitOnNull(wzWindowClass, hr, E_INVALIDDATA, "Failed to configure control %u because of unknown type: %u", i, pControl->type);
4782
+ ThmExitOnNull(wzWindowClass, hr, E_INVALIDDATA, "Failed to configure control %u because of unknown type: %u", i, pControl->type);
4783
4784
// Default control ids to the theme id and its index in the control array, unless there
4785
// is a specific id to assign to a named control.
@@ -4791,7 +4805,7 @@ static HRESULT LoadControls(
4805
if (fVisible && pControl->sczVisibleCondition && pTheme->pfnEvaluateCondition && !pControl->fDisableVariableFunctionality)
4806
{
4807
hr = pTheme->pfnEvaluateCondition(pControl->sczVisibleCondition, &fVisible, pTheme->pvVariableContext);
4794
- ExitOnFailure(hr, "Failed to evaluate VisibleCondition: %ls", pControl->sczVisibleCondition);
4808
+ ThmExitOnFailure(hr, "Failed to evaluate VisibleCondition: %ls", pControl->sczVisibleCondition);
4809
4810
if (!fVisible)
4811
{
@@ -4812,7 +4826,7 @@ static HRESULT LoadControls(
4826
BOOL fEnable = TRUE;
4827
4828
hr = pTheme->pfnEvaluateCondition(pControl->sczEnableCondition, &fEnable, pTheme->pvVariableContext);
4815
- ExitOnFailure(hr, "Failed to evaluate EnableCondition: %ls", pControl->sczEnableCondition);
4829
+ ThmExitOnFailure(hr, "Failed to evaluate EnableCondition: %ls", pControl->sczEnableCondition);
4830
4831
fDisabled = !fEnable;
4832
dwWindowBits |= fDisabled ? WS_DISABLED : 0;
@@ -4826,7 +4840,7 @@ static HRESULT LoadControls(
4840
}
4841
4842
pControl->hWnd = ::CreateWindowExW(dwWindowExBits, wzWindowClass, pControl->sczText, pControl->dwStyle | dwWindowBits, x, y, w, h, hwndParent, reinterpret_cast<HMENU>(wControlId), NULL, pTheme);
4829
- ExitOnNullWithLastError(pControl->hWnd, hr, "Failed to create window.");
4843
+ ThmExitOnNullWithLastError(pControl->hWnd, hr, "Failed to create window.");
4844
4845
if (pControl->sczTooltip)
4846
{
@@ -4875,7 +4889,7 @@ static HRESULT LoadControls(
4889
::SendMessageW(pControl->hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, pControl->dwExtendedStyle);
4890
4891
hr = SizeListViewColumns(pControl);
4878
- ExitOnFailure(hr, "Failed to get size of list view columns.");
4892
+ ThmExitOnFailure(hr, "Failed to get size of list view columns.");
4893
4894
for (DWORD j = 0; j < pControl->cColumns; ++j)
4895
{
@@ -4889,7 +4903,7 @@ static HRESULT LoadControls(
4903
4904
if (-1 == ::SendMessageW(pControl->hWnd, LVM_INSERTCOLUMNW, (WPARAM) (int) (j), (LPARAM) (const LV_COLUMNW *) (&lvc)))
4905
{
4892
- ExitWithLastError(hr, "Failed to insert listview column %u into tab control.", j);
4906
+ ThmExitWithLastError(hr, "Failed to insert listview column %u into tab control.", j);
4907
}
4908
4909
// Return value tells us the old image list, we don't care.
@@ -4938,7 +4952,7 @@ static HRESULT LoadControls(
4952
4953
if (-1 == ::SendMessageW(pControl->hWnd, TCM_INSERTITEMW, (WPARAM) (int) (j), (LPARAM) (const TC_ITEMW *) (&tci)))
4954
{
4941
- ExitWithLastError(hr, "Failed to insert tab %u into tab control.", j);
4955
+ ThmExitWithLastError(hr, "Failed to insert tab %u into tab control.", j);
4956
}
4957
}
4958
}
@@ -4961,7 +4975,7 @@ static HRESULT LoadControls(
4975
if (pControl->cControls)
4976
{
4977
hr = LoadControls(pTheme, pControl, pControl->hWnd, rgAssignControlIds, cAssignControlIds);
4964
- ExitOnFailure(hr, "Failed to load child controls.");
4978
+ ThmExitOnFailure(hr, "Failed to load child controls.");
4979
}
4980
}
4981
@@ -4983,7 +4997,7 @@ static HRESULT LocalizeControls(
4997
{
4998
THEME_CONTROL* pControl = rgControls + i;
4999
hr = LocalizeControl(pControl, pWixLoc);
4986
- ExitOnFailure(hr, "Failed to localize control: %ls", pControl->sczName);
5000
+ ThmExitOnFailure(hr, "Failed to localize control: %ls", pControl->sczName);
5001
}
5002
5003
LExit:
@@ -5002,59 +5016,59 @@ static HRESULT LocalizeControl(
5016
if (pControl->sczText && *pControl->sczText)
5017
{
5018
hr = LocLocalizeString(pWixLoc, &pControl->sczText);
5005
- ExitOnFailure(hr, "Failed to localize control text.");
5019
+ ThmExitOnFailure(hr, "Failed to localize control text.");
5020
}
5021
else if (pControl->sczName)
5022
{
5023
LOC_STRING* plocString = NULL;
5024
5025
hr = StrAllocFormatted(&sczLocStringId, L"#(loc.%ls)", pControl->sczName);
5012
- ExitOnFailure(hr, "Failed to format loc string id: %ls", pControl->sczName);
5026
+ ThmExitOnFailure(hr, "Failed to format loc string id: %ls", pControl->sczName);
5027
5028
hr = LocGetString(pWixLoc, sczLocStringId, &plocString);
5029
if (E_NOTFOUND != hr)
5030
{
5017
- ExitOnFailure(hr, "Failed to get loc string: %ls", pControl->sczName);
5031
+ ThmExitOnFailure(hr, "Failed to get loc string: %ls", pControl->sczName);
5032
5033
hr = StrAllocString(&pControl->sczText, plocString->wzText, 0);
5020
- ExitOnFailure(hr, "Failed to copy loc string to control: %ls", plocString->wzText);
5034
+ ThmExitOnFailure(hr, "Failed to copy loc string to control: %ls", plocString->wzText);
5035
}
5036
}
5037
5038
if (pControl->sczTooltip && *pControl->sczTooltip)
5039
{
5040
hr = LocLocalizeString(pWixLoc, &pControl->sczTooltip);
5027
- ExitOnFailure(hr, "Failed to localize control tooltip text.");
5041
+ ThmExitOnFailure(hr, "Failed to localize control tooltip text.");
5042
}
5043
5044
if (pControl->sczNote && *pControl->sczNote)
5045
{
5046
hr = LocLocalizeString(pWixLoc, &pControl->sczNote);
5033
- ExitOnFailure(hr, "Failed to localize control note text.");
5047
+ ThmExitOnFailure(hr, "Failed to localize control note text.");
5048
}
5049
5050
for (DWORD j = 0; j < pControl->cConditionalText; ++j)
5051
{
5052
hr = LocLocalizeString(pWixLoc, &pControl->rgConditionalText[j].sczText);
5039
- ExitOnFailure(hr, "Failed to localize conditional text.");
5053
+ ThmExitOnFailure(hr, "Failed to localize conditional text.");
5054
}
5055
5056
for (DWORD j = 0; j < pControl->cConditionalNotes; ++j)
5057
{
5058
hr = LocLocalizeString(pWixLoc, &pControl->rgConditionalNotes[j].sczText);
5045
- ExitOnFailure(hr, "Failed to localize conditional note.");
5059
+ ThmExitOnFailure(hr, "Failed to localize conditional note.");
5060
}
5061
5062
for (DWORD j = 0; j < pControl->cColumns; ++j)
5063
{
5064
hr = LocLocalizeString(pWixLoc, &pControl->ptcColumns[j].pszName);
5051
- ExitOnFailure(hr, "Failed to localize column text.");
5065
+ ThmExitOnFailure(hr, "Failed to localize column text.");
5066
}
5067
5068
for (DWORD j = 0; j < pControl->cTabs; ++j)
5069
{
5070
hr = LocLocalizeString(pWixLoc, &pControl->pttTabs[j].pszName);
5057
- ExitOnFailure(hr, "Failed to localize tab text.");
5071
+ ThmExitOnFailure(hr, "Failed to localize tab text.");
5072
}
5073
5074
// Localize control's size, location, and text.
@@ -5065,7 +5079,7 @@ static HRESULT LocalizeControl(
5079
{
5080
ExitFunction1(hr = S_OK);
5081
}
5068
- ExitOnFailure(hr, "Failed to localize control.");
5082
+ ThmExitOnFailure(hr, "Failed to localize control.");
5083
5084
if (LOC_CONTROL_NOT_SET != pLocControl->nX)
5085
{
@@ -5090,7 +5104,7 @@ static HRESULT LocalizeControl(
5104
if (pLocControl->wzText && *pLocControl->wzText)
5105
{
5106
hr = StrAllocString(&pControl->sczText, pLocControl->wzText, 0);
5093
- ExitOnFailure(hr, "Failed to localize control text.");
5107
+ ThmExitOnFailure(hr, "Failed to localize control text.");
5108
}
5109
}
5110
@@ -5114,7 +5128,7 @@ static HRESULT LoadControlsString(
5128
{
5129
THEME_CONTROL* pControl = rgControls + i;
5130
hr = LoadControlString(pControl, hResModule);
5117
- ExitOnFailure(hr, "Failed to load string for control: %ls", pControl->sczName);
5131
+ ThmExitOnFailure(hr, "Failed to load string for control: %ls", pControl->sczName);
5132
}
5133
5134
LExit:
@@ -5130,14 +5144,14 @@ static HRESULT LoadControlString(
5144
if (UINT_MAX != pControl->uStringId)
5145
{
5146
hr = ResReadString(hResModule, pControl->uStringId, &pControl->sczText);
5133
- ExitOnFailure(hr, "Failed to load control text.");
5147
+ ThmExitOnFailure(hr, "Failed to load control text.");
5148
5149
for (DWORD j = 0; j < pControl->cColumns; ++j)
5150
{
5151
if (UINT_MAX != pControl->ptcColumns[j].uStringId)
5152
{
5153
hr = ResReadString(hResModule, pControl->ptcColumns[j].uStringId, &pControl->ptcColumns[j].pszName);
5140
- ExitOnFailure(hr, "Failed to load column text.");
5154
+ ThmExitOnFailure(hr, "Failed to load column text.");
5155
}
5156
}
5157
@@ -5146,7 +5160,7 @@ static HRESULT LoadControlString(
5160
if (UINT_MAX != pControl->pttTabs[j].uStringId)
5161
{
5162
hr = ResReadString(hResModule, pControl->pttTabs[j].uStringId, &pControl->pttTabs[j].pszName);
5149
- ExitOnFailure(hr, "Failed to load tab text.");
5163
+ ThmExitOnFailure(hr, "Failed to load tab text.");
5164
}
5165
}
5166
}