Home > hresult values > decode hresult error

Decode Hresult Error

Contents

LippertOctober 22, 200319 0 0 0

Every now and then -- like, say, this morning -- someone sends me this mail:

I'm getting an error in my JScript program. The error hresult values number is -2147024877. No description. Help!

Making sense of those

What Is Hresult

error numbers requires some delving into the depths of how COM represents errors -- the HRESULT.

An HRESULT

Hresult C#

is a 32 bit unsigned integer where the high bit indicates whether it is an error or a success. The remaining bits in the high word indicate the "facility" of the error -- into what broad category does

Hresult Msdn

this error fall? The low word indicates the specific error for that facility.

HRESULTS are therefore usually talked about in hex, as the bit structure is a lot easier to read in hex! Consider 0x80070013, for example. The high bit is set, so this is an error. The facility code is 7 and the error code is 0x0013 = 19 in decimal.

Unfortunately, JScript interprets the 32 hresult values win32 error codes bit error code as a signed integer and displays it in decimal. No problem -- just convert that thing back to hex, right?

var x = -2147024877;

print(x.toString(16))

Whoops, not quite. JScript doesn't know that you want this as an unsigned number, so it converts it to a signed hex number, -0x7ff8ffed. We need to convert this thing to the value it would have been had JScript interpreted it as an unsigned number in the first place. A handy fact to know is that the difference between an unsigned number interpreted as a signed number and the same number interpreted as an unsigned number is always 0x100000000 if the high bit is set, 0 otherwise.

var x = -2147024877;

print((x<0?x+0x100000000:x).toString(16))

There we go. That prints out 80070013. Or, even better, we could just write a program that takes the error apart:

function DumpHR(hr)

{

if (hr < 0 )

hr += 0x100000000;

if (hr & 0x80000000)

print("Error code");

else

print("Success code");

var facility = (hr & 0x7FFF0000) >> 16;

print("Facility " + facility);

Info From a DMP File withPowerShell → Using PowerShell to DecodeHResults Posted on August 14, 2015 by chentiangemalc Here is some code that hresult s_ok breaks a HResul (the 8 digit hex error codes or long negative hresult definition decimal number error codes) into its subcomponents, this can make it easier to identify the source of an hresult header error… You can read more about HRESULT here https://msdn.microsoft.com/en-us/library/cc231198.aspx This requires PowerShell v3.0 or higher for the bitwise operations. Script can be downloaded here: http://1drv.ms/1NtDBSL #based on winerror.h from Windows https://blogs.msdn.microsoft.com/ericlippert/2003/10/22/making-sense-of-hresults/ 10 SDK function Get-HresultFailed($hr) { return $hr -lt 0 } function Get-HresultCode($hr) { return $hr -band 0xFFFF } function Get-ErrorMessage($code) { $ex = New-Object System.ComponentModel.Win32Exception($code) return $ex.Message } function Get-HresultFacility($hr) { $facilityCode = (($hr) -shr 16) -band 0x1fff switch ($facilityCode) { 0 { return "FACILITY_NULL" } 1 { return "FACILITY_RPC" } 2 { return "FACILITY_DISPATCH" } 3 { return "FACILITY_STORAGE" } https://chentiangemalc.wordpress.com/2015/08/14/using-powershell-to-decode-hresults/ 4 { return "FACILITY_ITF" } 7 { return "FACILITY_WIN32" } 8 { return "FACILITY_WINDOWS" } 9 { return "FACILITY_SSPI" } 9 { return "FACILITY_SECURITY" } 10 { return "FACILITY_CONTROL" } 11 { return "FACILITY_CERT" } 12 { return "FACILITY_INTERNET" } 13 { return "FACILITY_MEDIASERVER" } 14 { return "FACILITY_MSMQ" } 15 { return "FACILITY_SETUPAPI" } 16 { return "FACILITY_SCARD" } 17 { return "FACILITY_COMPLUS" } 18 { return "FACILITY_AAF" } 19 { return "FACILITY_URT" } 20 { return "FACILITY_ACS" } 21 { return "FACILITY_DPLAY" } 22 { return "FACILITY_UMI" } 23 { return "FACILITY_SXS" } 24 { return "FACILITY_WINDOWS_CE" } 25 { return "FACILITY_HTTP" } 26 { return "FACILITY_USERMODE_COMMONLOG" } 27 { return "FACILITY_WER" } 31 { return "FACILITY_USERMODE_FILTER_MANAGER" } 32 { return "FACILITY_BACKGROUNDCOPY" } 33 { return "FACILITY_WIA" } 33 { return "FACILITY_CONFIGURATION" } 34 { return "FACILITY_STATE_MANAGEMENT" } 35 { return "FACILITY_METADIRECTORY" } 36 { return "FACILITY_WINDOWSUPDATE" } 37 { return "FACILITY_DIRECTORYSERVICE" } 38 { return "FACILITY_GRAPHICS" } 39 { return "FACILITY_SHELL" } 39 { return "FACILITY_NAP" } 40 { return "FACILITY_TPM_SERVICES" } 41 { return "FACILITY_T

and removed. (September 2016) (Learn how and when to remove this template message) In the field of computer programming, the HRESULT is a data type used in Windows operating https://en.wikipedia.org/wiki/HRESULT systems, and the earlier IBM/Microsoft OS/2 operating system, to represent error conditions, and http://forums.devshed.com/programming-42/hresult-value-decode-291245.html warning conditions. The original purpose of HRESULTs was to formally lay out ranges of error codes for both public and Microsoft internal use in order to prevent collisions between error codes in different subsystems of the OS/2 operating system. HRESULTs are numerical error codes. Various bits within an HRESULT hresult values encode information about the nature of the error code, and where it came from. HRESULT error codes are most commonly encountered in COM programming, where they form the basis for a standardized COM error handling convention. Contents 1 HRESULT format 1.1 Format details 2 How HRESULTs work 3 Using HRESULTs 4 Examples 5 References 6 External links HRESULT format[edit] An HRESULT decode hresult error value has 32 bits divided into three fields: a severity code, a facility code, and an error code. The severity code indicates whether the return value represents information, warning, or error. The facility code identifies the area of the system responsible for the error. The error code is a unique number that is assigned to represent the exception. Each exception is mapped to a distinct HRESULT. HRESULTs are organized as follows:[1] Bit 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Field S R C N X Facility Code Format details[edit] S - Severity - indicates success/fail 0 - Success 1 - Failure R - Reserved portion of the facility code, corresponds to NT's second severity bit. 1 - Severe Failure C - Customer. This bit specifies if the value is customer-defined or Microsoft-defined. 0 - Microsoft-defined 1 - Customer-defined N - Reserved portion of the facility code. Used to indicate a mapped NT status value. X - Reserved portio

Search Username Password Remember Me? Register Lost Password? facebook google twitter rss Free Web Developer Tools Advanced Search  Forum Programming Languages C Programming HRESULT value decode Thread: HRESULT value decode Share This Thread  Tweet This + 1 this Post To Linkedin Subscribe to this Thread  Subscribe to This Thread September 22nd, 2005,10:40 AM #1 No Profile Picture smoof View Profile View Forum Posts Visit Homepage  Member Devshed Newbie (0 - 499 posts)  Join Date Dec 2003 Location Gent (Belgium) Posts 26 Rep Power 0 HRESULT value decode Hello, I need to decode a HRESULT decimal value thrown by a COM server. I am actually looking for an application like HRESULT Plus, but it seems impossible to find this app somewhere on the net.. Does anyone have this app or a similar one ? more info about HRESULT decoding ? Thanks! Faq Reply With Quote September 22nd, 2005,10:50 AM #2 Scorpions4ever View Profile View Forum Posts  Banned ;) Devshed Supreme Being (6500+ posts)                Join Date Nov 2001 Location Woodland Hills, Los Angeles County, California, USA Posts 9,766 Rep Power 4299 Go straight to MSDN: http://msdn.microsoft.com/library/de...e3a025a9b5.asp http://msdn.microsoft.com/library/de...8b80304103.asp and also check your winerror.h file for the values. Note that the HRESULT returned is somewhat interface specific. So, two interfaces may return the same HRESULT error, even though they mean different things. When you're checking for a specific error code, don't forget to include the interface name in the search as well. Comments on this post smoof  agrees Last edited by Scorpions4ever; September 22nd, 2005 at 10:53 AM. Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death

 

Related content

error message hresut-1073741502

Error Message Hresut- table id toc tbody tr td div id toctitle Contents div ul li a href What Is Hresult a li li a href Hresult C a li li a href Hresult Values Win Error Codes a li ul td tr tbody table p server is running Windows and IIS The only way I can seem to resolve relatedl the issue is to restart IIS completely Compilation Error hresult values Description An error occurred during the compilation of a resource required to p h id What Is Hresult p service this request review the following specific error details

error success value

Error Success Value table id toc tbody tr td div id toctitle Contents div ul li a href Hresult Error a li li a href S false Value a li li a href Hresult C a li li a href Hresult C a li ul td tr tbody table p Studio products Visual Studio Team Services Visual Studio relatedl Code Visual Studio Dev Essentials Office Office hresult values Word Excel PowerPoint Microsoft Graph Outlook OneDrive Sharepoint Skype Services Store Cortana p h id Hresult Error p Bing Application Insights Languages platforms Xamarin ASP NET C TypeScript NET - VB C

error value is 0x80004005

Error Value Is x table id toc tbody tr td div id toctitle Contents div ul li a href Hresult Values a li li a href Hresult Values Win Error Codes a li li a href Hresult C a li li a href Decode Hresult a li ul td tr tbody table p games PC games p h id Hresult Values p Windows games Windows phone games Entertainment All Entertainment hresult error Movies TV Music Business Education Business Students educators p h id Hresult Values Win Error Codes p Developers Sale Sale Find a store Gift cards Products Software services

hresult error

Hresult Error table id toc tbody tr td div id toctitle Contents div ul li a href Hresult Values a li li a href Hresult Values Win Error Codes a li li a href Hresult S ok a li li a href Hresult S false a li ul td tr tbody table p Du siehst YouTube auf Deutsch Du kannst diese Einstellung unten ndern Learn more You're viewing YouTube in relatedl German You can change this preference below p h id Hresult Values p Schlie en Ja ich m chte sie behalten R ckg ngig machen Schlie en Dieses hresult

hresult values win32 error codes

Hresult Values Win Error Codes table id toc tbody tr td div id toctitle Contents div ul li a href Hresult C a li li a href Decode Hresult a li li a href Hresult a li ul td tr tbody table p Studio products Visual Studio Team Services Visual Studio relatedl Code Visual Studio Dev Essentials Office Office hresult list Word Excel PowerPoint Microsoft Graph Outlook OneDrive Sharepoint Skype Services Store Cortana hresult c Bing Application Insights Languages platforms Xamarin ASP NET C TypeScript NET - VB C F p h id Hresult C p Server Windows Server SQL

hresult com error

Hresult Com Error table id toc tbody tr td div id toctitle Contents div ul li a href Hresult Values a li li a href Decode Hresult a li li a href Hresult C a li li a href Hresult Msdn a li ul td tr tbody table p Studio products Visual Studio Team Services Visual Studio Code Visual Studio Dev Essentials Office Office Word Excel PowerPoint Microsoft Graph Outlook OneDrive Sharepoint Skype Services Store relatedl Cortana Bing Application Insights Languages platforms Xamarin ASP NET p h id Hresult Values p C TypeScript NET - VB C F Server Windows

msdn hresult error

Msdn Hresult Error table id toc tbody tr td div id toctitle Contents div ul li a href Hresult Values a li li a href Hresult C a li li a href Hresult x a li li a href What Is Hresult a li ul td tr tbody table p resources Windows Server resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV relatedl Startups TechRewards Events Community Magazine Forums Blogs Channel p h id Hresult Values p Documentation APIs and reference Dev centers Samples Retired content We re sorry hresult values win error codes The