STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
rtcapi.h
Go to the documentation of this file.
1 /***
2 *rtcapi.h - declarations and definitions for RTC use
3 *
4 * Copyright (c) Microsoft Corporation. All rights reserved.
5 *
6 *Purpose:
7 * Contains the declarations and definitions for all RunTime Check
8 * support.
9 *
10 ****/
11 
12 #ifndef _INC_RTCAPI
13 #define _INC_RTCAPI
14 
15 #if defined(_RTC) || !defined(_CRTBLD)
16 
17 #include <crtdefs.h>
18 
19 #pragma pack(push,_CRT_PACKING)
20 
21 /*
22 Previous versions of this header included declarations of functions used by RTC but
23 not intended for use by end-users. These functions are now declared deprecated by default
24 and may be removed in a future version.
25 */
26 #ifndef _CRT_ENABLE_RTC_INTERNALS
27 #define _RTCINTERNAL_DEPRECATED _CRT_DEPRECATE_TEXT("These internal RTC functions are obsolete and should not be used")
28 #else /* _CRT_ENABLE_RTC_INTERNALS */
29 #define _RTCINTERNAL_DEPRECATED
30 #endif /* _CRT_ENABLE_RTC_INTERNALS */
31 
32 
33 
34 #ifdef __cplusplus
35 
36 extern "C" {
37 
38 #endif /* __cplusplus */
39 
40  /* General User API */
41 
42 typedef enum _RTC_ErrorNumber {
50 
51 # define _RTC_ERRTYPE_IGNORE -1
52 # define _RTC_ERRTYPE_ASK -2
53 
54 #ifndef _WCHAR_T_DEFINED
55 typedef unsigned short wchar_t;
56 #define _WCHAR_T_DEFINED
57 #endif /* _WCHAR_T_DEFINED */
58 
59  typedef int (__cdecl *_RTC_error_fn)(int, const char *, int, const char *, const char *, ...);
60  typedef int (__cdecl *_RTC_error_fnW)(int, const wchar_t *, int, const wchar_t *, const wchar_t *, ...);
61 
62  /* User API */
63  int __cdecl _RTC_NumErrors(void);
64  const char * __cdecl _RTC_GetErrDesc(_RTC_ErrorNumber _Errnum);
65  int __cdecl _RTC_SetErrorType(_RTC_ErrorNumber _Errnum, int _ErrType);
68 
69  /* Power User/library API */
70 
71 
72  /* Init functions */
73 
74  /* These functions all call _CRT_RTC_INIT */
75  void __cdecl _RTC_Initialize(void);
76  void __cdecl _RTC_Terminate(void);
77 
78  /*
79  * If you're not using the CRT, you have to implement _CRT_RTC_INIT
80  * Just return either null, or your error reporting function
81  * *** Don't mess with res0/res1/res2/res3/res4 - YOU'VE BEEN WARNED! ***
82  */
83  _RTC_error_fn __cdecl _CRT_RTC_INIT(void *_Res0, void **_Res1, int _Res2, int _Res3, int _Res4);
84  _RTC_error_fnW __cdecl _CRT_RTC_INITW(void *_Res0, void **_Res1, int _Res2, int _Res3, int _Res4);
85 
86  /* Compiler generated calls (unlikely to be used, even by power users) */
87  /* Types */
88  typedef struct _RTC_vardesc {
89  int addr;
90  int size;
91  char *name;
92  } _RTC_vardesc;
93 
94  typedef struct _RTC_framedesc {
95  int varCount;
98 
99  /* NOTE:
100  Changing this structure requires a matching compiler backend
101  update, because the offsets are hardcoded inside there.
102  */
103 #pragma pack(push, 1)
104  /* Structure padded under 32-bit x86, to get consistent
105  execution between 32/64 targets.
106  */
107  typedef struct _RTC_ALLOCA_NODE {
108  __int32 guard1;
110 #if defined (_M_IX86) || defined (_M_ARM)
111  __int32 dummypad;
112 #endif /* defined (_M_IX86) || defined (_M_ARM) */
113  size_t allocaSize;
114 #if defined (_M_IX86) || defined (_M_ARM)
115  __int32 dummypad2;
116 #endif /* defined (_M_IX86) || defined (_M_ARM) */
117  __int32 guard2[3];
119 #pragma pack(pop)
120 
121 #if !defined (_M_CEE) && !defined (_M_CEE_PURE)
122  /* These unsupported functions are deprecated in native mode and not supported at all in /clr mode */
123 
124  /* Shortening convert checks - name indicates src bytes to target bytes */
125  /* Signedness is NOT checked */
126  _RTCINTERNAL_DEPRECATED char __fastcall _RTC_Check_2_to_1(short _Src);
127  _RTCINTERNAL_DEPRECATED char __fastcall _RTC_Check_4_to_1(int _Src);
128  _RTCINTERNAL_DEPRECATED char __fastcall _RTC_Check_8_to_1(__int64 _Src);
129  _RTCINTERNAL_DEPRECATED short __fastcall _RTC_Check_4_to_2(int _Src);
130  _RTCINTERNAL_DEPRECATED short __fastcall _RTC_Check_8_to_2(__int64 _Src);
131  _RTCINTERNAL_DEPRECATED int __fastcall _RTC_Check_8_to_4(__int64 _Src);
132 #endif /* !defined (_M_CEE) && !defined (_M_CEE_PURE) */
133 
134 
135  /* Stack Checking Calls */
136 #if defined (_M_IX86)
137  void __cdecl _RTC_CheckEsp();
138 #endif /* defined (_M_IX86) */
139 
140 #if !defined (_M_CEE) && !defined (_M_CEE_PURE)
141  /* These unsupported functions are deprecated in native mode and not supported at all in /clr mode */
142 
143  _RTCINTERNAL_DEPRECATED void __fastcall _RTC_CheckStackVars(void *_Esp, _RTC_framedesc *_Fd);
144  _RTCINTERNAL_DEPRECATED void __fastcall _RTC_CheckStackVars2(void *_Esp, _RTC_framedesc *_Fd, _RTC_ALLOCA_NODE *_AllocaList);
145  _RTCINTERNAL_DEPRECATED void __fastcall _RTC_AllocaHelper(_RTC_ALLOCA_NODE *_PAllocaBase, size_t _CbSize, _RTC_ALLOCA_NODE **_PAllocaInfoList);
146 #endif /* !defined (_M_CEE) && !defined (_M_CEE_PURE) */
147  /* Unintialized Local call */
148  void __cdecl _RTC_UninitUse(const char *_Varname);
149 
150 #if !defined (_M_CEE) && !defined (_M_CEE_PURE)
151  /* These unsupported functions are deprecated in native mode and not supported at all in /clr mode */
152 
153 #endif /* !defined (_M_CEE) && !defined (_M_CEE_PURE) */
154 
155  /* Subsystem initialization stuff */
156  void __cdecl _RTC_Shutdown(void);
157  void __cdecl _RTC_InitBase(void);
158 
159 
160 #ifdef __cplusplus
161 
162  void* _ReturnAddress();
163 }
164 
165 #endif /* __cplusplus */
166 
167 #pragma pack(pop)
168 
169 #endif /* defined(_RTC) || !defined(_CRTBLD) */
170 
171 #endif /* _INC_RTCAPI */
struct _RTC_vardesc _RTC_vardesc
int __cdecl _RTC_SetErrorType(_RTC_ErrorNumber _Errnum, int _ErrType)
_RTCINTERNAL_DEPRECATED short __fastcall _RTC_Check_4_to_2(int _Src)
Definition: rtcapi.h:107
_RTC_error_fn __cdecl _RTC_SetErrorFunc(_RTC_error_fn)
void __cdecl _RTC_UninitUse(const char *_Varname)
int size
Definition: rtcapi.h:90
struct _RTC_framedesc _RTC_framedesc
_RTCINTERNAL_DEPRECATED int __fastcall _RTC_Check_8_to_4(__int64 _Src)
__int32 guard2[3]
Definition: rtcapi.h:117
_CRTIMP _In_opt_z_ const wchar_t _In_opt_z_ const wchar_t unsigned int
Definition: crtdefs.h:642
int varCount
Definition: rtcapi.h:95
void __cdecl _RTC_Shutdown(void)
#define _RTCINTERNAL_DEPRECATED
Definition: rtcapi.h:27
Definition: rtcapi.h:47
size_t allocaSize
Definition: rtcapi.h:113
_RTC_ErrorNumber
Definition: rtcapi.h:42
struct _RTC_ALLOCA_NODE _RTC_ALLOCA_NODE
_RTCINTERNAL_DEPRECATED void __fastcall _RTC_AllocaHelper(_RTC_ALLOCA_NODE *_PAllocaBase, size_t _CbSize, _RTC_ALLOCA_NODE **_PAllocaInfoList)
int(__cdecl * _RTC_error_fn)(int, const char *, int, const char *, const char *,...)
Definition: rtcapi.h:59
_RTC_error_fnW __cdecl _RTC_SetErrorFuncW(_RTC_error_fnW)
_RTCINTERNAL_DEPRECATED char __fastcall _RTC_Check_8_to_1(__int64 _Src)
Definition: rtcapi.h:46
Definition: rtcapi.h:44
Definition: rtcapi.h:43
_RTCINTERNAL_DEPRECATED short __fastcall _RTC_Check_8_to_2(__int64 _Src)
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
unsigned short wchar_t
Definition: crtdefs.h:536
_RTCINTERNAL_DEPRECATED void __fastcall _RTC_CheckStackVars(void *_Esp, _RTC_framedesc *_Fd)
Definition: rtcapi.h:94
void __cdecl _RTC_Initialize(void)
_RTCINTERNAL_DEPRECATED char __fastcall _RTC_Check_4_to_1(int _Src)
int __cdecl _RTC_NumErrors(void)
Definition: rtcapi.h:45
void __cdecl _RTC_InitBase(void)
Definition: rtcapi.h:48
int addr
Definition: rtcapi.h:89
char * name
Definition: rtcapi.h:91
__int32 guard1
Definition: rtcapi.h:108
_RTC_vardesc * variables
Definition: rtcapi.h:96
_RTC_error_fn __cdecl _CRT_RTC_INIT(void *_Res0, void **_Res1, int _Res2, int _Res3, int _Res4)
Definition: rtcapi.h:88
int(__cdecl * _RTC_error_fnW)(int, const wchar_t *, int, const wchar_t *, const wchar_t *,...)
Definition: rtcapi.h:60
void __cdecl _RTC_Terminate(void)
_RTCINTERNAL_DEPRECATED void __fastcall _RTC_CheckStackVars2(void *_Esp, _RTC_framedesc *_Fd, _RTC_ALLOCA_NODE *_AllocaList)
struct _RTC_ALLOCA_NODE * next
Definition: rtcapi.h:109
const char *__cdecl _RTC_GetErrDesc(_RTC_ErrorNumber _Errnum)
_RTCINTERNAL_DEPRECATED char __fastcall _RTC_Check_2_to_1(short _Src)
_RTC_error_fnW __cdecl _CRT_RTC_INITW(void *_Res0, void **_Res1, int _Res2, int _Res3, int _Res4)