@joebigelow / wix / commits / 992ca1b2

Update wixstdba to show theme load errors.

Sean Hall committed Jul 1, 2020 at 21:38 UTC 992ca1b24e981fa42eab8cbd8e170819deb34ea7
1 file changed +37
src/wixstdba/wixstdba.cpp
+37
@@ -5,6 +5,16 @@
5 static HINSTANCE vhInstance = NULL;
6 static IBootstrapperApplication* vpApplication = NULL;
7
8 +static void CALLBACK WixstdbaTraceError(
9 + __in_z LPCSTR szFile,
10 + __in int iLine,
11 + __in REPORT_LEVEL rl,
12 + __in UINT source,
13 + __in HRESULT hrError,
14 + __in_z __format_string LPCSTR szFormat,
15 + __in va_list args
16 + );
17 +
18 extern "C" BOOL WINAPI DllMain(
19 IN HINSTANCE hInstance,
20 IN DWORD dwReason,
@@ -35,6 +45,8 @@ extern "C" HRESULT WINAPI BootstrapperApplicationCreate(
45 HRESULT hr = S_OK;
46 IBootstrapperEngine* pEngine = NULL;
47
48 + DutilInitialize(&WixstdbaTraceError);
49 +
50 hr = BalInitializeFromCreateArgs(pArgs, &pEngine);
51 ExitOnFailure(hr, "Failed to initialize Bal.");
52
@@ -52,6 +64,7 @@ extern "C" void WINAPI BootstrapperApplicationDestroy()
64 {
65 ReleaseNullObject(vpApplication);
66 BalUninitialize();
67 + DutilUninitialize();
68 }
69
70
@@ -64,6 +77,8 @@ extern "C" HRESULT WINAPI DncPrereqBootstrapperApplicationCreate(
77 {
78 HRESULT hr = S_OK;
79
80 + DutilInitialize(&WixstdbaTraceError);
81 +
82 BalInitialize(pEngine);
83
84 hr = CreateBootstrapperApplication(vhInstance, TRUE, hrHostInitialization, pEngine, pArgs, pResults, &vpApplication);
@@ -78,6 +93,7 @@ extern "C" void WINAPI DncPrereqBootstrapperApplicationDestroy()
93 {
94 ReleaseNullObject(vpApplication);
95 BalUninitialize();
96 + DutilUninitialize();
97 }
98
99
@@ -90,6 +106,8 @@ extern "C" HRESULT WINAPI MbaPrereqBootstrapperApplicationCreate(
106 {
107 HRESULT hr = S_OK;
108
109 + DutilInitialize(&WixstdbaTraceError);
110 +
111 BalInitialize(pEngine);
112
113 hr = CreateBootstrapperApplication(vhInstance, TRUE, hrHostInitialization, pEngine, pArgs, pResults, &vpApplication);
@@ -104,4 +122,23 @@ extern "C" void WINAPI MbaPrereqBootstrapperApplicationDestroy()
122 {
123 ReleaseNullObject(vpApplication);
124 BalUninitialize();
125 + DutilUninitialize();
126 +}
127 +
128 +static void CALLBACK WixstdbaTraceError(
129 + __in_z LPCSTR /*szFile*/,
130 + __in int /*iLine*/,
131 + __in REPORT_LEVEL /*rl*/,
132 + __in UINT source,
133 + __in HRESULT hrError,
134 + __in_z __format_string LPCSTR szFormat,
135 + __in va_list args
136 + )
137 +{
138 + // BalLogError currently uses the Exit... macros,
139 + // so if expanding the scope need to ensure this doesn't get called recursively.
140 + if (DUTIL_SOURCE_THMUTIL == source)
141 + {
142 + BalLogErrorArgs(hrError, szFormat, args);
143 + }
144 }