ReactOS 0.4.15-dev-7654-g6bc40d3
errtostatus.cpp
Go to the documentation of this file.
1//
2// Copyright (C) Microsoft. All rights reserved.
3//
4#include "Mx.h"
5
8 __in ULONG WinError,
10 )
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}
58
61 __in ULONG WinError
62 )
63{
65
66 if (TRUE == ConvertWinErrorToNtstatus(WinError, &status))
67 {
68 return status;
69 }
70 else
71 {
73 }
74}
LONG NTSTATUS
Definition: precomp.h:26
#define index(s, c)
Definition: various.h:29
#define __in
Definition: dbghelp.h:35
#define __out
Definition: dbghelp.h:62
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
BOOL ConvertWinErrorToNtstatus(__in ULONG WinError, __out NTSTATUS *Status)
Definition: errtostatus.cpp:7
NTSTATUS WinErrorToNtStatus(__in ULONG WinError)
Definition: errtostatus.cpp:60
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
Definition: ps.c:97
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132