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.

81 lines
2.4 KiB

  1. /***
  2. *rtcsup.h - declarations and definitions for RTC support (import lib support)
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Contains the function declarations for all 'hook' function used from
  8. * within an external library to support RTC checks.
  9. *
  10. *Revision History:
  11. * 05-01-98 KBF Creation
  12. * 11-24-98 KBF Added new hook functions
  13. * 12-03-98 KBF Added the FuncCheckSet function
  14. * 05-11-99 KBF Wrap RTC support in #ifdef.
  15. * 05-17-99 PML Remove all Macintosh support.
  16. * 05-26-99 KBF Removed RTCl and RTCv, added _RTC_ADVMEM stuff
  17. *
  18. ****/
  19. #if _MSC_VER > 1000 /*IFSTRIP=IGN*/
  20. #pragma once
  21. #endif
  22. #ifndef _INC_RTCSUP
  23. #define _INC_RTCSUP
  24. #ifdef _RTC
  25. #if !defined(_WIN32)
  26. #error ERROR: Only Win32 target supported!
  27. #endif
  28. #include <rtcapi.h>
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. #ifdef _RTC_ADVMEM
  33. #ifndef _MT
  34. # define RTCCALLBACK(func, parms) if (func) func parms;
  35. #else
  36. # define RTCCALLBACK(func, parms) \
  37. if (func) \
  38. { \
  39. DWORD RTC_res; \
  40. RTC_res = WaitForSingleObject((HANDLE)_RTC_api_change_mutex, INFINITE); \
  41. if (RTC_res != WAIT_OBJECT_0) \
  42. DebugBreak(); \
  43. if (func) func parms; \
  44. ReleaseMutex((HANDLE)_RTC_api_change_mutex); \
  45. }
  46. #endif
  47. typedef void (__cdecl *_RTC_Allocate_hook_fp)(void *addr, unsigned sz, short level);
  48. typedef void (__cdecl *_RTC_Free_hook_fp)(void *mem, short level);
  49. typedef void (__fastcall *_RTC_MemCheck_hook_fp)(void **ptr, unsigned size);
  50. typedef void (__fastcall *_RTC_FuncCheckSet_hook_fp)(int status);
  51. extern _RTC_Allocate_hook_fp _RTC_Allocate_hook;
  52. extern _RTC_Free_hook_fp _RTC_Free_hook;
  53. extern _RTC_MemCheck_hook_fp _RTC_MemCheck_hook;
  54. extern _RTC_FuncCheckSet_hook_fp _RTC_FuncCheckSet_hook;
  55. #else
  56. # define RTCCALLBACK(a, b)
  57. #endif
  58. extern void *_RTC_api_change_mutex;
  59. #ifdef __cplusplus
  60. }
  61. #endif
  62. #else
  63. #define RTCCALLBACK(a, b)
  64. #endif
  65. #endif /* _INC_RTCSUP */