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.

169 lines
3.9 KiB

  1. /*++ BUILD Version: 0002 // Increment this if a change has global effects
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. Wintools.h
  5. Abstract:
  6. This is the master headerfile for the Wintools library.
  7. Author:
  8. David J. Gilman (davegi) 28-Oct-1992
  9. Gregg R. Acheson (GreggA) 28-Feb-1994
  10. Environment:
  11. User Mode
  12. --*/
  13. #if ! defined( _WINTOOLS_ )
  14. #define _WINTOOLS_
  15. #include <windows.h>
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. //
  20. //*** Debug Information Support.
  21. //
  22. extern
  23. struct
  24. DEBUG_FLAGS
  25. WintoolsGlobalFlags;
  26. #if DBG
  27. VOID
  28. DebugAssertW(
  29. IN LPCWSTR Expression,
  30. IN LPCSTR File,
  31. IN DWORD LineNumber
  32. );
  33. #define DbgAssert( exp ) \
  34. (( exp ) \
  35. ? ( VOID ) 0 \
  36. : ( VOID ) DebugAssertW( \
  37. TEXT( #exp ), \
  38. __FILE__, \
  39. __LINE__ \
  40. ));
  41. #define DbgHandleAssert( h ) \
  42. DbgAssert((( h ) != NULL ) && (( h ) != INVALID_HANDLE_VALUE ))
  43. #define DbgPointerAssert( p ) \
  44. DbgAssert(( p ) != NULL )
  45. #else // ! DBG
  46. #define DbgAssert( exp )
  47. #define DbgHandleAssert( h )
  48. #define DbgPointerAssert( p )
  49. #endif // DBG
  50. //
  51. //*** Object Signature Support.
  52. //
  53. #if SIGNATURE
  54. #define DECLARE_SIGNATURE \
  55. DWORD_PTR Signature;
  56. #define SetSignature( p ) \
  57. (( p )->Signature = ( DWORD_PTR ) &(( p )->Signature ))
  58. #define CheckSignature( p ) \
  59. (( p )->Signature == ( DWORD_PTR ) &(( p )->Signature ))
  60. #else // ! SIGNATURE
  61. #define DECLARE_SIGNATURE
  62. #define SetSignature( p )
  63. #define CheckSignature( p )
  64. #endif // SIGNATURE
  65. //
  66. //*** Miscellaneous Macros.
  67. //
  68. #ifndef ARGUMENT_PRESENT
  69. #define ARGUMENT_PRESENT(ArgumentPointer) (\
  70. (CHAR *)(ArgumentPointer) != (CHAR *)(NULL) )
  71. #endif
  72. #define NumberOfEntries( x ) \
  73. ( sizeof(( x )) / sizeof(( x )[ 0 ]))
  74. #ifndef ARRAYSIZE
  75. #define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
  76. #endif
  77. //
  78. //*** Global constants.
  79. //
  80. //
  81. // Maximum number of characters in a string.
  82. //
  83. #define MAX_CHARS ( 2048 )
  84. //
  85. //*** Memory Management Support
  86. //
  87. #define AllocateMemory( t, s ) \
  88. (( LP##t ) LocalAlloc( LPTR, ( s )))
  89. #define AllocateObject( t, c ) \
  90. ( AllocateMemory( t, sizeof( t ) * ( c )))
  91. #define ReallocateMemory( t, p, s ) \
  92. (( LP##t ) LocalReAlloc(( HLOCAL )( p ), ( s ), LMEM_MOVEABLE ))
  93. #define ReallocateObject( t, p, c ) \
  94. ( ReallocateMemory( t, ( p ), sizeof( t ) * ( c )))
  95. #define FreeMemory( p ) \
  96. ((( p ) == NULL ) \
  97. ? TRUE \
  98. : (((p)=( LPVOID ) LocalFree(( HLOCAL )( p ))) == NULL ))
  99. #define FreeObject( p ) \
  100. FreeMemory(( p ))
  101. //
  102. //*** Function Prototypes.
  103. //
  104. BOOL
  105. GetCharMetrics(
  106. IN HDC hDC,
  107. IN LPLONG CharWidth,
  108. IN LPLONG CharHeight
  109. );
  110. #ifdef __cplusplus
  111. } // extern C
  112. #endif
  113. #endif // _WINTOOLS_