aboutsummaryrefslogtreecommitdiff
path: root/src/libs/dutil/WixToolset.DUtil/dutil.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-05-02 18:50:49 -0500
committerSean Hall <r.sean.hall@gmail.com>2021-05-11 19:11:19 -0500
commit71e689fe5179ca253d878480ba34e2e76a540eab (patch)
treedbd197605fdcc2805acc2d971fdc2dbc8bb6d8cb /src/libs/dutil/WixToolset.DUtil/dutil.cpp
parent5da97c750ef36518970eb0d3b02655b2eac75a35 (diff)
downloadwix-71e689fe5179ca253d878480ba34e2e76a540eab.tar.gz
wix-71e689fe5179ca253d878480ba34e2e76a540eab.tar.bz2
wix-71e689fe5179ca253d878480ba34e2e76a540eab.zip
Add ability to suppress pfnTraceErrorCallback for the current thread.
Suppress BurnTraceError while logging errors from BurnTraceError. #6378
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/dutil.cpp')
-rw-r--r--src/libs/dutil/WixToolset.DUtil/dutil.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/dutil.cpp b/src/libs/dutil/WixToolset.DUtil/dutil.cpp
index 56b85207..dd4fa8bf 100644
--- a/src/libs/dutil/WixToolset.DUtil/dutil.cpp
+++ b/src/libs/dutil/WixToolset.DUtil/dutil.cpp
@@ -30,6 +30,8 @@ static REPORT_LEVEL Dutil_rlCurrentTrace = REPORT_STANDARD;
30static BOOL Dutil_fTraceFilenames = FALSE; 30static BOOL Dutil_fTraceFilenames = FALSE;
31static DUTIL_CALLBACK_TRACEERROR vpfnTraceErrorCallback = NULL; 31static DUTIL_CALLBACK_TRACEERROR vpfnTraceErrorCallback = NULL;
32 32
33thread_local static DWORD vtdwSuppressTraceErrorSource = 0;
34
33 35
34DAPI_(HRESULT) DutilInitialize( 36DAPI_(HRESULT) DutilInitialize(
35 __in_opt DUTIL_CALLBACK_TRACEERROR pfnTraceErrorCallback 37 __in_opt DUTIL_CALLBACK_TRACEERROR pfnTraceErrorCallback
@@ -48,6 +50,28 @@ DAPI_(void) DutilUninitialize()
48 vpfnTraceErrorCallback = NULL; 50 vpfnTraceErrorCallback = NULL;
49} 51}
50 52
53DAPI_(BOOL) DutilSuppressTraceErrorSource()
54{
55 if (DWORD_MAX == vtdwSuppressTraceErrorSource)
56 {
57 return FALSE;
58 }
59
60 ++vtdwSuppressTraceErrorSource;
61 return TRUE;
62}
63
64DAPI_(BOOL) DutilUnsuppressTraceErrorSource()
65{
66 if (0 == vtdwSuppressTraceErrorSource)
67 {
68 return FALSE;
69 }
70
71 --vtdwSuppressTraceErrorSource;
72 return TRUE;
73}
74
51/******************************************************************* 75/*******************************************************************
52Dutil_SetAssertModule 76Dutil_SetAssertModule
53 77
@@ -427,8 +451,9 @@ DAPIV_(void) Dutil_TraceErrorSource(
427 ... 451 ...
428 ) 452 )
429{ 453{
454 // if this callback is currently suppressed, or
430 // if this is NOT an error report and we're not logging at this level, bail 455 // if this is NOT an error report and we're not logging at this level, bail
431 if (REPORT_ERROR != rl && Dutil_rlCurrentTrace < rl) 456 if (vtdwSuppressTraceErrorSource || REPORT_ERROR != rl && Dutil_rlCurrentTrace < rl)
432 { 457 {
433 return; 458 return;
434 } 459 }