diff options
author | Bob Arnson <bob@firegiant.com> | 2023-04-24 22:16:34 -0400 |
---|---|---|
committer | Bob Arnson <github@bobs.org> | 2023-04-27 11:07:23 -0400 |
commit | b3b9decfab8a26851e2bc85d777824220ff804b6 (patch) | |
tree | 8c05f1c2c64ca54c91811069468487b5d4a788b2 /src/libs/wcautil/WixToolset.WcaUtil/inc | |
parent | 3c40f43c76d44787bfc1602cb7d95ea3a0787748 (diff) | |
download | wix-b3b9decfab8a26851e2bc85d777824220ff804b6.tar.gz wix-b3b9decfab8a26851e2bc85d777824220ff804b6.tar.bz2 wix-b3b9decfab8a26851e2bc85d777824220ff804b6.zip |
Fix WcaErrorMessage `cArgs==-1` case.
- Count args before creating message record.
- Document terminating NULL requirement.
- Add terminating NULL in MessageExit* macros.
- Enhance tests for problems encountered fixing this nightmare.
Fixes https://github.com/wixtoolset/issues/issues/7422.
Fixes https://github.com/wixtoolset/issues/issues/7444.
Diffstat (limited to 'src/libs/wcautil/WixToolset.WcaUtil/inc')
-rw-r--r-- | src/libs/wcautil/WixToolset.WcaUtil/inc/wcautil.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libs/wcautil/WixToolset.WcaUtil/inc/wcautil.h b/src/libs/wcautil/WixToolset.WcaUtil/inc/wcautil.h index 9b331b34..b72c8d3f 100644 --- a/src/libs/wcautil/WixToolset.WcaUtil/inc/wcautil.h +++ b/src/libs/wcautil/WixToolset.WcaUtil/inc/wcautil.h | |||
@@ -15,9 +15,9 @@ extern "C" { | |||
15 | 15 | ||
16 | #include "dutil.h" | 16 | #include "dutil.h" |
17 | 17 | ||
18 | #define MessageExitOnLastErrorSource(d, x, e, s, ...) { x = ::GetLastError(); x = HRESULT_FROM_WIN32(x); if (FAILED(x)) { ExitTraceSource(d, x, s, __VA_ARGS__); WcaErrorMessage(e, x, MB_OK, -1, __VA_ARGS__); goto LExit; } } | 18 | #define MessageExitOnLastErrorSource(d, x, e, s, ...) { x = ::GetLastError(); x = HRESULT_FROM_WIN32(x); if (FAILED(x)) { ExitTraceSource(d, x, s, __VA_ARGS__); WcaErrorMessage(e, x, MB_OK, -1, __VA_ARGS__, NULL); goto LExit; } } |
19 | #define MessageExitOnFailureSource(d, x, e, s, ...) if (FAILED(x)) { ExitTraceSource(d, x, s, __VA_ARGS__); WcaErrorMessage(e, x, INSTALLMESSAGE_ERROR | MB_OK, -1, __VA_ARGS__); goto LExit; } | 19 | #define MessageExitOnFailureSource(d, x, e, s, ...) if (FAILED(x)) { ExitTraceSource(d, x, s, __VA_ARGS__); WcaErrorMessage(e, x, INSTALLMESSAGE_ERROR | MB_OK, -1, __VA_ARGS__, NULL); goto LExit; } |
20 | #define MessageExitOnNullWithLastErrorSource(d, p, x, e, s, ...) if (NULL == p) { x = ::GetLastError(); x = HRESULT_FROM_WIN32(x); if (!FAILED(x)) { x = E_FAIL; } ExitTraceSource(d, x, s, __VA_ARGS__); WcaErrorMessage(e, x, MB_OK, -1, __VA_ARGS__); goto LExit; } | 20 | #define MessageExitOnNullWithLastErrorSource(d, p, x, e, s, ...) if (NULL == p) { x = ::GetLastError(); x = HRESULT_FROM_WIN32(x); if (!FAILED(x)) { x = E_FAIL; } ExitTraceSource(d, x, s, __VA_ARGS__); WcaErrorMessage(e, x, MB_OK, -1, __VA_ARGS__, NULL); goto LExit; } |
21 | 21 | ||
22 | #define MessageExitOnLastError(x, e, s, ...) MessageExitOnLastErrorSource(DUTIL_SOURCE_DEFAULT, x, e, s, __VA_ARGS__) | 22 | #define MessageExitOnLastError(x, e, s, ...) MessageExitOnLastErrorSource(DUTIL_SOURCE_DEFAULT, x, e, s, __VA_ARGS__) |
23 | #define MessageExitOnFailure(x, e, s, ...) MessageExitOnFailureSource(DUTIL_SOURCE_DEFAULT, x, e, s, __VA_ARGS__) | 23 | #define MessageExitOnFailure(x, e, s, ...) MessageExitOnFailureSource(DUTIL_SOURCE_DEFAULT, x, e, s, __VA_ARGS__) |