Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

188 lines
6.3 KiB

  1. /***
  2. *rtcapi.h - declarations and definitions for RTC use
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Contains the declarations and definitions for all RunTime Check
  8. * support.
  9. *
  10. *Revision History:
  11. * ??-??-?? KBF Created public header for RTC
  12. * 05-11-99 KBF Wrap RTC support in #ifdef.
  13. * 05-26-99 KBF Removed RTCl & RTCv, added _RTC_ADVMEM stuff
  14. *
  15. ****/
  16. #ifndef _INC_RTCAPI
  17. #define _INC_RTCAPI
  18. #ifdef _RTC
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. // General User API
  23. typedef enum _RTC_ErrorNumber {
  24. _RTC_CHKSTK = 0,
  25. _RTC_CVRT_LOSS_INFO,
  26. _RTC_CORRUPT_STACK,
  27. _RTC_UNINIT_LOCAL_USE,
  28. #ifdef _RTC_ADVMEM
  29. _RTC_INVALID_MEM,
  30. _RTC_DIFF_MEM_BLOCK,
  31. #endif
  32. _RTC_ILLEGAL
  33. } _RTC_ErrorNumber;
  34. # define _RTC_ERRTYPE_IGNORE -1
  35. # define _RTC_ERRTYPE_ASK -2
  36. typedef int (__cdecl *_RTC_error_fn)(int, const char *, int, const char *, const char *, ...);
  37. // User API
  38. int __cdecl _RTC_NumErrors(void);
  39. const char * __cdecl _RTC_GetErrDesc(_RTC_ErrorNumber errnum);
  40. int __cdecl _RTC_SetErrorType(_RTC_ErrorNumber errnum, int ErrType);
  41. _RTC_error_fn __cdecl _RTC_SetErrorFunc(_RTC_error_fn);
  42. #ifdef _RTC_ADVMEM
  43. void __cdecl _RTC_SetOutOfMemFunc(int (*func)(void));
  44. #endif
  45. // Power User/library API
  46. #ifdef _RTC_ADVMEM
  47. void __cdecl _RTC_Allocate(void *addr, unsigned size, short level);
  48. void __cdecl _RTC_Free(void *mem, short level);
  49. #endif
  50. /* Init functions */
  51. // These functions all call _CRT_RTC_INIT
  52. void __cdecl _RTC_Initialize(void);
  53. void __cdecl _RTC_Terminate(void);
  54. // If you're not using the CRT, you have to implement _CRT_RTC_INIT
  55. // Just return either null, or your error reporting function
  56. // *** Don't mess with res0/res1/res2/res3/res4 - YOU'VE BEEN WARNED! ***
  57. _RTC_error_fn _CRT_RTC_INIT(void *res0, void **res1, int res2, int res3, int res4);
  58. // Compiler generated calls (unlikely to be used, even by power users...)
  59. /* Types */
  60. typedef struct _RTC_vardesc {
  61. int addr;
  62. int size;
  63. char *name;
  64. } _RTC_vardesc;
  65. typedef struct _RTC_framedesc {
  66. int varCount;
  67. _RTC_vardesc *variables;
  68. } _RTC_framedesc;
  69. /* Shortening convert checks - name indicates src bytes to target bytes */
  70. /* Signedness is NOT checked */
  71. char __fastcall _RTC_Check_2_to_1(short src);
  72. char __fastcall _RTC_Check_4_to_1(int src);
  73. char __fastcall _RTC_Check_8_to_1(__int64 src);
  74. short __fastcall _RTC_Check_4_to_2(int src);
  75. short __fastcall _RTC_Check_8_to_2(__int64 src);
  76. int __fastcall _RTC_Check_8_to_4(__int64 src);
  77. #ifdef _RTC_ADVMEM
  78. // A memptr is a user pointer
  79. typedef signed int memptr;
  80. // A memref refers to a user pointer (ptr to ptr)
  81. typedef memptr *memref;
  82. // memvals are the contents of a memptr
  83. // thus, they have sizes
  84. typedef char memval1;
  85. typedef short memval2;
  86. typedef int memval4;
  87. typedef __int64 memval8;
  88. #endif
  89. /* Stack Checking Calls */
  90. void __cdecl _RTC_CheckEsp();
  91. void __fastcall _RTC_CheckStackVars(void *esp, _RTC_framedesc *fd);
  92. #ifdef _RTC_ADVMEM
  93. void __fastcall _RTC_MSAllocateFrame(memptr frame, _RTC_framedesc *v);
  94. void __fastcall _RTC_MSFreeFrame(memptr frame, _RTC_framedesc *v);
  95. #endif
  96. /* Unintialized Local call */
  97. void __cdecl _RTC_UninitUse(const char *varname);
  98. #ifdef _RTC_ADVMEM
  99. /* Memory checks */
  100. void __fastcall _RTC_MSPtrAssignAdd(memref dst, memref base, int offset);
  101. void __fastcall _RTC_MSAddrAssignAdd(memref dst, memptr base, int offset);
  102. void __fastcall _RTC_MSPtrAssign(memref dst, memref src);
  103. memptr __fastcall _RTC_MSPtrAssignR0(memref src);
  104. memptr __fastcall _RTC_MSPtrAssignR0Add(memref src, int offset);
  105. void __fastcall _RTC_MSR0AssignPtr(memref dst, memptr src);
  106. void __fastcall _RTC_MSR0AssignPtrAdd(memref dst, memptr src, int offset);
  107. memptr __fastcall _RTC_MSPtrPushAdd(memref dst, memref base, int offset);
  108. memptr __fastcall _RTC_MSAddrPushAdd(memref dst, memptr base, int offset);
  109. memptr __fastcall _RTC_MSPtrPush(memref dst, memref src);
  110. memval1 __fastcall _RTC_MSPtrMemReadAdd1(memref base, int offset);
  111. memval2 __fastcall _RTC_MSPtrMemReadAdd2(memref base, int offset);
  112. memval4 __fastcall _RTC_MSPtrMemReadAdd4(memref base, int offset);
  113. memval8 __fastcall _RTC_MSPtrMemReadAdd8(memref base, int offset);
  114. memval1 __fastcall _RTC_MSMemReadAdd1(memptr base, int offset);
  115. memval2 __fastcall _RTC_MSMemReadAdd2(memptr base, int offset);
  116. memval4 __fastcall _RTC_MSMemReadAdd4(memptr base, int offset);
  117. memval8 __fastcall _RTC_MSMemReadAdd8(memptr base, int offset);
  118. memval1 __fastcall _RTC_MSPtrMemRead1(memref base);
  119. memval2 __fastcall _RTC_MSPtrMemRead2(memref base);
  120. memval4 __fastcall _RTC_MSPtrMemRead4(memref base);
  121. memval8 __fastcall _RTC_MSPtrMemRead8(memref base);
  122. memptr __fastcall _RTC_MSPtrMemCheckAdd1(memref base, int offset);
  123. memptr __fastcall _RTC_MSPtrMemCheckAdd2(memref base, int offset);
  124. memptr __fastcall _RTC_MSPtrMemCheckAdd4(memref base, int offset);
  125. memptr __fastcall _RTC_MSPtrMemCheckAdd8(memref base, int offset);
  126. memptr __fastcall _RTC_MSPtrMemCheckAddN(memref base, int offset, unsigned size);
  127. memptr __fastcall _RTC_MSMemCheckAdd1(memptr base, int offset);
  128. memptr __fastcall _RTC_MSMemCheckAdd2(memptr base, int offset);
  129. memptr __fastcall _RTC_MSMemCheckAdd4(memptr base, int offset);
  130. memptr __fastcall _RTC_MSMemCheckAdd8(memptr base, int offset);
  131. memptr __fastcall _RTC_MSMemCheckAddN(memptr base, int offset, unsigned size);
  132. memptr __fastcall _RTC_MSPtrMemCheck1(memref base);
  133. memptr __fastcall _RTC_MSPtrMemCheck2(memref base);
  134. memptr __fastcall _RTC_MSPtrMemCheck4(memref base);
  135. memptr __fastcall _RTC_MSPtrMemCheck8(memref base);
  136. memptr __fastcall _RTC_MSPtrMemCheckN(memref base, unsigned size);
  137. #endif
  138. /* Subsystem initialization stuff */
  139. void __cdecl _RTC_Shutdown(void);
  140. #ifdef _RTC_ADVMEM
  141. void __cdecl _RTC_InitAdvMem(void);
  142. #endif
  143. void __cdecl _RTC_InitBase(void);
  144. #ifdef __cplusplus
  145. void* _ReturnAddress();
  146. }
  147. #endif
  148. #endif
  149. #endif // _INC_RTCAPI