@@ -1187,13 +1187,13 @@ static DWORD SafeReadExceptionCode(_EXCEPTION_POINTERS* pException)
11871187 exceptionCode = pException->ExceptionRecord ->ExceptionCode ;
11881188 if (exceptionCode == STATUS_FATAL_USER_CALLBACK_EXCEPTION)
11891189 {
1190- OutputDebugStringA (" CCrashDumpWriter: 0xC000041D callback exception detected\n " );
1190+ SAFE_DEBUG_OUTPUT (" CCrashDumpWriter: 0xC000041D callback exception detected\n " );
11911191 }
11921192 }
11931193 }
11941194 __except (EXCEPTION_EXECUTE_HANDLER)
11951195 {
1196- OutputDebugStringA (" CCrashDumpWriter: Exception accessing exception record (corrupted frame)\n " );
1196+ SAFE_DEBUG_OUTPUT (" CCrashDumpWriter: Exception accessing exception record (corrupted frame)\n " );
11971197 }
11981198 return exceptionCode;
11991199}
@@ -1265,7 +1265,7 @@ long WINAPI CCrashDumpWriter::HandleExceptionGlobal(_EXCEPTION_POINTERS* pExcept
12651265{
12661266 // Absolute first action - log that we entered the handler (before anything can fail)
12671267 // This is critical for diagnosing exceptions that may fault during handling
1268- OutputDebugStringA (" CCrashDumpWriter::HandleExceptionGlobal - EMERGENCY ENTRY MARKER\n " );
1268+ OutputDebugStringSafe (" CCrashDumpWriter::HandleExceptionGlobal - EMERGENCY ENTRY MARKER\n " );
12691269
12701270 SAFE_DEBUG_OUTPUT (" ========================================\n " );
12711271 SAFE_DEBUG_OUTPUT (" CCrashDumpWriter::HandleExceptionGlobal - ENTRY\n " );
@@ -1286,7 +1286,7 @@ long WINAPI CCrashDumpWriter::HandleExceptionGlobal(_EXCEPTION_POINTERS* pExcept
12861286 // Try emergency minimal dump for any reentrant exception
12871287 if (exceptionCodeSafe != 0 )
12881288 {
1289- OutputDebugStringA (" CCrashDumpWriter: EMERGENCY - Reentrant exception, attempting minimal dump\n " );
1289+ OutputDebugStringSafe (" CCrashDumpWriter: EMERGENCY - Reentrant exception, attempting minimal dump\n " );
12901290 SAFE_DEBUG_OUTPUT (" CCrashDumpWriter: Exception during crash handling - attempting emergency artifacts\n " );
12911291 TryWriteReentrantFlag (exceptionCodeSafe);
12921292 }
@@ -1330,14 +1330,14 @@ long WINAPI CCrashDumpWriter::HandleExceptionGlobal(_EXCEPTION_POINTERS* pExcept
13301330 const bool isCallbackException = (exceptionCode == STATUS_FATAL_USER_CALLBACK_EXCEPTION);
13311331 if (isCallbackException)
13321332 {
1333- OutputDebugStringA (" CCrashDumpWriter: EMERGENCY - Entering callback exception special handling\n " );
1333+ OutputDebugStringSafe (" CCrashDumpWriter: EMERGENCY - Entering callback exception special handling\n " );
13341334 SAFE_DEBUG_OUTPUT (" CCrashDumpWriter: STATUS_FATAL_USER_CALLBACK_EXCEPTION detected\n " );
13351335 SAFE_DEBUG_OUTPUT (" CCrashDumpWriter: This exception occurred in a Windows callback\n " );
13361336 SAFE_DEBUG_OUTPUT (" CCrashDumpWriter: Stack frames may be incomplete or corrupted\n " );
13371337
13381338 // Try to capture what we can with additional protection
13391339 TryLogCallbackContext (pException);
1340- OutputDebugStringA (" CCrashDumpWriter: EMERGENCY - Callback exception context capture attempted\n " );
1340+ OutputDebugStringSafe (" CCrashDumpWriter: EMERGENCY - Callback exception context capture attempted\n " );
13411341 }
13421342
13431343 CExceptionInformation_Impl* pExceptionInformation = nullptr ;
@@ -1415,22 +1415,22 @@ long WINAPI CCrashDumpWriter::HandleExceptionGlobal(_EXCEPTION_POINTERS* pExcept
14151415 // Enhanced emergency logging for all exceptions to track dump generation progress
14161416 if (isCallbackException)
14171417 {
1418- OutputDebugStringA (" CCrashDumpWriter: EMERGENCY - Callback exception attempting core log\n " );
1418+ OutputDebugStringSafe (" CCrashDumpWriter: EMERGENCY - Callback exception attempting core log\n " );
14191419 SAFE_DEBUG_OUTPUT (" CCrashDumpWriter: Callback exception - attempting dump generation despite potential secondary faults\n " );
14201420 }
14211421
14221422 try
14231423 {
14241424 if (isCallbackException)
14251425 {
1426- OutputDebugStringA (" CCrashDumpWriter: EMERGENCY - Starting DumpCoreLog\n " );
1426+ OutputDebugStringSafe (" CCrashDumpWriter: EMERGENCY - Starting DumpCoreLog\n " );
14271427 }
14281428 DumpCoreLog (pException, pExceptionInformation);
14291429 coreLogSucceeded = true ;
14301430 SAFE_DEBUG_OUTPUT (" CCrashDumpWriter: Core log dumped successfully\n " );
14311431 if (isCallbackException)
14321432 {
1433- OutputDebugStringA (" CCrashDumpWriter: EMERGENCY - DumpCoreLog succeeded\n " );
1433+ OutputDebugStringSafe (" CCrashDumpWriter: EMERGENCY - DumpCoreLog succeeded\n " );
14341434 }
14351435 }
14361436 catch (...)
@@ -1446,22 +1446,22 @@ long WINAPI CCrashDumpWriter::HandleExceptionGlobal(_EXCEPTION_POINTERS* pExcept
14461446 {
14471447 if (isCallbackException)
14481448 {
1449- OutputDebugStringA (" CCrashDumpWriter: EMERGENCY - Starting DumpMiniDump for callback exception\n " );
1449+ OutputDebugStringSafe (" CCrashDumpWriter: EMERGENCY - Starting DumpMiniDump for callback exception\n " );
14501450 }
14511451 DumpMiniDump (pException, pExceptionInformation);
14521452 miniDumpSucceeded = true ;
14531453 SAFE_DEBUG_OUTPUT (" CCrashDumpWriter: Mini dump created successfully\n " );
14541454 if (isCallbackException)
14551455 {
1456- OutputDebugStringA (" CCrashDumpWriter: EMERGENCY - DumpMiniDump succeeded for callback exception\n " );
1456+ OutputDebugStringSafe (" CCrashDumpWriter: EMERGENCY - DumpMiniDump succeeded for callback exception\n " );
14571457 }
14581458 }
14591459 catch (...)
14601460 {
14611461 SAFE_DEBUG_OUTPUT (" CCrashDumpWriter: ERROR - Failed to create mini dump\n " );
14621462 if (isCallbackException)
14631463 {
1464- OutputDebugStringA (" CCrashDumpWriter: EMERGENCY - DumpMiniDump FAILED for callback exception\n " );
1464+ OutputDebugStringSafe (" CCrashDumpWriter: EMERGENCY - DumpMiniDump FAILED for callback exception\n " );
14651465 SAFE_DEBUG_OUTPUT (" CCrashDumpWriter: Callback exception may have caused secondary fault during minidump\n " );
14661466 }
14671467 }
@@ -1470,15 +1470,15 @@ long WINAPI CCrashDumpWriter::HandleExceptionGlobal(_EXCEPTION_POINTERS* pExcept
14701470 {
14711471 if (isCallbackException)
14721472 {
1473- OutputDebugStringA (" CCrashDumpWriter: EMERGENCY - Starting RunErrorTool for callback exception\n " );
1473+ OutputDebugStringSafe (" CCrashDumpWriter: EMERGENCY - Starting RunErrorTool for callback exception\n " );
14741474 }
14751475 crashDialogShown = RunErrorTool (pExceptionInformation);
14761476 if (crashDialogShown)
14771477 {
14781478 SAFE_DEBUG_OUTPUT (" CCrashDumpWriter: Error dialog launched successfully\n " );
14791479 if (isCallbackException)
14801480 {
1481- OutputDebugStringA (" CCrashDumpWriter: EMERGENCY - RunErrorTool succeeded for callback exception\n " );
1481+ OutputDebugStringSafe (" CCrashDumpWriter: EMERGENCY - RunErrorTool succeeded for callback exception\n " );
14821482 }
14831483 }
14841484 }
@@ -1487,7 +1487,7 @@ long WINAPI CCrashDumpWriter::HandleExceptionGlobal(_EXCEPTION_POINTERS* pExcept
14871487 SAFE_DEBUG_OUTPUT (" CCrashDumpWriter: ERROR - Failed to launch error dialog\n " );
14881488 if (isCallbackException)
14891489 {
1490- OutputDebugStringA (" CCrashDumpWriter: EMERGENCY - RunErrorTool FAILED for callback exception\n " );
1490+ OutputDebugStringSafe (" CCrashDumpWriter: EMERGENCY - RunErrorTool FAILED for callback exception\n " );
14911491 }
14921492 }
14931493
@@ -1514,7 +1514,7 @@ long WINAPI CCrashDumpWriter::HandleExceptionGlobal(_EXCEPTION_POINTERS* pExcept
15141514
15151515 if (isCallbackException)
15161516 {
1517- OutputDebugStringA (" CCrashDumpWriter: EMERGENCY - Callback exception processing completed, about to terminate\n " );
1517+ OutputDebugStringSafe (" CCrashDumpWriter: EMERGENCY - Callback exception processing completed, about to terminate\n " );
15181518 }
15191519
15201520 delete pExceptionInformation;
@@ -1588,7 +1588,7 @@ long WINAPI CCrashDumpWriter::HandleExceptionGlobal(_EXCEPTION_POINTERS* pExcept
15881588 SAFE_DEBUG_OUTPUT (" CCrashDumpWriter: Force terminating crashed process NOW\n " );
15891589 if (isCallbackException)
15901590 {
1591- OutputDebugStringA (" CCrashDumpWriter: EMERGENCY - About to call TerminateProcess for callback exception\n " );
1591+ OutputDebugStringSafe (" CCrashDumpWriter: EMERGENCY - About to call TerminateProcess for callback exception\n " );
15921592 }
15931593 TerminateCurrentProcessWithExitCode (crashExitCode);
15941594
0 commit comments