ReactOS 0.4.15-dev-7924-g5949c20
errtostatus.h File Reference

Go to the source code of this file.

Classes

struct  _ERROR_BUCKET
 

Typedefs

typedef struct _ERROR_BUCKET ERROR_BUCKET
 
typedef struct _ERROR_BUCKETPERROR_BUCKET
 

Functions

BOOL ConvertWinErrorToNtstatus (__in ULONG WinError, __out NTSTATUS *Status)
 
NTSTATUS WinErrorToNtStatus (__in ULONG WinError)
 

Variables

const NTSTATUS INVALID_STATUS = (ULONG)(-1)
 
CONST NTSTATUS ErrorTable []
 
CONST ERROR_BUCKET ErrorBucketTable []
 

Typedef Documentation

◆ ERROR_BUCKET

◆ PERROR_BUCKET

Function Documentation

◆ ConvertWinErrorToNtstatus()

BOOL ConvertWinErrorToNtstatus ( __in ULONG  WinError,
__out NTSTATUS Status 
)

Definition at line 7 of file errtostatus.cpp.

11{
12 ULONG index = 0;
13 BOOL found = FALSE;
14
16
17 for ( ULONG i = 0; i < ARRAYSIZE(ErrorBucketTable); i++ )
18 {
19 if (WinError < ErrorBucketTable[i].BaseErrorCode)
20 {
21 //
22 // The error code falls between previous bucket end and current
23 // bucket begin, hence there is no mapping for it
24 //
25 break;
26 }
27
28 if ( WinError < (ErrorBucketTable[i].BaseErrorCode +
29 ErrorBucketTable[i].RunLength) )
30 {
31 //
32 // Index falls within the current bucket
33 //
34 index += (WinError - ErrorBucketTable[i].BaseErrorCode);
35 found = TRUE;
36 break;
37 }
38 else
39 {
40 //
41 // Index is beyond current bucket, continue search
42 //
44 }
45 }
46
47 if (TRUE == found)
48 {
50 if (INVALID_STATUS == (*Status))
51 {
52 found = FALSE;
53 }
54 }
55
56 return found;
57}
#define index(s, c)
Definition: various.h:29
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
CONST NTSTATUS ErrorTable[]
Definition: errtostatus.h:17
const NTSTATUS INVALID_STATUS
Definition: errtostatus.h:15
CONST ERROR_BUCKET ErrorBucketTable[]
Definition: errtostatus.h:1740
unsigned int BOOL
Definition: ntddk_ex.h:94
Status
Definition: gdiplustypes.h:25
GLuint index
Definition: glext.h:6031
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ULONG BaseErrorCode
Definition: errtostatus.h:11
USHORT RunLength
Definition: errtostatus.h:12
uint32_t ULONG
Definition: typedefs.h:59

Referenced by WinErrorToNtStatus().

◆ WinErrorToNtStatus()

NTSTATUS WinErrorToNtStatus ( __in ULONG  WinError)

Definition at line 60 of file errtostatus.cpp.

63{
65
66 if (TRUE == ConvertWinErrorToNtstatus(WinError, &status))
67 {
68 return status;
69 }
70 else
71 {
73 }
74}
LONG NTSTATUS
Definition: precomp.h:26
BOOL ConvertWinErrorToNtstatus(__in ULONG WinError, __out NTSTATUS *Status)
Definition: errtostatus.cpp:7
Definition: ps.c:97
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132

Referenced by __drv_when(), FxDriver::_InitializeDriverName(), DoTraceLevelMessage(), if(), and _MdTimer::Initialize().

Variable Documentation

◆ ErrorBucketTable

CONST ERROR_BUCKET ErrorBucketTable[]

Definition at line 1740 of file errtostatus.h.

Referenced by ConvertWinErrorToNtstatus().

◆ ErrorTable

CONST NTSTATUS ErrorTable[]

Definition at line 17 of file errtostatus.h.

Referenced by ConvertWinErrorToNtstatus().

◆ INVALID_STATUS

const NTSTATUS INVALID_STATUS = (ULONG)(-1)

Definition at line 15 of file errtostatus.h.

Referenced by ConvertWinErrorToNtstatus().