获取 Windows 错误代码的标识符 [英] Get the identifier of a Windows error code
问题描述
在我正在开发的程序中,我需要收集有关运行时错误的信息.目前,我能够收集我需要的所有信息,包括通过 FormatMessage
发送的消息,以及错误的标识符(例如,ERROR_SUCCESS
).我知道在编译应用程序时,这些标识符实际上并不存在于二进制文件中.
In a program I'm developing I need to gather information about runtime errors. Currently, I am able to gather all the information I need, including the message via FormatMessage
, but the identifier of the error (for example, ERROR_SUCCESS
). I know that when the application is compiled these identifiers are not actually present in the binaries.
Windows API 中是否有可以检索这些标识符的函数,或者我是否需要将它们与我的应用程序一起存储?
Is there a function in the Windows API which can retrieve these identifiers or do I need to store them with my application?
推荐答案
ERROR_SUCCESS
本身只是一个常量.我还没有找到从数字 -> 常量标识符开始的方法.
ERROR_SUCCESS
itself is just a constant. I haven't found a way to go from number -> constant identifier.
您可以使用 Clang 扫描 WinError.h
并创建某种表为您的应用程序.
You could scan WinError.h
with Clang and create some kind of table for your application.
这篇关于获取 Windows 错误代码的标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!