ReactOS 0.4.15-dev-7942-gd23573b
error.c File Reference
#include <rtl.h>
#include <debug.h>
Include dependency graph for error.c:

Go to the source code of this file.

Classes

struct  error_table
 

Macros

#define NDEBUG
 

Functions

ULONG NTAPI RtlNtStatusToDosErrorNoTeb (IN NTSTATUS Status)
 
ULONG NTAPI RtlNtStatusToDosError (IN NTSTATUS Status)
 
NTSTATUS NTAPI RtlGetLastNtStatus (VOID)
 
ULONG NTAPI RtlGetLastWin32Error (VOID)
 
VOID NTAPI RtlSetLastWin32Error (IN ULONG LastError)
 
VOID NTAPI RtlSetLastWin32ErrorAndNtStatusFromNtStatus (IN NTSTATUS Status)
 
NTSTATUS NTAPI RtlMapSecurityErrorToNtStatus (IN ULONG SecurityError)
 
NTSTATUS NTAPI RtlSetThreadErrorMode (IN ULONG NewMode, OUT PULONG OldMode OPTIONAL)
 
ULONG NTAPI RtlGetThreadErrorMode (VOID)
 

Variables

static const struct error_table error_table [20]
 
static const DWORD table_00000102 [32]
 
static const DWORD table_40000002 [36]
 
static const DWORD table_40000370 [1]
 
static const DWORD table_40020056 [1]
 
static const DWORD table_400200af [1]
 
static const DWORD table_80000001 [39]
 
static const DWORD table_80000288 [2]
 
static const DWORD table_80090300 [72]
 
static const DWORD table_80092010 [4]
 
static const DWORD table_80096004 [1]
 
static const DWORD table_80130001 [5]
 
static const DWORD table_c0000001 [411]
 
static const DWORD table_c0000202 [396]
 
static const DWORD table_c0020001 [99]
 
static const DWORD table_c0030001 [12]
 
static const DWORD table_c0030059 [9]
 
static const DWORD table_c00a0001 [54]
 
static const DWORD table_c0130001 [22]
 
static const DWORD table_c0150001 [39]
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 25 of file error.c.

Function Documentation

◆ RtlGetLastNtStatus()

NTSTATUS NTAPI RtlGetLastNtStatus ( VOID  )

Definition at line 114 of file error.c.

115{
116 return NtCurrentTeb()->LastStatusValue;
117}
#define NtCurrentTeb

Referenced by ConSrvConsoleCtrlEventTimeout().

◆ RtlGetLastWin32Error()

ULONG NTAPI RtlGetLastWin32Error ( VOID  )

Definition at line 132 of file error.c.

133{
134 return NtCurrentTeb()->LastErrorValue;
135}

◆ RtlGetThreadErrorMode()

ULONG NTAPI RtlGetThreadErrorMode ( VOID  )

Definition at line 217 of file error.c.

218{
219 /* Return it from the TEB */
220 return NtCurrentTeb()->HardErrorMode;
221}

Referenced by init_funcs(), and UnhandledExceptionFilter().

◆ RtlMapSecurityErrorToNtStatus()

NTSTATUS NTAPI RtlMapSecurityErrorToNtStatus ( IN ULONG  SecurityError)

Definition at line 179 of file error.c.

180{
183}
#define UNIMPLEMENTED
Definition: debug.h:115
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239

◆ RtlNtStatusToDosError()

ULONG NTAPI RtlNtStatusToDosError ( IN NTSTATUS  Status)

Definition at line 96 of file error.c.

97{
98 PTEB Teb = NtCurrentTeb();
99
100 if (NULL != Teb)
101 {
102 Teb->LastStatusValue = Status;
103 }
105}
#define NULL
Definition: types.h:112
Status
Definition: gdiplustypes.h:25
ULONG NTAPI RtlNtStatusToDosErrorNoTeb(IN NTSTATUS Status)
Definition: error.c:51
Definition: compat.h:836
ULONG LastStatusValue
Definition: compat.h:875

Referenced by RtlSetLastWin32ErrorAndNtStatusFromNtStatus(), and SetLastNtError().

◆ RtlNtStatusToDosErrorNoTeb()

ULONG NTAPI RtlNtStatusToDosErrorNoTeb ( IN NTSTATUS  Status)

Definition at line 51 of file error.c.

52{
53 const struct error_table *table = error_table;
54
55 if (!Status || (Status & 0x20000000)) return Status;
56
57 /* 0xd... is equivalent to 0xc... */
58 if ((Status & 0xf0000000) == 0xd0000000) Status &= ~0x10000000;
59
60 while (table->start)
61 {
62 if ((ULONG)Status < table->start) break;
63 if ((ULONG)Status < table->end)
64 {
65 DWORD ret = table->table[Status - table->start];
66 /* unknown entries are 0 */
67 if (!ret) goto no_mapping;
68 return ret;
69 }
70 table++;
71 }
72
73 /* now some special cases */
74 if (HIWORD(Status) == 0xc001) return LOWORD(Status);
75 if (HIWORD(Status) == 0x8007) return LOWORD(Status);
76
77no_mapping:
78 DPRINT1( "no mapping for %08x\n", Status );
80}
#define DPRINT1
Definition: precomp.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
#define LOWORD(l)
Definition: pedump.c:82
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
int ret
#define ERROR_MR_MID_NOT_FOUND
Definition: winerror.h:321

Referenced by RtlNtStatusToDosError().

◆ RtlSetLastWin32Error()

VOID NTAPI RtlSetLastWin32Error ( IN ULONG  LastError)

Definition at line 151 of file error.c.

152{
153 NtCurrentTeb()->LastErrorValue = LastError;
154}

◆ RtlSetLastWin32ErrorAndNtStatusFromNtStatus()

VOID NTAPI RtlSetLastWin32ErrorAndNtStatusFromNtStatus ( IN NTSTATUS  Status)

Definition at line 169 of file error.c.

170{
171 NtCurrentTeb()->LastErrorValue = RtlNtStatusToDosError(Status);
172}
ULONG NTAPI RtlNtStatusToDosError(IN NTSTATUS Status)
Definition: error.c:96

◆ RtlSetThreadErrorMode()

NTSTATUS NTAPI RtlSetThreadErrorMode ( IN ULONG  NewMode,
OUT PULONG OldMode  OPTIONAL 
)

Definition at line 190 of file error.c.

192{
193 PTEB Teb = NtCurrentTeb();
194
195 /* Ignore invalid error modes */
196 if (NewMode & ~(RTL_SEM_FAILCRITICALERRORS |
199 {
200 DPRINT1("Invalid error mode\n");
202 }
203
204 /* Return old mode */
205 if (OldMode) *OldMode = Teb->HardErrorMode;
206
207 /* Set new one and return success */
208 Teb->HardErrorMode = NewMode;
209 return STATUS_SUCCESS;
210}
#define RTL_SEM_NOALIGNMENTFAULTEXCEPT
Definition: rtltypes.h:76
#define RTL_SEM_FAILCRITICALERRORS
Definition: rtltypes.h:74
#define RTL_SEM_NOGPFAULTERRORBOX
Definition: rtltypes.h:75
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:475
#define STATUS_SUCCESS
Definition: shellext.h:65

Variable Documentation

◆ error_table

Initial value:
=
{
{ 0x00000102, 0x00000122, table_00000102 },
{ 0x40000002, 0x40000026, table_40000002 },
{ 0x40000370, 0x40000371, table_40000370 },
{ 0x40020056, 0x40020057, table_40020056 },
{ 0x400200af, 0x400200b0, table_400200af },
{ 0x80000001, 0x80000028, table_80000001 },
{ 0x80000288, 0x8000028a, table_80000288 },
{ 0x80090300, 0x80090348, table_80090300 },
{ 0x80092010, 0x80092014, table_80092010 },
{ 0x80096004, 0x80096005, table_80096004 },
{ 0x80130001, 0x80130006, table_80130001 },
{ 0xc0000001, 0xc000019c, table_c0000001 },
{ 0xc0000202, 0xc000038e, table_c0000202 },
{ 0xc0020001, 0xc0020064, table_c0020001 },
{ 0xc0030001, 0xc003000d, table_c0030001 },
{ 0xc0030059, 0xc0030062, table_c0030059 },
{ 0xc00a0001, 0xc00a0037, table_c00a0001 },
{ 0xc0130001, 0xc0130017, table_c0130001 },
{ 0xc0150001, 0xc0150028, table_c0150001 },
{ 0, 0, NULL }
}
static const DWORD table_c0030059[9]
Definition: error.c:1397
static const DWORD table_00000102[32]
Definition: error.c:225
static const DWORD table_80090300[72]
Definition: error.c:365
static const DWORD table_c0130001[22]
Definition: error.c:1468
static const DWORD table_c0000001[411]
Definition: error.c:463
static const DWORD table_c0000202[396]
Definition: error.c:878
static const DWORD table_c00a0001[54]
Definition: error.c:1410
static const DWORD table_40000370[1]
Definition: error.c:301
static const DWORD table_400200af[1]
Definition: error.c:311
static const DWORD table_c0030001[12]
Definition: error.c:1381
static const DWORD table_80096004[1]
Definition: error.c:449
static const DWORD table_80000288[2]
Definition: error.c:359
static const DWORD table_80092010[4]
Definition: error.c:441
static const DWORD table_80000001[39]
Definition: error.c:316
static const DWORD table_c0150001[39]
Definition: error.c:1494
static const DWORD table_80130001[5]
Definition: error.c:454
static const DWORD table_40000002[36]
Definition: error.c:261
static const DWORD table_c0020001[99]
Definition: error.c:1278
static const DWORD table_40020056[1]
Definition: error.c:306

Definition at line 35 of file error.c.

◆ table_00000102

const DWORD table_00000102[32]
static

Definition at line 225 of file error.c.

◆ table_40000002

const DWORD table_40000002[36]
static

Definition at line 261 of file error.c.

◆ table_40000370

const DWORD table_40000370[1]
static
Initial value:
=
{
}
#define ERROR_DS_SHUTTING_DOWN
Definition: winerror.h:1598

Definition at line 301 of file error.c.

◆ table_40020056

const DWORD table_40020056[1]
static
Initial value:
=
{
}
#define RPC_S_UUID_LOCAL_ONLY
Definition: winerror.h:1131

Definition at line 306 of file error.c.

◆ table_400200af

const DWORD table_400200af[1]
static
Initial value:
=
{
}
#define RPC_S_SEND_INCOMPLETE
Definition: winerror.h:1155

Definition at line 311 of file error.c.

◆ table_80000001

const DWORD table_80000001[39]
static

Definition at line 316 of file error.c.

◆ table_80000288

const DWORD table_80000288[2]
static
Initial value:
=
{
}
#define ERROR_DEVICE_DOOR_OPEN
Definition: winerror.h:688
#define ERROR_DEVICE_REQUIRES_CLEANING
Definition: winerror.h:687

Definition at line 359 of file error.c.

◆ table_80090300

const DWORD table_80090300[72]
static

Definition at line 365 of file error.c.

◆ table_80092010

const DWORD table_80092010[4]
static
Initial value:

Definition at line 441 of file error.c.

◆ table_80096004

const DWORD table_80096004[1]
static
Initial value:

Definition at line 449 of file error.c.

◆ table_80130001

const DWORD table_80130001[5]
static
Initial value:
=
{
}
#define ERROR_CLUSTER_NODE_ALREADY_MEMBER
Definition: winerror.h:1357
#define ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE
Definition: winerror.h:1356
#define ERROR_CLUSTER_NODE_ALREADY_DOWN
Definition: winerror.h:1354
#define ERROR_CLUSTER_NETWORK_ALREADY_ONLINE
Definition: winerror.h:1355
#define ERROR_CLUSTER_NODE_ALREADY_UP
Definition: winerror.h:1353

Definition at line 454 of file error.c.

◆ table_c0000001

const DWORD table_c0000001[411]
static

Definition at line 463 of file error.c.

◆ table_c0000202

const DWORD table_c0000202[396]
static

Definition at line 878 of file error.c.

◆ table_c0020001

const DWORD table_c0020001[99]
static

Definition at line 1278 of file error.c.

◆ table_c0030001

const DWORD table_c0030001[12]
static
Initial value:
=
{
}
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define RPC_X_SS_HANDLES_MISMATCH
Definition: winerror.h:1085
#define RPC_X_ENUM_VALUE_OUT_OF_RANGE
Definition: winerror.h:1088
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090
#define RPC_X_SS_CHAR_TRANS_OPEN_FAIL
Definition: winerror.h:1081
#define RPC_X_NO_MORE_ENTRIES
Definition: winerror.h:1080
#define RPC_X_NULL_REF_POINTER
Definition: winerror.h:1087
#define RPC_X_SS_CANNOT_GET_CALL_HANDLE
Definition: winerror.h:1086
#define RPC_X_BYTE_COUNT_TOO_SMALL
Definition: winerror.h:1089
#define RPC_X_SS_CONTEXT_DAMAGED
Definition: winerror.h:1084
#define RPC_X_SS_CHAR_TRANS_SHORT_FILE
Definition: winerror.h:1082

Definition at line 1381 of file error.c.

◆ table_c0030059

const DWORD table_c0030059[9]
static
Initial value:
=
{
}
#define RPC_X_WRONG_ES_VERSION
Definition: winerror.h:1135
#define RPC_X_WRONG_PIPE_VERSION
Definition: winerror.h:1139
#define RPC_X_WRONG_PIPE_ORDER
Definition: winerror.h:1138
#define RPC_X_PIPE_DISCIPLINE_ERROR
Definition: winerror.h:1159
#define RPC_X_WRONG_STUB_VERSION
Definition: winerror.h:1136
#define RPC_X_PIPE_CLOSED
Definition: winerror.h:1158
#define RPC_X_PIPE_EMPTY
Definition: winerror.h:1160
#define RPC_X_INVALID_PIPE_OBJECT
Definition: winerror.h:1137
#define RPC_X_INVALID_ES_ACTION
Definition: winerror.h:1134

Definition at line 1397 of file error.c.

◆ table_c00a0001

const DWORD table_c00a0001[54]
static

Definition at line 1410 of file error.c.

◆ table_c0130001

const DWORD table_c0130001[22]
static
Initial value:
=
{
0,
}
#define ERROR_CLUSTER_NODE_PAUSED
Definition: winerror.h:1362
#define ERROR_CLUSTER_NODE_DOWN
Definition: winerror.h:1343
#define ERROR_CLUSTER_NODE_UP
Definition: winerror.h:1348
#define ERROR_CLUSTER_INVALID_NETWORK_PROVIDER
Definition: winerror.h:1342
#define ERROR_CLUSTER_NODE_NOT_MEMBER
Definition: winerror.h:1345
#define ERROR_CLUSTER_JOIN_IN_PROGRESS
Definition: winerror.h:1334
#define ERROR_CLUSTER_NODE_EXISTS
Definition: winerror.h:1333
#define ERROR_CLUSTER_INVALID_REQUEST
Definition: winerror.h:1341
#define ERROR_CLUSTER_NETWORK_NOT_FOUND
Definition: winerror.h:1338
#define ERROR_CLUSTER_NO_SECURITY_CONTEXT
Definition: winerror.h:1351
#define ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND
Definition: winerror.h:1336
#define ERROR_CLUSTER_NETWORK_EXISTS
Definition: winerror.h:1337
#define ERROR_CLUSTER_INVALID_NETWORK
Definition: winerror.h:1347
#define ERROR_CLUSTER_NODE_NOT_PAUSED
Definition: winerror.h:1350
#define ERROR_CLUSTER_NETINTERFACE_EXISTS
Definition: winerror.h:1339
#define ERROR_CLUSTER_NODE_NOT_FOUND
Definition: winerror.h:1335
#define ERROR_CLUSTER_INVALID_NODE
Definition: winerror.h:1332
#define ERROR_CLUSTER_NETINTERFACE_NOT_FOUND
Definition: winerror.h:1340
#define ERROR_CLUSTER_NODE_UNREACHABLE
Definition: winerror.h:1344
#define ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS
Definition: winerror.h:1346
#define ERROR_CLUSTER_NETWORK_NOT_INTERNAL
Definition: winerror.h:1352

Definition at line 1468 of file error.c.

◆ table_c0150001

const DWORD table_c0150001[39]
static

Definition at line 1494 of file error.c.