|
|
|
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 |
|
|
16 |
|
#include <crtdefs.h> |
17 |
|
|
18 |
|
#ifdef _MSC_VER |
19 |
|
#pragma pack(push,_CRT_PACKING) |
20 |
|
#endif /* _MSC_VER */ |
21 |
|
|
22 |
|
/* |
23 |
|
Previous versions of this header included declarations of functions used by RTC but |
24 |
|
not intended for use by end-users. These functions are now declared deprecated by default |
25 |
|
and may be removed in a future version. |
26 |
|
*/ |
27 |
|
#ifndef _CRT_ENABLE_RTC_INTERNALS |
28 |
|
#define _RTCINTERNAL_DEPRECATED _CRT_DEPRECATE_TEXT("These internal RTC functions are obsolete and should not be used") |
29 |
|
#else |
30 |
|
#define _RTCINTERNAL_DEPRECATED |
31 |
|
#endif |
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
#ifdef __cplusplus |
36 |
|
|
37 |
|
extern "C" { |
38 |
|
|
39 |
|
#endif |
40 |
|
|
41 |
|
/* General User API */ |
42 |
|
|
43 |
|
typedef enum _RTC_ErrorNumber { |
44 |
|
_RTC_CHKSTK = 0, |
45 |
|
_RTC_CVRT_LOSS_INFO, |
46 |
|
_RTC_CORRUPT_STACK, |
47 |
|
_RTC_UNINIT_LOCAL_USE, |
48 |
|
_RTC_CORRUPTED_ALLOCA, |
49 |
|
_RTC_ILLEGAL |
50 |
|
} _RTC_ErrorNumber; |
51 |
|
|
52 |
|
# define _RTC_ERRTYPE_IGNORE -1 |
53 |
|
# define _RTC_ERRTYPE_ASK -2 |
54 |
|
|
55 |
|
#ifndef _WCHAR_T_DEFINED |
56 |
|
typedef unsigned short wchar_t; |
57 |
|
#define _WCHAR_T_DEFINED |
58 |
|
#endif |
59 |
|
|
60 |
|
typedef int (__cdecl *_RTC_error_fn)(int, const char *, int, const char *, const char *, ...); |
61 |
|
typedef int (__cdecl *_RTC_error_fnW)(int, const wchar_t *, int, const wchar_t *, const wchar_t *, ...); |
62 |
|
|
63 |
|
/* User API */ |
64 |
|
int __cdecl _RTC_NumErrors(void); |
65 |
|
const char * __cdecl _RTC_GetErrDesc(_RTC_ErrorNumber _Errnum); |
66 |
|
int __cdecl _RTC_SetErrorType(_RTC_ErrorNumber _Errnum, int _ErrType); |
67 |
|
_RTC_error_fn __cdecl _RTC_SetErrorFunc(_RTC_error_fn); |
68 |
|
_RTC_error_fnW __cdecl _RTC_SetErrorFuncW(_RTC_error_fnW); |
69 |
|
|
70 |
|
/* Power User/library API */ |
71 |
|
|
72 |
|
|
73 |
|
/* Init functions */ |
74 |
|
|
75 |
|
/* These functions all call _CRT_RTC_INIT */ |
76 |
|
void __cdecl _RTC_Initialize(void); |
77 |
|
void __cdecl _RTC_Terminate(void); |
78 |
|
|
89 |
|
typedef struct _RTC_vardesc { |
90 |
|
int addr; |
91 |
|
int size; |
92 |
|
char *name; |
93 |
|
} _RTC_vardesc; |
94 |
|
|
95 |
|
typedef struct _RTC_framedesc { |
96 |
|
int varCount; |
97 |
|
_RTC_vardesc *variables; |
98 |
|
} _RTC_framedesc; |
99 |
|
|
100 |
|
/* NOTE: |
101 |
|
Changing this structure requires a matching compiler backend |
102 |
|
update, because the offsets are hardcoded inside there. |
103 |
|
*/ |
104 |
|
#pragma pack(push, 1) |
105 |
|
/* Structure padded under 32-bit x86, to get consistent |
106 |
|
execution between 32/64 targets. |
107 |
|
*/ |
108 |
|
typedef struct _RTC_ALLOCA_NODE { |
109 |
|
__int32 guard1; |
110 |
|
struct _RTC_ALLOCA_NODE *next; |
111 |
|
#if defined(_M_IX86) |
112 |
|
__int32 dummypad; |
113 |
|
#endif |
114 |
|
size_t allocaSize; |
115 |
|
#if defined(_M_IX86) |
116 |
|
__int32 dummypad2; |
117 |
|
#endif |
118 |
|
__int32 guard2[3]; |
119 |
|
} _RTC_ALLOCA_NODE; |
120 |
|
#pragma pack(pop) |
121 |
|
|
122 |
|
#if !defined(_M_CEE) && !defined(_M_CEE_PURE) |
123 |
|
/* These unsupported functions are deprecated in native mode and not supported at all in /clr mode */ |
124 |
|
|
125 |
|
/* Shortening convert checks - name indicates src bytes to target bytes */ |
126 |
|
/* Signedness is NOT checked */ |
127 |
|
_RTCINTERNAL_DEPRECATED char __fastcall _RTC_Check_2_to_1(short _Src); |
128 |
|
_RTCINTERNAL_DEPRECATED char __fastcall _RTC_Check_4_to_1(int _Src); |
129 |
|
_RTCINTERNAL_DEPRECATED char __fastcall _RTC_Check_8_to_1(__int64 _Src); |
130 |
|
_RTCINTERNAL_DEPRECATED short __fastcall _RTC_Check_4_to_2(int _Src); |
131 |
|
_RTCINTERNAL_DEPRECATED short __fastcall _RTC_Check_8_to_2(__int64 _Src); |
132 |
|
_RTCINTERNAL_DEPRECATED int __fastcall _RTC_Check_8_to_4(__int64 _Src); |
133 |
|
#endif |
134 |
|
|
135 |
|
|
136 |
|
/* Stack Checking Calls */ |
137 |
|
#if defined(_M_IX86) |
138 |
|
void __cdecl _RTC_CheckEsp(); |
139 |
|
#endif |
140 |
|
|
141 |
|
#if !defined(_M_CEE) && !defined(_M_CEE_PURE) |
142 |
|
/* These unsupported functions are deprecated in native mode and not supported at all in /clr mode */ |
143 |
|
|
144 |
|
_RTCINTERNAL_DEPRECATED void __fastcall _RTC_CheckStackVars(void *_Esp, _RTC_framedesc *_Fd); |
145 |
|
_RTCINTERNAL_DEPRECATED void __fastcall _RTC_CheckStackVars2(void *_Esp, _RTC_framedesc *_Fd, _RTC_ALLOCA_NODE *_AllocaList); |
146 |
|
_RTCINTERNAL_DEPRECATED void __fastcall _RTC_AllocaHelper(_RTC_ALLOCA_NODE *_PAllocaBase, size_t _CbSize, _RTC_ALLOCA_NODE **_PAllocaInfoList); |
147 |
|
#endif |
148 |
|
/* Unintialized Local call */ |
149 |
|
void __cdecl _RTC_UninitUse(const char *_Varname); |
150 |
|
|
151 |
|
#if !defined(_M_CEE) && !defined(_M_CEE_PURE) |
152 |
|
/* These unsupported functions are deprecated in native mode and not supported at all in /clr mode */ |
153 |
|
|
154 |
|
#endif |
155 |
|
|
156 |
|
/* Subsystem initialization stuff */ |
157 |
|
void __cdecl _RTC_Shutdown(void); |
158 |
|
void __cdecl _RTC_InitBase(void); |
159 |
|
|
160 |
|
|
161 |
|
#ifdef __cplusplus |
162 |
|
|
163 |
|
void* _ReturnAddress(); |
164 |
|
} |
165 |
|
|
166 |
|
#endif |
167 |
|
|
168 |
|
#ifdef _MSC_VER |
169 |
|
#pragma pack(pop) |
170 |
|
#endif /* _MSC_VER */ |
171 |
|
|
172 |
|
|
173 |
|
#endif /* _INC_RTCAPI */ |
174 |
|
|
|
|
|