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.

92 lines
2.1 KiB

  1. //
  2. // Enable driver verifier support for ntoskrnl
  3. // Copyright (c) Microsoft Corporation, 1999
  4. //
  5. //
  6. // module: genutil.hxx
  7. // author: DMihai
  8. // created: 04/19/99
  9. // description: genaral purpose utility routines
  10. //
  11. //
  12. #ifndef __GENUTIL_HXX_INCLUDED__
  13. #define __GENUTIL_HXX_INCLUDED__
  14. /////////////////////////////////////////////////////////////////////
  15. //
  16. // Macro:
  17. //
  18. // assert_ (exp)
  19. //
  20. // Description:
  21. //
  22. // Custom defined assertion macro. It is active, unless
  23. // ASSERT_DISABLED macro is defined. We take care to protect
  24. // it from multiple definitions by enclosing it in
  25. // '#ifndef assert_ .. #endif'.
  26. //
  27. #ifndef ASSERT_DISABLED
  28. #ifndef assert_
  29. #define assert_(exp) \
  30. if ((exp) == 0) \
  31. { \
  32. _tprintf ( _TEXT("'assert_' failed: %s (%d): \n %s"), \
  33. _TEXT( __FILE__ ), __LINE__, _TEXT( #exp ) ); \
  34. exit (-1); \
  35. }
  36. #endif // #ifndef assert_
  37. #else
  38. #define assert_(exp)
  39. #endif // #ifndef ASSERT_DISABLED
  40. /////////////////////////////////////////////////////////////////////
  41. //
  42. // Macro:
  43. //
  44. // ARRAY_LEN( array )
  45. //
  46. // Description:
  47. //
  48. // Calculate array length
  49. //
  50. #define ARRAY_LEN( array ) ( sizeof(array) / sizeof( array[0] ) )
  51. ///////////////////////////////////////////////////////////////////
  52. void
  53. __cdecl
  54. DisplayMessage(
  55. UINT uFormatResId,
  56. ... );
  57. ///////////////////////////////////////////////////////////////////
  58. //
  59. // Function:
  60. //
  61. // ConvertAnsiStringToTcharString
  62. //
  63. // Description:
  64. //
  65. // This function converts an ANSI string to a TCHAR string,
  66. // that is ANSO or UNICODE.
  67. //
  68. // The function is needed because the system returns the active
  69. // modules as ANSI strings.
  70. //
  71. BOOL
  72. ConvertAnsiStringToTcharString (
  73. LPBYTE Source,
  74. ULONG SourceLength,
  75. LPTSTR Destination,
  76. ULONG DestinationLength);
  77. #endif //#ifndef __GENUTIL_HXX_INCLUDED__