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.

180 lines
4.4 KiB

  1. //////////////////////////////////////////////////////////////////////////////\
  2. //
  3. // Copyright (c) 1990 Microsoft Corporation
  4. //
  5. // Module Name:
  6. //
  7. // test.h
  8. //
  9. // Abstract:
  10. //
  11. // The main header for the NDIS/KS test driver
  12. //
  13. // Author:
  14. //
  15. // P Porzuczek
  16. //
  17. // Environment:
  18. //
  19. // Notes:
  20. //
  21. // Revision History:
  22. //
  23. //
  24. ///////////////////////////////////////////////////////////////////////////////
  25. #ifndef _MAIN_H
  26. #define _MAIN_H
  27. #if DBG
  28. extern ULONG TestDebugFlag;
  29. #define TEST_DBG_NONE 0x00000000
  30. #define TEST_DBG_TRACE 0x00000001
  31. #define TEST_DBG_WRITE_DATA 0x00000002
  32. #define TEST_DBG_READ_DATA 0x00000004
  33. #define TEST_DBG_RECV 0x00000008
  34. #define TEST_DBG_SRB 0x00000010
  35. #define TEST_DBG_CRC 0x00000020
  36. #define TEST_DBG_NAB 0x00000040
  37. #define TEST_DBG_BUF 0x00000080
  38. #define TEST_DBG_ASSERT 0x00000100
  39. #define TEST_DBG_DETAIL 0x00001000
  40. #define TEST_DBG_INFO 0x00002000
  41. #define TEST_DBG_WARNING 0x00004000
  42. #define TEST_DBG_ERROR 0x00008000
  43. #ifdef DEBUG_EXTRAS
  44. #define TEST_DEBUG(_Trace, _Msg) \
  45. { \
  46. __int64 llTime = 0; \
  47. ULONG ulTime = 0; \
  48. NdisGetCurrentSystemTime ((PLARGE_INTEGER)&llTime); \
  49. ulTime = (ULONG) (llTime >> 2); \
  50. if (_Trace & TestDebugFlag) \
  51. { \
  52. DbgPrint ("%04X %08X %-10.10s %4d ", ulTime & 0xffff, _Trace, &__FILE__[2], __LINE__); \
  53. DbgPrint _Msg; \
  54. } \
  55. }
  56. #else
  57. #define TEST_DEBUG(_Trace, _Msg) \
  58. { \
  59. if (_Trace & TestDebugFlag) \
  60. { \
  61. DbgPrint _Msg; \
  62. } \
  63. }
  64. #endif // DEBUG_EXTRAS
  65. #define IF_TESTDEBUG(f) if (TestDebugFlag & (f))
  66. #define TEST_DEBUG_LOUD 0x00010000 // debugging info
  67. #define TEST_DEBUG_VERY_LOUD 0x00020000 // excessive debugging info
  68. #define TEST_DEBUG_LOG 0x00040000 // enable Log
  69. #define TEST_DEBUG_CHECK_DUP_SENDS 0x00080000 // check for duplicate sends
  70. #define TEST_DEBUG_TRACK_PACKET_LENS 0x00100000 // track directed packet lens
  71. #define TEST_DEBUG_WORKAROUND1 0x00200000 // drop DFR/DIS packets
  72. #define TEST_DEBUG_CARD_BAD 0x00400000 // dump data if CARD_BAD
  73. #define TEST_DEBUG_CARD_TESTS 0x00800000 // print reason for failing
  74. //
  75. // Macro for deciding whether to print a lot of debugging information.
  76. //
  77. #define IF_LOUD(A) IF_TESTDEBUG( TEST_DEBUG_LOUD ) { A }
  78. #define IF_VERY_LOUD(A) IF_TESTDEBUG( TEST_DEBUG_VERY_LOUD ) { A }
  79. //
  80. // Whether to use the Log buffer to record a trace of the driver.
  81. //
  82. #define IF_LOG(A) IF_TESTDEBUG( TEST_DEBUG_LOG ) { A }
  83. extern VOID TESTLog(UCHAR);
  84. //
  85. // Whether to do loud init failure
  86. //
  87. #define IF_INIT(A) A
  88. //
  89. // Whether to do loud card test failures
  90. //
  91. #define IF_TEST(A) IF_TESTDEBUG( TEST_DEBUG_CARD_TESTS ) { A }
  92. #else
  93. extern ULONG TestDebugFlag;
  94. #define TEST_NONE
  95. #define TEST_FUNCTIONS
  96. #define TEST_COMMANDS
  97. #define TEST_CONNECTIONS
  98. #define TEST_SCIDS
  99. #define TEST_LIST_ALLOCS
  100. #define TEST_POOL
  101. #define TEST_INDICATES
  102. #define TEST_ALLOCATION
  103. #define TEST_DEBUG(_Trace, _Msg)
  104. #define IF_TESTDEBUG(f)
  105. #define TEST_DEBUG_LOUD
  106. #define TEST_DEBUG_VERY_LOUD
  107. #define TEST_DEBUG_LOG
  108. #define TEST_DEBUG_CHECK_DUP_SENDS
  109. #define TEST_DEBUG_TRACK_PACKET_LENS
  110. #define TEST_DEBUG_WORKAROUND1
  111. #define TEST_DEBUG_CARD_BAD
  112. #define TEST_DEBUG_CARD_TESTS
  113. //
  114. // This is not a debug build, so make everything quiet.
  115. //
  116. #define IF_LOUD(A)
  117. #define IF_VERY_LOUD(A)
  118. #define IF_LOG(A)
  119. #define IF_INIT(A)
  120. #define IF_TEST(A)
  121. #endif // DBG
  122. NTSTATUS
  123. DriverEntry (
  124. IN PDRIVER_OBJECT pDriverObject,
  125. IN PUNICODE_STRING pszuRegistryPath);
  126. VOID
  127. SlipFreeMemory (
  128. PVOID pvToFree,
  129. ULONG ulSize
  130. );
  131. NTSTATUS
  132. SlipAllocateMemory (
  133. PVOID *ppvAllocated,
  134. ULONG ulcbSize
  135. );
  136. NTSTATUS
  137. SlipDriverInitialize (
  138. IN PDRIVER_OBJECT DriverObject,
  139. IN PUNICODE_STRING RegistryPath
  140. );
  141. #endif // _MAIN_H