diff options
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/logutil.cpp')
| -rw-r--r-- | src/libs/dutil/WixToolset.DUtil/logutil.cpp | 50 |
1 files changed, 46 insertions, 4 deletions
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, |
