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.

153 lines
4.4 KiB

  1. // This is a part of the Active Template Library.
  2. // Copyright (C) 1996-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Active Template Library Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Active Template Library product.
  10. #ifndef __ATLDEF_H__
  11. #define __ATLDEF_H__
  12. #ifndef __cplusplus
  13. #error ATL requires C++ compilation (use a .cpp suffix)
  14. #endif
  15. #ifdef UNDER_CE
  16. #error ATL not currently supported for CE
  17. #endif
  18. #ifdef _UNICODE
  19. #ifndef UNICODE
  20. #define UNICODE // UNICODE is used by Windows headers
  21. #endif
  22. #endif
  23. #ifdef UNICODE
  24. #ifndef _UNICODE
  25. #define _UNICODE // _UNICODE is used by C-runtime/MFC headers
  26. #endif
  27. #endif
  28. #ifdef _DEBUG
  29. #ifndef DEBUG
  30. #define DEBUG
  31. #endif
  32. #endif
  33. #ifndef ATLASSERT
  34. #define ATLASSERT(expr) _ASSERTE(expr)
  35. #endif
  36. ///////////////////////////////////////////////////////////////////////////////
  37. // __declspec(novtable) is used on a class declaration to prevent the vtable
  38. // pointer from being initialized in the constructor and destructor for the
  39. // class. This has many benefits because the linker can now eliminate the
  40. // vtable and all the functions pointed to by the vtable. Also, the actual
  41. // constructor and destructor code are now smaller.
  42. ///////////////////////////////////////////////////////////////////////////////
  43. // This should only be used on a class that is not directly createable but is
  44. // rather only used as a base class. Additionally, the constructor and
  45. // destructor (if provided by the user) should not call anything that may cause
  46. // a virtual function call to occur back on the object.
  47. ///////////////////////////////////////////////////////////////////////////////
  48. // By default, the wizards will generate new ATL object classes with this
  49. // attribute (through the ATL_NO_VTABLE macro). This is normally safe as long
  50. // the restriction mentioned above is followed. It is always safe to remove
  51. // this macro from your class, so if in doubt, remove it.
  52. ///////////////////////////////////////////////////////////////////////////////
  53. #ifdef _ATL_DISABLE_NO_VTABLE
  54. #define ATL_NO_VTABLE
  55. #else
  56. #define ATL_NO_VTABLE __declspec(novtable)
  57. #endif
  58. #ifdef _ATL_DEBUG_REFCOUNT
  59. #ifndef _ATL_DEBUG_INTERFACES
  60. #define _ATL_DEBUG_INTERFACES
  61. #endif
  62. #endif
  63. #ifdef _ATL_DEBUG_INTERFACES
  64. #ifndef _ATL_DEBUG
  65. #define _ATL_DEBUG
  66. #endif // _ATL_DEBUG
  67. #endif // _ATL_DEBUG_INTERFACES
  68. #ifndef _ATL_HEAPFLAGS
  69. #ifdef _MALLOC_ZEROINIT
  70. #define _ATL_HEAPFLAGS HEAP_ZERO_MEMORY
  71. #else
  72. #define _ATL_HEAPFLAGS 0
  73. #endif
  74. #endif
  75. #ifndef _ATL_PACKING
  76. #define _ATL_PACKING 8
  77. #endif
  78. #ifdef _WIN64
  79. #if defined(_ATL_DLL)
  80. #define ATLAPI extern "C" HRESULT __declspec(dllimport)
  81. #define ATLAPI_(x) extern "C" __declspec(dllimport) x
  82. #define ATLINLINE
  83. #elif defined(_ATL_DLL_IMPL)
  84. #define ATLAPI extern "C" HRESULT __declspec(dllexport)
  85. #define ATLAPI_(x) extern "C" __declspec(dllexport) x
  86. #define ATLINLINE
  87. #else
  88. #define ATLAPI HRESULT
  89. #define ATLAPI_(x) x
  90. #define ATLINLINE inline
  91. #endif
  92. #else
  93. #if defined(_ATL_DLL)
  94. #define ATLAPI extern "C" HRESULT __declspec(dllimport) __stdcall
  95. #define ATLAPI_(x) extern "C" __declspec(dllimport) x __stdcall
  96. #define ATLINLINE
  97. #elif defined(_ATL_DLL_IMPL)
  98. #define ATLAPI extern "C" HRESULT __declspec(dllexport) __stdcall
  99. #define ATLAPI_(x) extern "C" __declspec(dllexport) x __stdcall
  100. #define ATLINLINE
  101. #else
  102. #define ATLAPI HRESULT __stdcall
  103. #define ATLAPI_(x) x __stdcall
  104. #define ATLINLINE inline
  105. #endif
  106. #endif
  107. #if defined (_CPPUNWIND) & (defined(_ATL_EXCEPTIONS) | defined(_AFX))
  108. #define ATLTRY(x) try{x;} catch(...) {}
  109. #else
  110. #define ATLTRY(x) x;
  111. #endif
  112. #define offsetofclass(base, derived) ((DWORD_PTR)(static_cast<base*>((derived*)_ATL_PACKING))-_ATL_PACKING)
  113. /////////////////////////////////////////////////////////////////////////////
  114. // Master version numbers
  115. #define _ATL 1 // Active Template Library
  116. #ifdef _WIN64
  117. #define _ATL_VER 0x0301 // Active Template Library version 3.0
  118. #else
  119. #define _ATL_VER 0x0300 // Active Template Library version 3.0
  120. #endif
  121. /////////////////////////////////////////////////////////////////////////////
  122. // Threading
  123. #ifndef _ATL_SINGLE_THREADED
  124. #ifndef _ATL_APARTMENT_THREADED
  125. #ifndef _ATL_FREE_THREADED
  126. #define _ATL_FREE_THREADED
  127. #endif
  128. #endif
  129. #endif
  130. #endif // __ATLDEF_H__
  131. /////////////////////////////////////////////////////////////////////////////