Hresults Windows

There are three common error code formats used throughout Windows. In the kernel and native part, NTSTATUS is used exclusively. The Win32 API uses its own error codes (they do not really have a name, so I will refer to them as Win32 error codes) and COM uses HRESULTs — though the separation is not always so sharp, e.g. the safe string functions (StringCch* and friends) also return HRESULTs although they do not belong to COM.

Moreover, the window to enable/disable Windows features is empty, but I am sure that the framework 4.5 is installed. The system is quite new (I upgraded it from windows 7 some month ago), there are very few software installed and it is protected with antivirus software. Thank you in advance. Description (' Windows Update Agent failed to download a redirector cabinet file with a new redirector ID value from the server during the recovery. WUEPTSAMEREDIRID = 0x8024502DDescription ( ' A redirector recovery action did not complete because the server is managed. Uninstalling the indicated module cleared up the problem immediately w/o a reboot. The errors only stared to appear in the last week after a Dell or Windows update. What I don't understand is why Intel goes ahead and installs Optane when it knows you don't have any Optane memory. Tech support scams are an industry-wide issue where scammers trick you into paying for unnecessary technical support services. You can help protect yourself from scammers by verifying that the contact is a Microsoft Agent or Microsoft Employee and that the phone number is an official Microsoft global customer service number. Windows UNC notation permits you to use a raw IPv4 address in dotted notation as a server name: For example, net view 127.0.0.1 will show you the shared resources on.

HRESULT (From winerror.h)

Hresults Windows

NTSTATUS and Win32 error codes (From Winerror.h or ntstatus.h)

NTSTATUS* and Win32 error codes share the same definition:

In user mode, these codes are primarily encountered as SEH exception codes (e.g. EXCEPTION_ACCESS_VIOLATION, 0xC0000005) or return values. However, due to compatibility reasons, all common error codes defined in winerror.h (such as ERROR_FILE_NOT_FOUND, 0x2) do not quite adhere to their definition. Neither have they set Severity to 0y11 nor have they set their facility code to FACILITY_WIN32). Unsurprisingly, they are the same as in OS/2 (see DosExecPgm as an example).

Another unfortunate property of these Win32 error codes is, that no typedef for them exists. In fact, some APIs such as RegOpenKeyEx treat them as signed (LONG), others such as GetLastError treat them as unsigned (DWORD). Again, this is probably due to compatibility reasons.

So how compatible are those codes? Comparing the structure of HRESULTs and NTSTATUS/Win32 error codes, it is worth noting that HRESULTs explicitly allow for holding NTSTATUS values (Informational NTSTATUS become success HRESULTS, Warning NTSTATUS become failure HRESULTs). Even the other way round, assigning HRESULT values to NTSTATUS variables seems to be ok, given that the R, C, N and r bits of HRESULTS are usually 0.

So on a syntactic level, assigning NTSTATUS values to HRESULTs and vice versa seems to be correct. But let us have a look at the facility codes:

NTSTATUS (ntstatus.h):

Win32 error codes and HRESULT(winerror.h):

Having the same format, NTSTATUS and Win32 error codes could be expected to use the same facility codes. However, this is not the case — instead, Win32 error codes (according to winerror.h) use the facility values of HRESULTs! As a consequence, interchanging NTSTATUS and Win32 error codes is syntacticly ok but changes their semantics due to non matching facility codes.

With this background in mind, it is now possible to define a conversion matrix:

From
NTSTATUSWin32HRESULT
ToNTSTATUSYes 1, 2Yes 1
Win32LsaNtStatusToWinError() or HRESULT_FROM_NT() 1, 4Yes 3
HRESULTHRESULT_FROM_WIN32( LsaNtStatusToWinError()) or HRESULT_FROM_NT() 1, 4Yes 2

1 Facility may need to be adapted
2 Holds for ‘real’ Win32 error codes. For compatibility error codes, use HRESULT_FROM_WIN32
3 As long as you have a ‘real’ HRESULT (i.e. not one from HRESULT_FROM_WIN32) and want to get a ‘real’ Win32 error code (i.e. not a compaitibility one) — otherwise it can get tricky
4 Note that HRESULT_FROM_NT does not take the NT Status to Win32 Error Code conversion table into account, thus the result may not be what one would expect. Using LsaNtStatusToWinError takes this table into account, but yields ‘compatibility’ Win32 error code.
* It turns out that the NTSTATUS documentation in the DDK contradicts the definition in ntstatus.h (3790): According to winerror.h, bit 28 is reserved whereas the DDK counts it as part of the facility field (Which, I guess, is wrong).

-->

The HRESULT numbering space is vendor-extensible. Vendorscan supply their own values for this field, as long as the C bit(0x20000000) is set, indicating it is a customer code.

Wikipedia

The HRESULT numbering space has the following internalstructure. Any protocol that uses NTSTATUS values on the wire is responsiblefor stating the order in which the bytes are placed on the wire.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

S

R

C

N

X

Facility

Code

Windows Memory Diagnostic Results Windows 10

S (1 bit): Severity. If set, indicates afailure result. If clear, indicates a success result.

R (1 bit): Reserved. If the N bit isclear, this bit MUST be set to 0. If the N bit is set, this bit isdefined by the NTSTATUS numbering space (as specified in section 2.3).

C (1 bit): Customer. This bit specifies if thevalue is customer-defined or Microsoft-defined. The bit is set forcustomer-defined values and clear for Microsoft-defined values.<1>

Find Chkdsk Results Windows 7

N (1 bit): If set, indicates that the errorcode is an NTSTATUS value (as specified in section 2.3), except that this bitis set.

X (1 bit): Reserved. SHOULD be set to 0. <2>

Hresults Windows

Facility (11 bits): An indicator of the sourceof the error. New facilities are occasionally added by Microsoft.

The following table lists the currently defined facilitycodes:

Error 0x80070005 In Microsoft Store & Xbox App, Can't Sync ...

Value

Meaning

FACILITY_NULL

0

The default facility code.

FACILITY_RPC

1

The source of the error code is an RPC subsystem.

FACILITY_DISPATCH

2

The source of the error code is a COM Dispatch.

FACILITY_STORAGE

3

The source of the error code is OLE Storage.

FACILITY_ITF

4

The source of the error code is COM/OLE Interface management.

FACILITY_WIN32

7

This region is reserved to map undecorated error codes into HRESULTs.

FACILITY_WINDOWS

8

The source of the error code is the Windows subsystem.

FACILITY_SECURITY

9

The source of the error code is the Security API layer.

FACILITY_SSPI

9

The source of the error code is the Security API layer.

FACILITY_CONTROL

10

The source of the error code is the control mechanism.

FACILITY_CERT

11

The source of the error code is a certificate client or server?

FACILITY_INTERNET

12

The source of the error code is Wininet related.

FACILITY_MEDIASERVER

13

The source of the error code is the Windows Media Server.

FACILITY_MSMQ

14

The source of the error code is the Microsoft Message Queue.

FACILITY_SETUPAPI

15

The source of the error code is the Setup API.

FACILITY_SCARD

16

The source of the error code is the Smart-card subsystem.

FACILITY_COMPLUS

17

The source of the error code is COM+.

FACILITY_AAF

18

The source of the error code is the Microsoft agent.

FACILITY_URT

19

The source of the error code is .NET CLR.

FACILITY_ACS

20

The source of the error code is the audit collection service.

FACILITY_DPLAY

21

The source of the error code is Direct Play.

FACILITY_UMI

22

The source of the error code is the ubiquitous memoryintrospection service.

FACILITY_SXS

23

The source of the error code is Side-by-side servicing.

FACILITY_WINDOWS_CE

24

The error code is specific to Windows CE.

FACILITY_HTTP

25

The source of the error code is HTTP support.

FACILITY_USERMODE_COMMONLOG

26

The source of the error code is common Logging support.

FACILITY_USERMODE_FILTER_MANAGER

31

The source of the error code is the user mode filter manager.

FACILITY_BACKGROUNDCOPY

32

The source of the error code is background copy control

FACILITY_CONFIGURATION

33

The source of the error code is configuration services.

FACILITY_STATE_MANAGEMENT

34

The source of the error code is state management services.

FACILITY_METADIRECTORY

35

The source of the error code is the Microsoft Identity Server.

FACILITY_WINDOWSUPDATE

36

The source of the error code is a Windows update.

FACILITY_DIRECTORYSERVICE

37

The source of the error code is Active Directory.

FACILITY_GRAPHICS

38

The source of the error code is the graphics drivers.

FACILITY_SHELL

39

The source of the error code is the user Shell.

FACILITY_TPM_SERVICES

40

The source of the error code is the Trusted Platform Module services.

FACILITY_TPM_SOFTWARE

41

The source of the error code is the Trusted Platform Module applications.

FACILITY_PLA

48

The source of the error code is Performance Logs and Alerts

FACILITY_FVE

49

The source of the error code is Full volume encryption.

FACILITY_FWP

50

he source of the error code is the Firewall Platform.

FACILITY_WINRM

51

The source of the error code is the Windows Resource Manager.

FACILITY_NDIS

52

The source of the error code is the Network Driver Interface.

FACILITY_USERMODE_HYPERVISOR

53

The source of the error code is the Usermode Hypervisor components.

FACILITY_CMI

54

The source of the error code is the Configuration Management Infrastructure.

FACILITY_USERMODE_VIRTUALIZATION

55

The source of the error code is the user mode virtualization subsystem.

FACILITY_USERMODE_VOLMGR

56

The source of the error code is the user mode volume manager

FACILITY_BCD

57

The source of the error code is the Boot Configuration Database.

FACILITY_USERMODE_VHD

58

The source of the error code is user mode virtual hard disk support.

FACILITY_SDIAG

60

The source of the error code is System Diagnostics.

FACILITY_WEBSERVICES

61

The source of the error code is the Web Services.

FACILITY_WINDOWS_DEFENDER

80

The source of the error code is a Windows Defender component.

FACILITY_OPC

81

The source of the error code is the open connectivity service.

See More Results

Code (2 bytes): The remainder of the errorcode.