diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-09-02 16:08:29 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-09-03 15:29:26 -0500 |
commit | e263e6bca03d783ece2f2dc86345dcdfc4b9776d (patch) | |
tree | 3f79b618040f4fa859bf273f89e712015bfe7441 /src/libs | |
parent | 85735f8b50a9dae190b08abe339aeda7a447a30b (diff) | |
download | wix-e263e6bca03d783ece2f2dc86345dcdfc4b9776d.tar.gz wix-e263e6bca03d783ece2f2dc86345dcdfc4b9776d.tar.bz2 wix-e263e6bca03d783ece2f2dc86345dcdfc4b9776d.zip |
Delay closing the bundle log so that restart failures will be logged.
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/inc/logutil.h | 8 | ||||
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/logutil.cpp | 50 |
2 files changed, 53 insertions, 5 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/inc/logutil.h b/src/libs/dutil/WixToolset.DUtil/inc/logutil.h index 0ad8510a..fba1e81e 100644 --- a/src/libs/dutil/WixToolset.DUtil/inc/logutil.h +++ b/src/libs/dutil/WixToolset.DUtil/inc/logutil.h | |||
@@ -81,6 +81,12 @@ HRESULT DAPI LogRename( | |||
81 | __in_z LPCWSTR wzNewPath | 81 | __in_z LPCWSTR wzNewPath |
82 | ); | 82 | ); |
83 | 83 | ||
84 | /******************************************************************** | ||
85 | LogFlush - calls ::FlushFileBuffers with the log file handle. | ||
86 | |||
87 | ********************************************************************/ | ||
88 | HRESULT DAPI LogFlush(); | ||
89 | |||
84 | void DAPI LogClose( | 90 | void DAPI LogClose( |
85 | __in BOOL fFooter | 91 | __in BOOL fFooter |
86 | ); | 92 | ); |
@@ -344,7 +350,7 @@ HRESULT DAPI LogFooter(); | |||
344 | LogStringWorkRaw - Write a raw, unformatted string to the log | 350 | LogStringWorkRaw - Write a raw, unformatted string to the log |
345 | 351 | ||
346 | ********************************************************************/ | 352 | ********************************************************************/ |
347 | HRESULT LogStringWorkRaw( | 353 | HRESULT DAPI LogStringWorkRaw( |
348 | __in_z LPCSTR szLogData | 354 | __in_z LPCSTR szLogData |
349 | ); | 355 | ); |
350 | 356 | ||
diff --git a/src/libs/dutil/WixToolset.DUtil/logutil.cpp b/src/libs/dutil/WixToolset.DUtil/logutil.cpp index 606279c7..0a77a468 100644 --- a/src/libs/dutil/WixToolset.DUtil/logutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/logutil.cpp | |||
@@ -40,6 +40,9 @@ static LPCSTR LOGUTIL_DEBUG = "debug"; | |||
40 | static LPCSTR LOGUTIL_NONE = "none"; | 40 | static LPCSTR LOGUTIL_NONE = "none"; |
41 | 41 | ||
42 | // prototypes | 42 | // prototypes |
43 | static HRESULT LogStringWorkRawUnsynchronized( | ||
44 | __in_z LPCSTR szLogData | ||
45 | ); | ||
43 | static HRESULT LogIdWork( | 46 | static HRESULT LogIdWork( |
44 | __in REPORT_LEVEL rl, | 47 | __in REPORT_LEVEL rl, |
45 | __in_opt HMODULE hModule, | 48 | __in_opt HMODULE hModule, |
@@ -245,6 +248,29 @@ LExit: | |||
245 | } | 248 | } |
246 | 249 | ||
247 | 250 | ||
251 | extern "C" HRESULT DAPI LogFlush() | ||
252 | { | ||
253 | HRESULT hr = S_OK; | ||
254 | |||
255 | ::EnterCriticalSection(&LogUtil_csLog); | ||
256 | |||
257 | if (INVALID_HANDLE_VALUE == LogUtil_hLog) | ||
258 | { | ||
259 | ExitFunction1(hr = S_FALSE); | ||
260 | } | ||
261 | |||
262 | if (!::FlushFileBuffers(LogUtil_hLog)) | ||
263 | { | ||
264 | LoguExitWithLastError(hr, "Failed to flush log file buffers."); | ||
265 | } | ||
266 | |||
267 | LExit: | ||
268 | ::LeaveCriticalSection(&LogUtil_csLog); | ||
269 | |||
270 | return hr; | ||
271 | } | ||
272 | |||
273 | |||
248 | extern "C" void DAPI LogClose( | 274 | extern "C" void DAPI LogClose( |
249 | __in BOOL fFooter | 275 | __in BOOL fFooter |
250 | ) | 276 | ) |
@@ -630,7 +656,26 @@ extern "C" HRESULT DAPI LogFooter() | |||
630 | return hr; | 656 | return hr; |
631 | } | 657 | } |
632 | 658 | ||
633 | extern "C" HRESULT LogStringWorkRaw( | 659 | extern "C" HRESULT DAPI LogStringWorkRaw( |
660 | __in_z LPCSTR szLogData | ||
661 | ) | ||
662 | { | ||
663 | HRESULT hr = S_OK; | ||
664 | |||
665 | ::EnterCriticalSection(&LogUtil_csLog); | ||
666 | |||
667 | hr = LogStringWorkRawUnsynchronized(szLogData); | ||
668 | |||
669 | ::LeaveCriticalSection(&LogUtil_csLog); | ||
670 | |||
671 | return hr; | ||
672 | } | ||
673 | |||
674 | // | ||
675 | // private worker functions | ||
676 | // | ||
677 | |||
678 | static HRESULT LogStringWorkRawUnsynchronized( | ||
634 | __in_z LPCSTR szLogData | 679 | __in_z LPCSTR szLogData |
635 | ) | 680 | ) |
636 | { | 681 | { |
@@ -671,9 +716,6 @@ LExit: | |||
671 | return hr; | 716 | return hr; |
672 | } | 717 | } |
673 | 718 | ||
674 | // | ||
675 | // private worker functions | ||
676 | // | ||
677 | static HRESULT LogIdWork( | 719 | static HRESULT LogIdWork( |
678 | __in REPORT_LEVEL rl, | 720 | __in REPORT_LEVEL rl, |
679 | __in_opt HMODULE hModule, | 721 | __in_opt HMODULE hModule, |