ReactOS  0.4.15-dev-1177-g6cb3b62
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 }
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420

Referenced by ConSrvConsoleCtrlEventTimeout().

◆ RtlGetLastWin32Error()

ULONG NTAPI RtlGetLastWin32Error ( VOID  )

Definition at line 132 of file error.c.

133 {
134  return NtCurrentTeb()->LastErrorValue;
135 }
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420

◆ 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 }
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420

Referenced by init_funcs(), and UnhandledExceptionFilter().

◆ RtlMapSecurityErrorToNtStatus()

NTSTATUS NTAPI RtlMapSecurityErrorToNtStatus ( IN ULONG  SecurityError)

Definition at line 179 of file error.c.

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

◆ 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 }
smooth NULL
Definition: ftsmooth.c:416
Status
Definition: gdiplustypes.h:24
Definition: compat.h:583
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
ULONG NTAPI RtlNtStatusToDosErrorNoTeb(IN NTSTATUS Status)
Definition: error.c:51
ULONG LastStatusValue
Definition: compat.h:623

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;
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 
77 no_mapping:
78  DPRINT1( "no mapping for %08x\n", Status );
80 }
GLuint GLuint end
Definition: gl.h:1545
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
Status
Definition: gdiplustypes.h:24
#define ERROR_MR_MID_NOT_FOUND
Definition: winerror.h:321
GLuint start
Definition: gl.h:1545
static const struct error_table error_table[20]
Definition: error.c:35
#define DPRINT1
Definition: precomp.h:8
#define HIWORD(l)
Definition: typedefs.h:247
unsigned int ULONG
Definition: retypes.h:1
#define LOWORD(l)
Definition: pedump.c:82

Referenced by RtlNtStatusToDosError().

◆ RtlSetLastWin32Error()

VOID NTAPI RtlSetLastWin32Error ( IN ULONG  LastError)

Definition at line 151 of file error.c.

152 {
153  NtCurrentTeb()->LastErrorValue = LastError;
154 }
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420

◆ RtlSetLastWin32ErrorAndNtStatusFromNtStatus()

VOID NTAPI RtlSetLastWin32ErrorAndNtStatusFromNtStatus ( IN NTSTATUS  Status)

Definition at line 169 of file error.c.

170 {
171  NtCurrentTeb()->LastErrorValue = RtlNtStatusToDosError(Status);
172 }
Status
Definition: gdiplustypes.h:24
ULONG NTAPI RtlNtStatusToDosError(IN NTSTATUS Status)
Definition: error.c:96
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420

◆ 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_NOGPFAULTERRORBOX
Definition: rtltypes.h:75
#define RTL_SEM_NOALIGNMENTFAULTEXCEPT
Definition: rtltypes.h:76
#define RTL_SEM_FAILCRITICALERRORS
Definition: rtltypes.h:74
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:475
Definition: compat.h:583
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
#define DPRINT1
Definition: precomp.h:8
return STATUS_SUCCESS
Definition: btrfs.c:3014

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_80000288[2]
Definition: error.c:359
static const DWORD table_40020056[1]
Definition: error.c:306
static const DWORD table_80000001[39]
Definition: error.c:316
static const DWORD table_40000370[1]
Definition: error.c:301
static const DWORD table_c0000202[396]
Definition: error.c:878
static const DWORD table_400200af[1]
Definition: error.c:311
static const DWORD table_80092010[4]
Definition: error.c:441
static const DWORD table_c0030059[9]
Definition: error.c:1397
static const DWORD table_80096004[1]
Definition: error.c:449
smooth NULL
Definition: ftsmooth.c:416
static const DWORD table_80090300[72]
Definition: error.c:365
static const DWORD table_c0130001[22]
Definition: error.c:1468
static const DWORD table_80130001[5]
Definition: error.c:454
static const DWORD table_00000102[32]
Definition: error.c:225
static const DWORD table_c00a0001[54]
Definition: error.c:1410
static const DWORD table_c0030001[12]
Definition: error.c:1381
static const DWORD table_40000002[36]
Definition: error.c:261
static const DWORD table_c0150001[39]
Definition: error.c:1494
static const DWORD table_c0000001[411]
Definition: error.c:463
static const DWORD table_c0020001[99]
Definition: error.c:1278

Definition at line 35 of file error.c.

Referenced by RtlNtStatusToDosErrorNoTeb().

◆ 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:
=
{
}
#define ERROR_MUTUAL_AUTH_FAILED
Definition: winerror.h:878

Definition at line 449 of file error.c.

◆ table_80130001

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

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 RPC_X_SS_CHAR_TRANS_OPEN_FAIL
Definition: winerror.h:1081
#define RPC_X_NULL_REF_POINTER
Definition: winerror.h:1087
#define RPC_X_SS_CONTEXT_DAMAGED
Definition: winerror.h:1084
#define RPC_X_SS_CHAR_TRANS_SHORT_FILE
Definition: winerror.h:1082
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define RPC_X_BYTE_COUNT_TOO_SMALL
Definition: winerror.h:1089
#define RPC_X_ENUM_VALUE_OUT_OF_RANGE
Definition: winerror.h:1088
#define RPC_X_SS_CANNOT_GET_CALL_HANDLE
Definition: winerror.h:1086
#define RPC_X_SS_HANDLES_MISMATCH
Definition: winerror.h:1085
#define RPC_X_NO_MORE_ENTRIES
Definition: winerror.h:1080
#define RPC_X_BAD_STUB_DATA
Definition: winerror.h:1090

Definition at line 1381 of file error.c.

◆ table_c0030059

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

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_NETWORK_EXISTS
Definition: winerror.h:1337
#define ERROR_CLUSTER_NO_SECURITY_CONTEXT
Definition: winerror.h:1351
#define ERROR_CLUSTER_NETWORK_NOT_FOUND
Definition: winerror.h:1338
#define ERROR_CLUSTER_INVALID_NODE
Definition: winerror.h:1332
#define ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND
Definition: winerror.h:1336
#define ERROR_CLUSTER_INVALID_NETWORK
Definition: winerror.h:1347
#define ERROR_CLUSTER_NETINTERFACE_EXISTS
Definition: winerror.h:1339
#define ERROR_CLUSTER_NODE_DOWN
Definition: winerror.h:1343
#define ERROR_CLUSTER_NODE_PAUSED
Definition: winerror.h:1362
#define ERROR_CLUSTER_NODE_EXISTS
Definition: winerror.h:1333
#define ERROR_CLUSTER_NODE_NOT_MEMBER
Definition: winerror.h:1345
#define ERROR_CLUSTER_NETWORK_NOT_INTERNAL
Definition: winerror.h:1352
#define ERROR_CLUSTER_JOIN_IN_PROGRESS
Definition: winerror.h:1334
#define ERROR_CLUSTER_NODE_UNREACHABLE
Definition: winerror.h:1344
#define ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS
Definition: winerror.h:1346
#define ERROR_CLUSTER_INVALID_NETWORK_PROVIDER
Definition: winerror.h:1342
#define ERROR_CLUSTER_NODE_UP
Definition: winerror.h:1348
#define ERROR_CLUSTER_NODE_NOT_PAUSED
Definition: winerror.h:1350
#define ERROR_CLUSTER_INVALID_REQUEST
Definition: winerror.h:1341
#define ERROR_CLUSTER_NODE_NOT_FOUND
Definition: winerror.h:1335
#define ERROR_CLUSTER_NETINTERFACE_NOT_FOUND
Definition: winerror.h:1340

Definition at line 1468 of file error.c.

◆ table_c0150001

const DWORD table_c0150001[39]
static

Definition at line 1494 of file error.c.