ReactOS  0.4.14-dev-614-gbfd8a84
errno.c File Reference
#include <precomp.h>
#include "doserrmap.h"
#include <errno.h>
#include <internal/wine/msvcrt.h>
Include dependency graph for errno.c:

Go to the source code of this file.

Functions

int *CDECL _errno (void)
 
unsigned long *CDECL __doserrno (void)
 
errno_t CDECL _get_errno (int *pValue)
 
errno_t CDECL _get_doserrno (unsigned long *pValue)
 
errno_t CDECL _set_errno (int value)
 
errno_t CDECL _set_doserrno (unsigned long value)
 
void CDECL _dosmaperr (unsigned long oserror)
 
int CDECL _set_error_mode (int mode)
 
void CDECL _seterrormode (int mode)
 
void __cdecl _invalid_parameter (const wchar_t *expr, const wchar_t *func, const wchar_t *file, unsigned int line, uintptr_t arg)
 
_invalid_parameter_handler CDECL _get_invalid_parameter_handler (void)
 
_invalid_parameter_handler CDECL _set_invalid_parameter_handler (_invalid_parameter_handler handler)
 

Variables

static _invalid_parameter_handler invalid_parameter_handler = NULL
 
int msvcrt_error_mode = MSVCRT__OUT_TO_DEFAULT
 

Function Documentation

◆ __doserrno()

unsigned long* CDECL __doserrno ( void  )

Definition at line 27 of file errno.c.

28 {
29  return &(msvcrt_get_thread_data()->thread_doserrno);
30 }
thread_data_t * msvcrt_get_thread_data(void)
Definition: tls.c:31

Referenced by _cwait(), _get_doserrno(), _set_doserrno(), and msvcrt_init_fp().

◆ _dosmaperr()

void CDECL _dosmaperr ( unsigned long  oserror)

Definition at line 81 of file errno.c.

82 {
83  int pos, base, lim;
84 
85  _set_doserrno(oserror);
86 
87  /* Use binary chop to find the corresponding errno code */
88  for (base=0, lim=sizeof(doserrmap)/sizeof(doserrmap[0]); lim; lim >>= 1) {
89  pos = base+(lim >> 1);
90  if (doserrmap[pos].winerr == oserror) {
92  return;
93  } else if (doserrmap[pos].winerr < oserror) {
94  base = pos + 1;
95  --lim;
96  }
97  }
98  /* EINVAL appears to be the default */
100 }
Definition: arc.h:39
int en
Definition: doserrmap.h:8
errno_t CDECL _set_doserrno(unsigned long value)
Definition: errno.c:68
GLuint base
Definition: 3dtext.c:35
errno_t CDECL _set_errno(int value)
Definition: errno.c:59
struct @3933 doserrmap[]
unsigned long winerr
Definition: doserrmap.h:7

Referenced by _access(), _beginthreadex(), _chdrive(), _chmod(), _chsize_s(), _close(), _commit(), _cwait(), _dup2(), _findclose(), _fstat64(), _futime(), _heapchk(), _heapmin(), _heapwalk(), _lseeki64(), _open_osfhandle(), _pclose(), _pipe(), _tchdir(), _tfindfirst(), _tfindnext(), _tfullpath(), _tgetcwd(), _tmkdir(), _trmdir(), _tsearchenv_s(), _unlink(), _waccess(), _wchmod(), _wfreopen(), _wremove(), _wrename(), _write(), _wsopen_s(), _wunlink(), access_dirT(), do_spawnT(), read_utf8(), remove(), rename(), and system().

◆ _errno()

◆ _get_doserrno()

errno_t CDECL _get_doserrno ( unsigned long pValue)

Definition at line 47 of file errno.c.

48 {
49  if (!pValue)
50  return EINVAL;
51 
52  *pValue = *__doserrno();
53  return 0;
54 }
Definition: arc.h:39
unsigned long *CDECL __doserrno(void)
Definition: errno.c:27

◆ _get_errno()

errno_t CDECL _get_errno ( int pValue)

Definition at line 35 of file errno.c.

36 {
37  if (!pValue)
38  return EINVAL;
39 
40  *pValue = *_errno();
41  return 0;
42 }
Definition: arc.h:39
int *CDECL _errno(void)
Definition: errno.c:19

◆ _get_invalid_parameter_handler()

_invalid_parameter_handler CDECL _get_invalid_parameter_handler ( void  )

Definition at line 151 of file errno.c.

152 {
153  TRACE("\n");
155 }
static _invalid_parameter_handler invalid_parameter_handler
Definition: errno.c:14
#define TRACE(s)
Definition: solgame.cpp:4

◆ _invalid_parameter()

void __cdecl _invalid_parameter ( const wchar_t expr,
const wchar_t func,
const wchar_t file,
unsigned int  line,
uintptr_t  arg 
)

Definition at line 137 of file errno.c.

139 {
141  else
142  {
143  ERR( "%s:%u %s: %s %lx\n", debugstr_w(file), line, debugstr_w(func), debugstr_w(expr), arg );
144 #if _MSVCR_VER > 0 // FIXME: possible improvement: use a global variable in the DLL
146 #endif
147  }
148 }
GLenum func
Definition: glext.h:6028
#define EXCEPTION_NONCONTINUABLE
Definition: rtltypes.h:150
Definition: query.h:86
static _invalid_parameter_handler invalid_parameter_handler
Definition: errno.c:14
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
#define ERR(fmt,...)
Definition: debug.h:109
VOID WINAPI RaiseException(IN DWORD dwExceptionCode, IN DWORD dwExceptionFlags, IN DWORD nNumberOfArguments, IN CONST ULONG_PTR *lpArguments OPTIONAL)
Definition: except.c:693
#define STATUS_INVALID_CRUNTIME_PARAMETER
Definition: ntstatus.h:945
Definition: fci.c:126

Referenced by _fsopen(), _tasctime_s(), localtime_s(), and rand_s().

◆ _set_doserrno()

errno_t CDECL _set_doserrno ( unsigned long  value)

Definition at line 68 of file errno.c.

69 {
70  *__doserrno() = value;
71  return 0;
72 }
GLsizei const GLfloat * value
Definition: glext.h:6069
unsigned long *CDECL __doserrno(void)
Definition: errno.c:27

Referenced by _dosmaperr().

◆ _set_errno()

errno_t CDECL _set_errno ( int  value)

Definition at line 59 of file errno.c.

60 {
61  *_errno() = value;
62  return 0;
63 }
int *CDECL _errno(void)
Definition: errno.c:19
GLsizei const GLfloat * value
Definition: glext.h:6069

Referenced by _dosmaperr().

◆ _set_error_mode()

int CDECL _set_error_mode ( int  mode)

Definition at line 117 of file errno.c.

118 {
119  const int old = msvcrt_error_mode;
120  if ( MSVCRT__REPORT_ERRMODE != mode ) {
122  }
123  return old;
124 }
#define MSVCRT__REPORT_ERRMODE
Definition: msvcrt.h:672
GLenum mode
Definition: glext.h:6217
int msvcrt_error_mode
Definition: errno.c:115

◆ _set_invalid_parameter_handler()

_invalid_parameter_handler CDECL _set_invalid_parameter_handler ( _invalid_parameter_handler  handler)

Definition at line 158 of file errno.c.

160 {
162 
163  TRACE("(%p)\n", handler);
164 
166  return old;
167 }
static _invalid_parameter_handler invalid_parameter_handler
Definition: errno.c:14
#define TRACE(s)
Definition: solgame.cpp:4
void(__cdecl * _invalid_parameter_handler)(const wchar_t *, const wchar_t *, const wchar_t *, unsigned int, uintptr_t)
Definition: stdlib.h:137
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7786

◆ _seterrormode()

void CDECL _seterrormode ( int  mode)

Definition at line 129 of file errno.c.

130 {
131  SetErrorMode( mode );
132 }
UINT WINAPI SetErrorMode(IN UINT uMode)
Definition: except.c:753
GLenum mode
Definition: glext.h:6217

Variable Documentation

◆ invalid_parameter_handler

_invalid_parameter_handler invalid_parameter_handler = NULL
static

◆ msvcrt_error_mode

int msvcrt_error_mode = MSVCRT__OUT_TO_DEFAULT

Definition at line 115 of file errno.c.

Referenced by _assert(), _set_error_mode(), and abort().