ReactOS  0.4.13-dev-66-gc714b7f
rtcapi.h File Reference
#include <crtdefs.h>
Include dependency graph for rtcapi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _RTC_vardesc
 
struct  _RTC_framedesc
 
struct  _RTC_ALLOCA_NODE
 

Macros

#define _RTCINTERNAL_DEPRECATED
 
#define _RTC_ERRTYPE_IGNORE   -1
 
#define _RTC_ERRTYPE_ASK   -2
 

Typedefs

typedef enum _RTC_ErrorNumber _RTC_ErrorNumber
 
typedef int(__cdecl_RTC_error_fn) (int, const char *, int, const char *, const char *,...)
 
typedef int(__cdecl_RTC_error_fnW) (int, const wchar_t *, int, const wchar_t *, const wchar_t *,...)
 
typedef struct _RTC_vardesc _RTC_vardesc
 
typedef struct _RTC_framedesc _RTC_framedesc
 
typedef struct _RTC_ALLOCA_NODE _RTC_ALLOCA_NODE
 

Enumerations

enum  _RTC_ErrorNumber {
  _RTC_CHKSTK = 0, _RTC_CVRT_LOSS_INFO, _RTC_CORRUPT_STACK, _RTC_UNINIT_LOCAL_USE,
  _RTC_CORRUPTED_ALLOCA, _RTC_ILLEGAL
}
 

Functions

int __cdecl _RTC_NumErrors (void)
 
const char *__cdecl _RTC_GetErrDesc (_RTC_ErrorNumber _Errnum)
 
int __cdecl _RTC_SetErrorType (_RTC_ErrorNumber _Errnum, int _ErrType)
 
_RTC_error_fn __cdecl _RTC_SetErrorFunc (_RTC_error_fn)
 
_RTC_error_fnW __cdecl _RTC_SetErrorFuncW (_RTC_error_fnW)
 
void __cdecl _RTC_Initialize (void)
 
void __cdecl _RTC_Terminate (void)
 
_RTC_error_fn __cdecl _CRT_RTC_INIT (void *_Res0, void **_Res1, int _Res2, int _Res3, int _Res4)
 
_RTC_error_fnW __cdecl _CRT_RTC_INITW (void *_Res0, void **_Res1, int _Res2, int _Res3, int _Res4)
 
char __fastcall _RTC_Check_2_to_1 (short _Src)
 
char __fastcall _RTC_Check_4_to_1 (int _Src)
 
__MINGW_EXTENSION char __fastcall _RTC_Check_8_to_1 (__int64 _Src)
 
short __fastcall _RTC_Check_4_to_2 (int _Src)
 
__MINGW_EXTENSION short __fastcall _RTC_Check_8_to_2 (__int64 _Src)
 
__MINGW_EXTENSION int __fastcall _RTC_Check_8_to_4 (__int64 _Src)
 
void __fastcall _RTC_CheckStackVars (void *_Esp, _RTC_framedesc *_Fd)
 
void __fastcall _RTC_CheckStackVars2 (void *_Esp, _RTC_framedesc *_Fd, _RTC_ALLOCA_NODE *_AllocaList)
 
void __fastcall _RTC_AllocaHelper (_RTC_ALLOCA_NODE *_PAllocaBase, size_t _CbSize, _RTC_ALLOCA_NODE **_PAllocaInfoList)
 
void __cdecl _RTC_UninitUse (const char *_Varname)
 
void __cdecl _RTC_Shutdown (void)
 
void __cdecl _RTC_InitBase (void)
 

Macro Definition Documentation

◆ _RTC_ERRTYPE_ASK

#define _RTC_ERRTYPE_ASK   -2

Definition at line 24 of file rtcapi.h.

◆ _RTC_ERRTYPE_IGNORE

#define _RTC_ERRTYPE_IGNORE   -1

Definition at line 23 of file rtcapi.h.

◆ _RTCINTERNAL_DEPRECATED

#define _RTCINTERNAL_DEPRECATED

This file has no copyright assigned and is placed in the Public Domain. This file is part of the w64 mingw-runtime package. No warranty is given; refer to the file DISCLAIMER within this package.

Definition at line 13 of file rtcapi.h.

Typedef Documentation

◆ _RTC_ALLOCA_NODE

◆ _RTC_error_fn

typedef int(__cdecl * _RTC_error_fn) (int, const char *, int, const char *, const char *,...)

Definition at line 26 of file rtcapi.h.

◆ _RTC_error_fnW

typedef int(__cdecl * _RTC_error_fnW) (int, const wchar_t *, int, const wchar_t *, const wchar_t *,...)

Definition at line 27 of file rtcapi.h.

◆ _RTC_ErrorNumber

◆ _RTC_framedesc

◆ _RTC_vardesc

Enumeration Type Documentation

◆ _RTC_ErrorNumber

Enumerator
_RTC_CHKSTK 
_RTC_CVRT_LOSS_INFO 
_RTC_CORRUPT_STACK 
_RTC_UNINIT_LOCAL_USE 
_RTC_CORRUPTED_ALLOCA 
_RTC_ILLEGAL 

Definition at line 19 of file rtcapi.h.

Function Documentation

◆ _CRT_RTC_INIT()

_RTC_error_fn __cdecl _CRT_RTC_INIT ( void _Res0,
void **  _Res1,
int  _Res2,
int  _Res3,
int  _Res4 
)

◆ _CRT_RTC_INITW()

_RTC_error_fnW __cdecl _CRT_RTC_INITW ( void _Res0,
void **  _Res1,
int  _Res2,
int  _Res3,
int  _Res4 
)

Definition at line 65 of file mscmain.c.

71 {
72  return &Catch_RTC_Failure;
73 }
int __cdecl Catch_RTC_Failure(int errType, const wchar_t *file, int line, const wchar_t *module, const wchar_t *format,...)
Definition: mscmain.c:42

Referenced by _RTC_InitBase().

◆ _RTC_AllocaHelper()

void __fastcall _RTC_AllocaHelper ( _RTC_ALLOCA_NODE _PAllocaBase,
size_t  _CbSize,
_RTC_ALLOCA_NODE **  _PAllocaInfoList 
)

Definition at line 175 of file rtcapi.c.

179 {
180  unsigned long i;
181 
182  /* Check if we got any allocation */
183  if ((_PAllocaBase != 0) &&
184  (_CbSize != 0) &&
185  (_PAllocaInfoList != 0))
186  {
187  /* Mark the whole range */
188  char *guard = (char*)_PAllocaBase;
189  for (i = 0; i < _CbSize; i++)
190  {
191  guard[i] = 0xCC;
192  }
193 
194  /* Initialize the alloca base frame */
195  _PAllocaBase->allocaSize = _CbSize;
196 
197  /* Insert this frame into the alloca list */
198  _PAllocaBase->next = *_PAllocaInfoList;
199  *_PAllocaInfoList = _PAllocaBase;
200  }
201 }
size_t allocaSize
Definition: rtcapi.h:58
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
struct _RTC_ALLOCA_NODE * next
Definition: rtcapi.h:54

◆ _RTC_Check_2_to_1()

char __fastcall _RTC_Check_2_to_1 ( short  _Src)

◆ _RTC_Check_4_to_1()

char __fastcall _RTC_Check_4_to_1 ( int  _Src)

◆ _RTC_Check_4_to_2()

short __fastcall _RTC_Check_4_to_2 ( int  _Src)

◆ _RTC_Check_8_to_1()

__MINGW_EXTENSION char __fastcall _RTC_Check_8_to_1 ( __int64  _Src)

◆ _RTC_Check_8_to_2()

__MINGW_EXTENSION short __fastcall _RTC_Check_8_to_2 ( __int64  _Src)

◆ _RTC_Check_8_to_4()

__MINGW_EXTENSION int __fastcall _RTC_Check_8_to_4 ( __int64  _Src)

◆ _RTC_CheckStackVars()

void __fastcall _RTC_CheckStackVars ( void _Esp,
_RTC_framedesc _Fd 
)

Definition at line 112 of file rtcapi.c.

115 {
116  int i, *guard1, *guard2;
117 
118  /* Loop all variables in the descriptor */
119  for (i = 0; i < _Fd->varCount; i++)
120  {
121  /* Get the 2 guards below and above the variable */
122  guard1 = (int*)((char*)_Esp + _Fd->variables[i].addr - sizeof(*guard1));
123  guard2 = (int*)((char*)_Esp + _Fd->variables[i].addr +_Fd->variables[i].size);
124 
125  /* Check if they contain the guard bytes */
126  if ((*guard1 != 0xCCCCCCCC) || (*guard2 != 0xCCCCCCCC))
127  {
129  L"unknown file",
130  -1,
131  L"unknown module",
132  L"Stack corruption near '%s'\n",
133  _Fd->variables[i].name);
134  }
135  }
136 }
int size
Definition: rtcapi.h:41
_RTC_error_fnW _RTC_pErrorFuncW
Definition: rtcapi.c:33
int varCount
Definition: rtcapi.h:46
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
int addr
Definition: rtcapi.h:40
char * name
Definition: rtcapi.h:42
static const WCHAR L[]
Definition: oid.c:1250
_RTC_vardesc * variables
Definition: rtcapi.h:47

Referenced by _RTC_CheckStackVars2().

◆ _RTC_CheckStackVars2()

void __fastcall _RTC_CheckStackVars2 ( void _Esp,
_RTC_framedesc _Fd,
_RTC_ALLOCA_NODE _AllocaList 
)

Definition at line 140 of file rtcapi.c.

144 {
146  int *guard;
147 
148  /* Process normal variables */
149  _RTC_CheckStackVars(_Esp, _Fd);
150 
151  /* Process the alloca list */
152  for (current = _AllocaList; current != 0; current = current->next)
153  {
154  /* Get the upper guard */
155  guard = (int*)((char*)current + current->allocaSize - sizeof(*guard));
156 
157  /* Check if all guard locations are still ok */
158  if ((current->guard1 != 0xCCCCCCCC) ||
159  (current->guard2[0] != 0xCCCCCCCC) ||
160  (current->guard2[1] != 0xCCCCCCCC) ||
161  (current->guard2[2] != 0xCCCCCCCC) ||
162  (*guard != 0xCCCCCCCC))
163  {
165  L"unknown file",
166  -1,
167  L"unknown module",
168  L"Stack corruption in alloca frame\n");
169  }
170  }
171 }
_RTC_error_fnW _RTC_pErrorFuncW
Definition: rtcapi.c:33
void __fastcall _RTC_CheckStackVars(void *_Esp, _RTC_framedesc *_Fd)
Definition: rtcapi.c:112
static const WCHAR L[]
Definition: oid.c:1250
struct task_struct * current
Definition: linux.c:32

◆ _RTC_GetErrDesc()

const char* __cdecl _RTC_GetErrDesc ( _RTC_ErrorNumber  _Errnum)

Definition at line 44 of file rtcuserapi.c.

46 {
47  if (_Errnum < (sizeof(_RTC_ErrorDescription) / sizeof(_RTC_ErrorDescription[0])))
48  {
49  return _RTC_ErrorDescription[_Errnum];
50  }
51 
52  return "Invalid/Unknown error.";
53 }
static char * _RTC_ErrorDescription[]
Definition: rtcuserapi.c:24

◆ _RTC_InitBase()

void __cdecl _RTC_InitBase ( void  )

Definition at line 52 of file rtcapi.c.

53 {
54  static char initialized = 0;
55  _RTC_error_fnW errorFunc;
56 
57  if (!initialized)
58  {
59  errorFunc = _CRT_RTC_INITW(0, 0, 0, 1, 0);
60  _RTC_SetErrorFuncW(errorFunc);
61  initialized = 1;
62  }
63 }
_RTC_error_fnW __cdecl _RTC_SetErrorFuncW(_RTC_error_fnW)
Definition: rtcuserapi.c:78
static BOOL initialized
Definition: syslog.c:39
int(__cdecl * _RTC_error_fnW)(int, const wchar_t *, int, const wchar_t *, const wchar_t *,...)
Definition: rtcapi.h:27
_RTC_error_fnW __cdecl _CRT_RTC_INITW(void *_Res0, void **_Res1, int _Res2, int _Res3, int _Res4)
Definition: mscmain.c:65

Referenced by _RTC_Initialize().

◆ _RTC_Initialize()

void __cdecl _RTC_Initialize ( void  )

Definition at line 74 of file rtcapi.c.

75 {
76  /* Usually this function would walk an array of function pointers and call
77  each of these, like done with global ctors, but since these are currently
78  only _RTC_InitBase, we simply call that function once. */
79  _RTC_InitBase();
80 }
void __cdecl _RTC_InitBase(void)
Definition: rtcapi.c:52

Referenced by __main().

◆ _RTC_NumErrors()

int __cdecl _RTC_NumErrors ( void  )

Definition at line 35 of file rtcuserapi.c.

36 {
37  /* Not supported yet */
38  __debugbreak();
39  return 0;
40 }
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698

◆ _RTC_SetErrorFunc()

_RTC_error_fn __cdecl _RTC_SetErrorFunc ( _RTC_error_fn  )

Definition at line 68 of file rtcuserapi.c.

70 {
71  /* Not supported yet */
72  __debugbreak();
73  return 0;
74 }
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698

◆ _RTC_SetErrorFuncW()

_RTC_error_fnW __cdecl _RTC_SetErrorFuncW ( _RTC_error_fnW  )

Definition at line 78 of file rtcuserapi.c.

79 {
80  _RTC_error_fnW old_fn;
81 
82  /* Get the current error func */
83  old_fn = _RTC_pErrorFuncW;
84 
85  /* Set the new function or reset when 0 was passed */
86  _RTC_pErrorFuncW = new_fn ? new_fn : _RTC_DefaultErrorFuncW;
87 
88  /* Return the old error func, or 0, if none was set */
89  return old_fn != _RTC_DefaultErrorFuncW ? old_fn : 0;
90 }
_RTC_error_fnW _RTC_pErrorFuncW
Definition: rtcapi.c:33
int(__cdecl * _RTC_error_fnW)(int, const wchar_t *, int, const wchar_t *, const wchar_t *,...)
Definition: rtcapi.h:27
int __cdecl _RTC_DefaultErrorFuncW(int errType, const wchar_t *file, int line, const wchar_t *module, const wchar_t *format,...)
Definition: rtcapi.c:20

Referenced by _RTC_InitBase().

◆ _RTC_SetErrorType()

int __cdecl _RTC_SetErrorType ( _RTC_ErrorNumber  _Errnum,
int  _ErrType 
)

Definition at line 57 of file rtcuserapi.c.

60 {
61  /* Not supported yet */
62  __debugbreak();
63  return 0;
64 }
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698

◆ _RTC_Shutdown()

void __cdecl _RTC_Shutdown ( void  )

Definition at line 67 of file rtcapi.c.

68 {
69  __debugbreak();
70 }
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698

◆ _RTC_Terminate()

void __cdecl _RTC_Terminate ( void  )

◆ _RTC_UninitUse()

void __cdecl _RTC_UninitUse ( const char _Varname)

Definition at line 99 of file rtcapi.c.

101 {
103  L"unknown file",
104  -1,
105  L"unknown module",
106  L"Use of uninitialized variable %S!\n",
107  _Varname);
108 }
_RTC_error_fnW _RTC_pErrorFuncW
Definition: rtcapi.c:33
static const WCHAR L[]
Definition: oid.c:1250