diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/burn/engine/engine.cpp | 68 | ||||
| -rw-r--r-- | src/burn/engine/engine.mc | 7 | ||||
| -rw-r--r-- | src/libs/dutil/WixToolset.DUtil/inc/logutil.h | 8 | ||||
| -rw-r--r-- | src/libs/dutil/WixToolset.DUtil/logutil.cpp | 50 |
4 files changed, 95 insertions, 38 deletions
diff --git a/src/burn/engine/engine.cpp b/src/burn/engine/engine.cpp index 628708f5..13d23ecd 100644 --- a/src/burn/engine/engine.cpp +++ b/src/burn/engine/engine.cpp | |||
| @@ -297,6 +297,41 @@ LExit: | |||
| 297 | hr = SUCCEEDED(hr) ? HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_REQUIRED) : HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_REQUIRED); | 297 | hr = SUCCEEDED(hr) ? HRESULT_FROM_WIN32(ERROR_SUCCESS_REBOOT_REQUIRED) : HRESULT_FROM_WIN32(ERROR_FAIL_REBOOT_REQUIRED); |
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | if (fRunNormal) | ||
| 301 | { | ||
| 302 | LogId(REPORT_STANDARD, MSG_EXITING, FAILED(hr) ? (int)hr : *pdwExitCode, LoggingBoolToString(fRestart)); | ||
| 303 | } | ||
| 304 | else if (fRunUntrusted) | ||
| 305 | { | ||
| 306 | LogId(REPORT_STANDARD, MSG_EXITING_CLEAN_ROOM, FAILED(hr) ? (int)hr : *pdwExitCode); | ||
| 307 | } | ||
| 308 | else if (fRunRunOnce) | ||
| 309 | { | ||
| 310 | LogId(REPORT_STANDARD, MSG_EXITING_RUN_ONCE, FAILED(hr) ? (int)hr : *pdwExitCode); | ||
| 311 | } | ||
| 312 | else if (fRunElevated) | ||
| 313 | { | ||
| 314 | LogId(REPORT_STANDARD, MSG_EXITING_ELEVATED, FAILED(hr) ? (int)hr : *pdwExitCode); | ||
| 315 | } | ||
| 316 | |||
| 317 | if (fLogInitialized) | ||
| 318 | { | ||
| 319 | // Leave the log open before calling restart so messages can be logged from there. | ||
| 320 | // Best effort to make sure all previous messages are written to disk in case the restart causes messages to be lost in buffers. | ||
| 321 | LogFlush(); | ||
| 322 | } | ||
| 323 | |||
| 324 | if (fRestart) | ||
| 325 | { | ||
| 326 | LogId(REPORT_STANDARD, MSG_RESTARTING); | ||
| 327 | |||
| 328 | HRESULT hrRestart = Restart(); | ||
| 329 | if (FAILED(hrRestart)) | ||
| 330 | { | ||
| 331 | LogErrorId(hrRestart, MSG_RESTART_FAILED); | ||
| 332 | } | ||
| 333 | } | ||
| 334 | |||
| 300 | UninitializeEngineState(&engineState); | 335 | UninitializeEngineState(&engineState); |
| 301 | 336 | ||
| 302 | if (fXmlInitialized) | 337 | if (fXmlInitialized) |
| @@ -329,42 +364,9 @@ LExit: | |||
| 329 | ::CoUninitialize(); | 364 | ::CoUninitialize(); |
| 330 | } | 365 | } |
| 331 | 366 | ||
| 332 | if (fRunNormal) | ||
| 333 | { | ||
| 334 | LogId(REPORT_STANDARD, MSG_EXITING, FAILED(hr) ? (int)hr : *pdwExitCode, LoggingBoolToString(fRestart)); | ||
| 335 | |||
| 336 | if (fRestart) | ||
| 337 | { | ||
| 338 | LogId(REPORT_STANDARD, MSG_RESTARTING); | ||
| 339 | } | ||
| 340 | } | ||
| 341 | else if (fRunUntrusted) | ||
| 342 | { | ||
| 343 | LogId(REPORT_STANDARD, MSG_EXITING_CLEAN_ROOM, FAILED(hr) ? (int)hr : *pdwExitCode); | ||
| 344 | } | ||
| 345 | else if (fRunRunOnce) | ||
| 346 | { | ||
| 347 | LogId(REPORT_STANDARD, MSG_EXITING_RUN_ONCE, FAILED(hr) ? (int)hr : *pdwExitCode); | ||
| 348 | } | ||
| 349 | else if (fRunElevated) | ||
| 350 | { | ||
| 351 | LogId(REPORT_STANDARD, MSG_EXITING_ELEVATED, FAILED(hr) ? (int)hr : *pdwExitCode); | ||
| 352 | } | ||
| 353 | |||
| 354 | |||
| 355 | if (fLogInitialized) | 367 | if (fLogInitialized) |
| 356 | { | 368 | { |
| 357 | DutilUninitialize(); | 369 | DutilUninitialize(); |
| 358 | LogClose(FALSE); | ||
| 359 | } | ||
| 360 | |||
| 361 | if (fRestart) | ||
| 362 | { | ||
| 363 | Restart(); | ||
| 364 | } | ||
| 365 | |||
| 366 | if (fLogInitialized) | ||
| 367 | { | ||
| 368 | LogUninitialize(FALSE); | 370 | LogUninitialize(FALSE); |
| 369 | } | 371 | } |
| 370 | 372 | ||
diff --git a/src/burn/engine/engine.mc b/src/burn/engine/engine.mc index 32616721..dab1a504 100644 --- a/src/burn/engine/engine.mc +++ b/src/burn/engine/engine.mc | |||
| @@ -184,6 +184,13 @@ Language=English | |||
| 184 | Elevated engine process is not running with elevated privileges. Either run the bundle as a privileged user or reconfigure Windows to allow standard users to request elevation. | 184 | Elevated engine process is not running with elevated privileges. Either run the bundle as a privileged user or reconfigure Windows to allow standard users to request elevation. |
| 185 | . | 185 | . |
| 186 | 186 | ||
| 187 | MessageId=23 | ||
| 188 | Severity=Error | ||
| 189 | SymbolicName=MSG_RESTART_FAILED | ||
| 190 | Language=English | ||
| 191 | The restart request failed, error: %1!ls!. The machine will need to be manually restarted. | ||
| 192 | . | ||
| 193 | |||
| 187 | MessageId=51 | 194 | MessageId=51 |
| 188 | Severity=Error | 195 | Severity=Error |
| 189 | SymbolicName=MSG_FAILED_PARSE_CONDITION | 196 | SymbolicName=MSG_FAILED_PARSE_CONDITION |
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, |
