# WindowsProcessDiagnostics **命名空间**: `XCEngine::Editor::Platform` **类型**: `header-helper` **源文件**: `editor/src/Platform/WindowsProcessDiagnostics.h` **描述**: 提供 Windows 进程级崩溃日志和 `stderr` 重定向辅助函数。 ## 概述 `WindowsProcessDiagnostics.h` 负责编辑器启动期的两类进程级诊断措施: - 安装未处理异常过滤器 - 把 `stderr` 重定向到可执行目录下的日志文件 当前提供的入口包括: - `GetExecutableLogPath` - `CrashExceptionFilter` - `InstallCrashExceptionFilter` - `RedirectStderrToExecutableLog` ## 当前实现 - 崩溃信息会追加写入 `crash.log` - 同时也会把崩溃摘要写到 `stderr` - `stderr` 会被重定向到 `stderr.log` - 路径基础依赖 [`GetExecutableDirectoryUtf8`](../Win32Utf8/Win32Utf8.md) `Application.cpp` 会在应用初始化早期调用这些函数,因此它们更偏“进程启动保护”,而不是普通运行时 API。 ## 设计说明 对图形编辑器来说,启动早期和窗口系统崩溃阶段往往最难排查。 在这种情况下,哪怕只有一条异常码和地址,也比完全静默退出强得多。 所以这类轻量诊断入口非常符合商业工具软件的最小可运维要求。 ## 当前限制 - 只记录非常基础的异常信息,没有 minidump - 依赖 Windows SEH,不是跨平台方案 - `freopen` 重定向策略比较直接,没有控制台回显复用 ## 相关文档 - [Platform](../Platform.md) - [Win32Utf8](../Win32Utf8/Win32Utf8.md) - [Application](../../Application/Application.md)