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.

90 lines
3.1 KiB

  1. /*
  2. - M A P I P E R F . H
  3. -
  4. * Purpose:
  5. * This is the place to define data structures, macros, and functions
  6. * used to improve the performance of WMS components.
  7. *
  8. * Copyright Microsoft Corporation, 1993-1994.
  9. *
  10. */
  11. #ifndef __MAPIPERF_H__
  12. #define __MAPIPERF_H__
  13. /*
  14. - SEGMENT()
  15. -
  16. * Purpose:
  17. * This macro allows us to control whether code_seg()s get defined
  18. * in a source module or not. Currently, these are only defined on
  19. * the Win16 platform. On Windows 95 and NT this macro expands out to
  20. * a #pragma comment(). The usage in a source module is:
  21. *
  22. * #pragma SEGMENT(segment_name)
  23. *
  24. * For Lego, the code_seg should never be used - TF
  25. */
  26. /* #if defined(WIN16) && !defined(DEBUG)
  27. #define SEGMENT(seg) code_seg(#seg)
  28. #else */
  29. #define SEGMENT(seg) comment(user,#seg)
  30. /* #endif */
  31. #if defined(WIN32) && !defined(MAC)
  32. #define SHARED_BEGIN data_seg(".SHARED")
  33. #define SHARED1_BEGIN data_seg(".SHARED1")
  34. #define SHARED_END data_seg()
  35. #define VTBL_BEGIN data_seg(".VTABLE")
  36. #define VTBL_END data_seg()
  37. #define DATA1_BEGIN data_seg(".data1","DATA")
  38. #define DATA2_BEGIN data_seg(".data2","DATA")
  39. #define DATA3_BEGIN data_seg(".data3","DATA")
  40. #define DATA_END data_seg()
  41. #else
  42. #define SHARED_BEGIN comment(user,".shared")
  43. #define SHARED1_BEGIN comment(user,".shared1")
  44. #define SHARED_END comment(user,".shared")
  45. #define VTBL_BEGIN comment(user,".vtable")
  46. #define VTBL_END comment(user,".vtable")
  47. #define DATA1_BEGIN comment(user,".data1")
  48. #define DATA2_BEGIN comment(user,".data2")
  49. #define DATA3_BEGIN comment(user,".data3")
  50. #define DATA_END comment(user,".data end")
  51. #endif
  52. // $MAC - Mac needs 16 bit style memory management
  53. #if defined(WIN32) && !defined(MAC)
  54. #define STACK_ALLOC(Size, Ptr) ( Ptr = _alloca((size_t) Size), Ptr ? S_OK : MAPI_E_NOT_ENOUGH_MEMORY )
  55. #define STACK_FREE(Ptr)
  56. #else
  57. #define STACK_ALLOC(Size, Ptr) MAPIAllocateBuffer(Size, &Ptr)
  58. #define STACK_FREE(Ptr) if (Ptr) MAPIFreeBuffer(Ptr)
  59. #endif
  60. #define FASTCALL __fastcall
  61. #define MAPISetBufferNameFn(pv) \
  62. (!(pv) || !(*((ULONG *)(pv) - 2) & 0x40000000)) ? 0 : \
  63. (**((int (__cdecl ***)(void *, ...))((ULONG *)(pv) - 3))) \
  64. ((void *)*((ULONG *)pv - 3), (ULONG *)pv - 4,
  65. #if defined(DEBUG) && !defined(DOS) && !defined(WIN16) && !defined(_WIN64)
  66. #define MAPISetBufferName(pv,psz) MAPISetBufferNameFn(pv) psz)
  67. #define MAPISetBufferName1(pv,psz,a1) MAPISetBufferNameFn(pv) psz,a1)
  68. #define MAPISetBufferName2(pv,psz,a1,a2) MAPISetBufferNameFn(pv) psz,a1,a2)
  69. #define MAPISetBufferName3(pv,psz,a1,a2,a3) MAPISetBufferNameFn(pv) psz,a1,a2,a3)
  70. #define MAPISetBufferName4(pv,psz,a1,a2,a3,a4) MAPISetBufferNameFn(pv) psz,a1,a2,a3,a4)
  71. #define MAPISetBufferName5(pv,psz,a1,a2,a3,a4,a5) MAPISetBufferNameFn(pv) psz,a1,a2,a3,a4,a5)
  72. #else
  73. #define MAPISetBufferName(pv,psz)
  74. #define MAPISetBufferName1(pv,psz,a1)
  75. #define MAPISetBufferName2(pv,psz,a1,a2)
  76. #define MAPISetBufferName3(pv,psz,a1,a2,a3)
  77. #define MAPISetBufferName4(pv,psz,a1,a2,a3,a4)
  78. #define MAPISetBufferName5(pv,psz,a1,a2,a3,a4,a5)
  79. #endif
  80. #endif /* __MAPIPERF_H__ */