HRESULT exceptions
Asked Answered
F

4

2

Is there any lists where the error codes are explained. Eks: HRESULT: 0x81070215 does not tell me enything about what when wrong?

Faery answered 31/8, 2009 at 8:54 Comment(0)
K
7
WinError.h 

I have this at the following path on my machine, yours will be similar as well:

C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\WinError.h

BTW, if you have Visual Studio installed, then there is a tool available named 'Error Lookup'. Go to Visual Studio, Tools->Error Lookup and in it you can put any HRESULT code to get it's description. You can download ErrorLookup from this location as well.

Krieger answered 31/8, 2009 at 8:59 Comment(0)
V
1

The HRESULT codes are defined by the code that is causing them to happen, so there is no unique list - it depends on the server code as to what they mean. Normally, you want to look at the error info for the current thread, and see what additional information is passed along with it, in order for it to make sense.

Vogele answered 31/8, 2009 at 9:0 Comment(0)
T
0

There is an error look tool in VS's Tools menu (Tools->Error Lookup), also you can find tool here

C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\errlook.exe
Timeserver answered 31/8, 2009 at 9:3 Comment(0)
R
0

Some of the more common error messages can be looked up via windows built in tools like certutil or net

PS C:\> net helpmsg 5

Access denied

PS C:\> certutil -error '0x80070005'
0x80070005 (WIN32: 5 ERROR_ACCESS_DENIED) -- 2147942405 (-2147024891)
Text of the error message: Access denied

As the question is tagged .net: There is also Marshal.GetExceptionForHR which can be used to translate some HRESULTS into useful .net exceptions.
It can also be called from Powershell:
PS C:\> [System.Runtime.InteropServices.Marshal]::GetExceptionForHR(0x81070215, -1)
Sadly this method also doesn't provide anything useful for the requested value 0x81070215.

A quite long list of common values is available from microsoft as pdf under the name MS-ERREF. This list also doesn't include the requested error.

We can see from the descripton of the HRESULT structure, that the value has the S bit set (it is an error), C bit clear (Microsoft-defined, not customer-defined), N bit clear (not a wrapped NTSTATUS), Facility 0x107 and Code 0x215. Facility code 0x107 is FACILITY_DEPLOYMENT_SERVICES_PXE. The documentation of functions in the Deployment Services wdspxe.h header (which I guess based on the name would be what mostly corresponds to that facility) lists WdsPxe.dll as the corresponding library. If you have that library on your system you could try to use FormatMessage as described in this answer and pass in a handle to WdsPxe.dll instead of ntdll.dll which is used in that anwser.

Rolan answered 25/6 at 20:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.