在哪里可以找到所有 Windows 错误代码的列表?

发布于 2024-07-26 07:01:31 字数 175 浏览 6 评论 0原文

在上一个问题中,我问当我的程序返回一个晦涩的值时意味着什么,比如

-1073741819

好吧,现在我得到另一个大的返回值,

-1073740777

我想知道是否有所有这些值的列表以及它们的含义某处?

In a previous question, I asked what it meant when my program returned an obscure value like

-1073741819

Well, now I'm getting another large return value,

-1073740777

And I would like to know if there is some list of all of these values and what they mean sopmewhere?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

无语# 2024-08-02 07:01:31

这里有一个 100% 免费的在线工具“MagnumDB”,用于“Magical Number Database”,其中包含大约 350,000 个常量(整数、从整个 Windows SDK 文件(约 6,000 个文件)解析的字符串、guid 等),您可以按值和名称查询。 免责声明:我在多年搜索常量、名称、指导之后写了它......

这是 -1073741819 映射到3个不同文件中定义的3个不同常量(具有相同的值和相同的含义),最常见的是STATUS_ACCESS_VIOLATION

输入图像描述这里

对于 -1073740777 来说,这是 STATUS_INVALID_CRUNTIME_PARAMETER< /code> 在 winnt.h 中定义。

输入图像描述这里

它支持整数、有符号整数、无符号整数、十六进制表示法以及原始文本搜索。 它还知道由操作定义的常量值(如 c2 = c1 + 1)。

Here is a 100% free online tool "MagnumDB" for "Magical Number Database" that contains about 350,000 constants (integers, strings, guids, etc.) parsed from the whole Windows SDK files (~6,000 files), that you can query by value and by name. Disclaimer: I wrote it after years of searching for constants, names, guids...

Here is the result for -1073741819 which maps to 3 different constants (with the same value and the same meaning) defined in 3 different files, the most common being STATUS_ACCESS_VIOLATION.

enter image description here

And for -1073740777 which is STATUS_INVALID_CRUNTIME_PARAMETER defined in winnt.h.

enter image description here

It supports integers, signed integers, unsigned integers, hexadecimal notation, and also raw text searches. It also knows the value of constants that are defined by operations (like c2 = c1 + 1).

梦旅人picnic 2024-08-02 07:01:31

由于 Windows 错误代码系统是可扩展的,因此没有一个地方可以查找所有可能的 Windows 错误代码。 但是,您可以从以下开始:

  • 研究 COM错误代码的结构。 有时,知道错误来自哪个设施可以帮助您发现它来自哪个头文件。
  • Visual Studio 至少从 2003 年开始就包含一个 ERRLOOK 工具。 如果您使用的是 Visual Studio,请先尝试一下。
  • 您将遇到的许多代码都位于 Winerror.h。 我提供了一个指向 MSDN 的链接,其中包含该头文件的内容。 或者您可以查看 上按编号列出的错误代码此页面。
  • 理想情况下,您知道哪个函数返回了代码,然后您可以在 MSDN 上查找该函数并查看所有可能的返回值。 当然,您需要引用 Winerror.h 或另一个头文件来获取实际值。
  • 你可以 find (就像 Unix grep) 在平台 SDK 的 Include 目录中查找整个错误代码的十六进制值,或仅代码部分的十进制值(即低 16 位)。 使用HRESULT_CODE< /a> 来提取它。 请参阅上面的 COM 错误代码的结构。
  • 有一些错误查找工具,您可以在其中粘贴一个值,它会在数据库中查找该值并告诉您它的含义。 请查看此处此处
  • 谷歌。 使用完整的十六进制值。 有时你会发现非常有用的信息,或者至少是线索。

Because the Windows error code system is extensible, there is no single place to look up all possible Windows error codes. However, you can start with:

  • Study the Structure of COM Error Codes. Sometimes knowing what facility an error comes from can help you discover what header file it comes from.
  • Visual Studio, since at least 2003, includes an ERRLOOK tool. Try that first if you're using Visual Studio.
  • Many of the codes you'll encounter are in Winerror.h. I've included a link to MSDN that contains the contents of that header file. Or you can look at the error code listing by number on this page.
  • Ideally you know what function returned the code, and then you can lookup the function on MSDN and look at all the possible return values. Of course, you'll need to refer to Winerror.h, or an another header file to get the actual values.
  • You can find (like Unix grep) in the Include directory of the platform SDK for either the hex value of the entire error code, or the decimal value of just the code section--that is, the lower 16 bits. Use HRESULT_CODE to extract that. See the Structure of COM Error Codes above.
  • There are a few error lookup tools where you can paste in a value and it looks it up in its database and tells you what it means. Look here and here.
  • Google. Use the full hex value. Sometimes you'll find very useful information, or at least clues.
谁的新欢旧爱 2024-08-02 07:01:31

通常,如果以十六进制打印错误号,而不是带符号的十进制形式,您将获得更好的搜索结果。

例如,您的第一个错误是-1073741819,也可以用十六进制的0xC0000005表示。 这是一个“访问冲突”错误,谷歌很快就会告诉你。

Generally you will get better search results if you print out the error number in hex, instead of signed decimal form.

For example, your first error is -1073741819 which can also be represented by 0xC0000005 in hex. This is an "access violation" error as google will quickly tell you.

触ぅ动初心 2024-08-02 07:01:31

其中许多(但我认为与 COM 相关的不是)位于名为 winerror.h

在(某些版本的)Visual Studio 中,在“工具”菜单下,您可能会找到名为“错误查找...”的菜单项。

Many of them (but not I think the ones related to COM) are in a header file named winerror.h.

In (some versions of) Visual Studio, under the 'Tools' menu, you might find an menu item named 'Error Lookup...'.

紫竹語嫣☆ 2024-08-02 07:01:31

NTSTATUS

NTSTATUS *涵盖一系列设施
FACILITY_URT (0x013) *CLR 异常

HRESULTS

FACILITY_NULL (0x000)
FACILITY_RPC (0x001)
FACILITY_DISPATCH (0x002)
FACILITY_RPC_STUBS (0x003)
FACILITY_USER (0x004) *多个库可以重复使用相同的错误代码
FACILITY_MCA_ERROR_CODE (0x005)
FACILITY_WIN32MSDN (0x007) *标准 WINAPI 错误代码
FACILITY_WINDOWS (0x008)
FACILITY_SECURITY (0x009)
FACILITY_CERT (0x00B)
FACILITY_INTERNET (0x00C)
FACILITY_MEDIASERVER (0x00D)
FACILITY_MSMQ (0x00E)
FACILITY_SETUPAPI (0x00F)
FACILITY_SCARD (0x010)
FACILITY_COMPLUS (0x011)
FACILITY_HTTP (0x019)
FACILITY_USERMODE_FILTER_MANAGER (0x01F)
FACILITY_WINDOWSUPDATE (0x024)
FACILITY_GRAPHICS (0x026)
FACILITY_NAP (0x027)
FACILITY_INK (0x028)
FACILITY_TPM_SOFTWARE (0x029)
FACILITY_UI (0x02A)
FACILITY_PLA (0x030)
FACILITY_FVE (0x031)
FACILITY_FWP (0x032)
FACILITY_WINRM (0x033)
FACILITY_NDIS (0x034)
FACILITY_USERMODE_HYPERVISOR (0x035)
FACILITY_USERMODE_VIRTUALIZATION (0x037)
FACILITY_USERMODE_VOLMGR (0x038)
FACILITY_BCD (0x039)
FACILITY_USERMODE_VHD (0x03A)
FACILITY_SDIAG (0x03C)
FACILITY_WEBSERVICES (0x03D)
FACILITY_WPN (0x03E)
FACILITY_MBN (0x054)
FACILITY_P2P (0x063)
FACILITY_BLUETOOTH_ATT (0x065)
FACILITY_AUDIO (0x066)
FACILITY_IMAPI2 (0x0AA)
FACILITY_RTC_INTERFACE (0x0EE)
FACILITY_SIP_STATUS_CODE (0x0EF)
FACILITY_PINT_STATUS_CODE (0x0F0)
FACILITY_MAX_WDSTPTMGMT (0x110)
FACILITY_WDSMCSERVER (0x121)
FACILITY_MAX_WDSMC (0x122)
FACILITY_MAX_WDSCP (0x125)
FACILITY_BACKUP (0x7FF)
FACILITY_NTDSB (0x800)
FACILITY_DIRECT3D10 (0x879)
FACILITY_DXGI (0x87A)
FACILITY_DXGI_DDI (0x87B)
FACILITY_DIRECT3D11 (0x87C)
FACILITY_DWRITE (0x898)
FACILITY_D2D (0x899)
FACILITY_DEFRAG (0x900)
FACILITY_ONLINE_ID (0xA02)

错误检查

错误检查代码参考 *又名蓝屏

NTSTATUS

NTSTATUS *covers a range of facilities
FACILITY_URT (0x013) *CLR exceptions

HRESULTS

FACILITY_NULL (0x000)
FACILITY_RPC (0x001)
FACILITY_DISPATCH (0x002)
FACILITY_RPC_STUBS (0x003)
FACILITY_USER (0x004) *multiple libraries can reuse the same error code
FACILITY_MCA_ERROR_CODE (0x005)
FACILITY_WIN32, MSDN (0x007) *standard WINAPI error codes
FACILITY_WINDOWS (0x008)
FACILITY_SECURITY (0x009)
FACILITY_CERT (0x00B)
FACILITY_INTERNET (0x00C)
FACILITY_MEDIASERVER (0x00D)
FACILITY_MSMQ (0x00E)
FACILITY_SETUPAPI (0x00F)
FACILITY_SCARD (0x010)
FACILITY_COMPLUS (0x011)
FACILITY_HTTP (0x019)
FACILITY_USERMODE_FILTER_MANAGER (0x01F)
FACILITY_WINDOWSUPDATE (0x024)
FACILITY_GRAPHICS (0x026)
FACILITY_NAP (0x027)
FACILITY_INK (0x028)
FACILITY_TPM_SOFTWARE (0x029)
FACILITY_UI (0x02A)
FACILITY_PLA (0x030)
FACILITY_FVE (0x031)
FACILITY_FWP (0x032)
FACILITY_WINRM (0x033)
FACILITY_NDIS (0x034)
FACILITY_USERMODE_HYPERVISOR (0x035)
FACILITY_USERMODE_VIRTUALIZATION (0x037)
FACILITY_USERMODE_VOLMGR (0x038)
FACILITY_BCD (0x039)
FACILITY_USERMODE_VHD (0x03A)
FACILITY_SDIAG (0x03C)
FACILITY_WEBSERVICES (0x03D)
FACILITY_WPN (0x03E)
FACILITY_MBN (0x054)
FACILITY_P2P (0x063)
FACILITY_BLUETOOTH_ATT (0x065)
FACILITY_AUDIO (0x066)
FACILITY_IMAPI2 (0x0AA)
FACILITY_RTC_INTERFACE (0x0EE)
FACILITY_SIP_STATUS_CODE (0x0EF)
FACILITY_PINT_STATUS_CODE (0x0F0)
FACILITY_MAX_WDSTPTMGMT (0x110)
FACILITY_WDSMCSERVER (0x121)
FACILITY_MAX_WDSMC (0x122)
FACILITY_MAX_WDSCP (0x125)
FACILITY_BACKUP (0x7FF)
FACILITY_NTDSB (0x800)
FACILITY_DIRECT3D10 (0x879)
FACILITY_DXGI (0x87A)
FACILITY_DXGI_DDI (0x87B)
FACILITY_DIRECT3D11 (0x87C)
FACILITY_DWRITE (0x898)
FACILITY_D2D (0x899)
FACILITY_DEFRAG (0x900)
FACILITY_ONLINE_ID (0xA02)

Bug Checks

Bug Check Code Reference *aka Blue Screens

捎一片雪花 2024-08-02 07:01:31

好吧,这里有很多,

http://msdn.microsoft.com/en-us/library/ms681381(VS.85).aspx

但是当我得到像你的例子这样的一个时,我只是谷歌这个数字。

Well there's a bunch of them here,

http://msdn.microsoft.com/en-us/library/ms681381(VS.85).aspx

But when I get one like your example I just Google the number.

執念 2024-08-02 07:01:31

下面是 C# 中的一个类,可帮助您将错误代码转换为字符串

public static class WinErrors
{
    #region definitions
    [DllImport("kernel32.dll", SetLastError = true)]
    static extern IntPtr LocalFree(IntPtr hMem);

    [DllImport("kernel32.dll", SetLastError = true)]
    static extern int FormatMessage(FormatMessageFlags dwFlags, IntPtr lpSource, uint dwMessageId, uint dwLanguageId, ref IntPtr lpBuffer, uint nSize, IntPtr Arguments);

    [Flags]
    private enum FormatMessageFlags : uint
    {
        FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100,
        FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200,
        FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000,
        FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000,
        FORMAT_MESSAGE_FROM_HMODULE = 0x00000800,
        FORMAT_MESSAGE_FROM_STRING = 0x00000400,
    }
    #endregion

    /// <summary>
    /// Gets a user friendly string message for a system error code
    /// </summary>
    /// <param name="errorCode">System error code</param>
    /// <returns>Error string</returns>
    public static string GetSystemMessage(int errorCode)
    {
        try
        {
            IntPtr lpMsgBuf = IntPtr.Zero;

            int dwChars = FormatMessage(
                FormatMessageFlags.FORMAT_MESSAGE_ALLOCATE_BUFFER | FormatMessageFlags.FORMAT_MESSAGE_FROM_SYSTEM | FormatMessageFlags.FORMAT_MESSAGE_IGNORE_INSERTS,
                IntPtr.Zero,
                (uint) errorCode,
                0, // Default language
                ref lpMsgBuf,
                0,
                IntPtr.Zero);
            if (dwChars == 0)
            {
                // Handle the error.
                int le = Marshal.GetLastWin32Error();
                return "Unable to get error code string from System - Error " + le.ToString();
            }

            string sRet = Marshal.PtrToStringAnsi(lpMsgBuf);

            // Free the buffer.
            lpMsgBuf = LocalFree(lpMsgBuf);
            return sRet;
        }
        catch (Exception e)
        {
            return "Unable to get error code string from System -> " + e.ToString();
        }
    }
}

Here's a class in C# to help you convert the error codes to string:

public static class WinErrors
{
    #region definitions
    [DllImport("kernel32.dll", SetLastError = true)]
    static extern IntPtr LocalFree(IntPtr hMem);

    [DllImport("kernel32.dll", SetLastError = true)]
    static extern int FormatMessage(FormatMessageFlags dwFlags, IntPtr lpSource, uint dwMessageId, uint dwLanguageId, ref IntPtr lpBuffer, uint nSize, IntPtr Arguments);

    [Flags]
    private enum FormatMessageFlags : uint
    {
        FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100,
        FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200,
        FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000,
        FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000,
        FORMAT_MESSAGE_FROM_HMODULE = 0x00000800,
        FORMAT_MESSAGE_FROM_STRING = 0x00000400,
    }
    #endregion

    /// <summary>
    /// Gets a user friendly string message for a system error code
    /// </summary>
    /// <param name="errorCode">System error code</param>
    /// <returns>Error string</returns>
    public static string GetSystemMessage(int errorCode)
    {
        try
        {
            IntPtr lpMsgBuf = IntPtr.Zero;

            int dwChars = FormatMessage(
                FormatMessageFlags.FORMAT_MESSAGE_ALLOCATE_BUFFER | FormatMessageFlags.FORMAT_MESSAGE_FROM_SYSTEM | FormatMessageFlags.FORMAT_MESSAGE_IGNORE_INSERTS,
                IntPtr.Zero,
                (uint) errorCode,
                0, // Default language
                ref lpMsgBuf,
                0,
                IntPtr.Zero);
            if (dwChars == 0)
            {
                // Handle the error.
                int le = Marshal.GetLastWin32Error();
                return "Unable to get error code string from System - Error " + le.ToString();
            }

            string sRet = Marshal.PtrToStringAnsi(lpMsgBuf);

            // Free the buffer.
            lpMsgBuf = LocalFree(lpMsgBuf);
            return sRet;
        }
        catch (Exception e)
        {
            return "Unable to get error code string from System -> " + e.ToString();
        }
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文