ReactOS 0.4.15-dev-7670-g69b08be
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}
#define EINVAL
Definition: acclib.h:90
unsigned long winerr
Definition: doserrmap.h:7
struct @4310 doserrmap[]
int en
Definition: doserrmap.h:8
errno_t CDECL _set_doserrno(unsigned long value)
Definition: errno.c:68
errno_t CDECL _set_errno(int value)
Definition: errno.c:59

Referenced by _access(), _beginthreadex(), _chdrive(), _chmod(), _chsize_s(), _close(), _commit(), _cwait(), _dup2(), _findclose(), _fstat64(), _futime(), _lseeki64(), _open_osfhandle(), _pclose(), _pipe(), _tchdir(), _tfindfirst(), _tfindnext(), _tfullpath(), _tgetcwd(), _tmkdir(), _trmdir(), _tsearchenv_s(), _unlink(), _waccess(), _wchmod(), _wfreopen(), _wremove(), _wrename(), _write(), _wsopen_s(), _wsystem(), _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}
PWCHAR pValue
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}
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}
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
VOID WINAPI RaiseException(_In_ DWORD dwExceptionCode, _In_ DWORD dwExceptionFlags, _In_ DWORD nNumberOfArguments, _In_opt_ const ULONG_PTR *lpArguments)
Definition: except.c:700
GLenum func
Definition: glext.h:6028
#define debugstr_w
Definition: kernel32.h:32
#define STATUS_INVALID_CRUNTIME_PARAMETER
Definition: ntstatus.h:959
Definition: query.h:87
Definition: fci.c:127
Definition: parser.c:49
#define EXCEPTION_NONCONTINUABLE
Definition: stubs.h:23

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}
Definition: pdh_main.c:94

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}

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}
GLenum mode
Definition: glext.h:6217
#define MSVCRT__REPORT_ERRMODE
Definition: msvcrt.h:672
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}
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7482
void(__cdecl * _invalid_parameter_handler)(const wchar_t *, const wchar_t *, const wchar_t *, unsigned int, uintptr_t)
Definition: stdlib.h:125

◆ _seterrormode()

void CDECL _seterrormode ( int  mode)

Definition at line 129 of file errno.c.

130{
132}
UINT WINAPI SetErrorMode(IN UINT uMode)
Definition: except.c:751

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().