ReactOS  0.4.15-dev-3439-g2693a26
errtostatus.cpp File Reference
#include "Mx.h"
Include dependency graph for errtostatus.cpp:

Go to the source code of this file.

Functions

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

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 TRUE
Definition: types.h:120
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
CONST NTSTATUS ErrorTable[]
Definition: errtostatus.h:17
CONST ERROR_BUCKET ErrorBucketTable[]
Definition: errtostatus.h:1740
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
const NTSTATUS INVALID_STATUS
Definition: errtostatus.h:15
GLuint index
Definition: glext.h:6031
Status
Definition: gdiplustypes.h:24
#define index(s, c)
Definition: various.h:29
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
unsigned int ULONG
Definition: retypes.h:1
USHORT RunLength
Definition: errtostatus.h:12

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  {
72  return STATUS_UNSUCCESSFUL;
73  }
74 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
BOOL ConvertWinErrorToNtstatus(__in ULONG WinError, __out NTSTATUS *Status)
Definition: errtostatus.cpp:7
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

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