Leaked source code of windows server 2003
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.

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