{"id":21023,"date":"2008-09-01T10:00:00","date_gmt":"2008-09-01T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2008\/09\/01\/how-do-i-convert-an-error-code-to-text-when-format_message_from_system-doesnt-work\/"},"modified":"2008-09-01T10:00:00","modified_gmt":"2008-09-01T10:00:00","slug":"how-do-i-convert-an-error-code-to-text-when-format_message_from_system-doesnt-work","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20080901-00\/?p=21023","title":{"rendered":"How do I convert an error code to text when FORMAT_MESSAGE_FROM_SYSTEM doesn&#8217;t work?"},"content":{"rendered":"<p> For the same reason that <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2006\/11\/03\/942851.aspx\"> not all error codes are defined in <code>winerror.h<\/code><\/a>, not all error strings are defined in the system message table. If you&#8217;ve ever played with the message compiler, you&#8217;d quickly have recognized the <code>winerror.h<\/code> file as the header file associated with a message resource. In other words, there&#8217;s a <code>.mc<\/code> file that gets processed by the message compiler, and out pops the message resource (which becomes the system message table) and the <code>winerror.h<\/code> header file. <\/p>\n<p> As we saw a few years ago, <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2006\/11\/03\/942851.aspx\"> not all error messages live in <code>winerror.h<\/code><\/a>, which means that not all error messages live in the system message table. Each component that provides error codes outside of <code>winerror.h<\/code> needs to provide its own message table. For example, <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/aa370285.aspx\"> messages for network errors can be found in <code>netmsg.dll<\/code><\/a>. Similarly, <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2005\/09\/08\/462402.aspx#462550\"> winhttp error message text can be found in <code>winhttp.dll<\/code><\/a>. I don&#8217;t know about other message ranges; hopefully the documentation for the component that generates those errors also mentions where you can find the text. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>For the same reason that not all error codes are defined in winerror.h, not all error strings are defined in the system message table. If you&#8217;ve ever played with the message compiler, you&#8217;d quickly have recognized the winerror.h file as the header file associated with a message resource. In other words, there&#8217;s a .mc file [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-21023","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>For the same reason that not all error codes are defined in winerror.h, not all error strings are defined in the system message table. If you&#8217;ve ever played with the message compiler, you&#8217;d quickly have recognized the winerror.h file as the header file associated with a message resource. In other words, there&#8217;s a .mc file [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/21023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=21023"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/21023\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=21023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=21023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=21023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}