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.

409 lines
15 KiB

  1. //
  2. // Buggy function declarations
  3. // Copyright (c) Microsoft Corporation, 1999.
  4. //
  5. // Header: funs.h
  6. // Author: Silviu Calinoiu (SilviuC)
  7. // Created: 8/14/1999 2:52pm
  8. //
  9. //
  10. // PLEASE READ IF YOU MODIFY THIS FILE !
  11. //
  12. // This header represents the communication mechanism between
  13. // the source code for the driver and the one for the user mode
  14. // controller of the driver. If you have a new operation to add
  15. // to the driver you have to fulfill the following steps:
  16. //
  17. // (1) Update the `IOCTL' section.
  18. // (2) Update the `Functions' section.
  19. // (3) Update the `Control' section.
  20. //
  21. #ifndef _FUNS_H_INCLUDED_
  22. #define _FUNS_H_INCLUDED_
  23. typedef VOID (* BUGGY_FUNCTION) (PVOID);
  24. typedef struct {
  25. ULONG Ioctl;
  26. LPCTSTR Message;
  27. LPCTSTR Command;
  28. BUGGY_FUNCTION Function;
  29. } BUGGY_IOCTL_HANDLER_INFORMATION;
  30. #ifndef FUNS_DEFINITION_MODULE
  31. extern BUGGY_IOCTL_HANDLER_INFORMATION BuggyFuns [];
  32. #else
  33. VOID DoNothing (PVOID NotUsed) {}
  34. //
  35. // IOCTL section
  36. //
  37. // In order to add a new IOCTL just declare it at the end of the section incrementing by
  38. // one the last TD_IOCTL declaration.
  39. //
  40. #define TD_IOCTL(n) CTL_CODE(FILE_DEVICE_UNKNOWN, (2048 + (n)), METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
  41. #define IOCTL_TD_NOTHING TD_IOCTL(0)
  42. #define IOCTL_TD_BUGCHECK TD_IOCTL(1)
  43. #define IOCTL_TD_POOL_STRESS TD_IOCTL(2)
  44. #define IOCTL_TD_LOCK_SCENARIO TD_IOCTL(3)
  45. #define IOCTL_BGCHK_PROCESS_HAS_LOCKED_PAGES TD_IOCTL(4)
  46. #define IOCTL_BGCHK_NO_MORE_SYSTEM_PTES TD_IOCTL(5)
  47. #define IOCTL_BGCHK_BAD_POOL_HEADER TD_IOCTL(6)
  48. #define IOCTL_BGCHK_DRIVER_CORRUPTED_SYSTEM_PTES TD_IOCTL(7)
  49. #define IOCTL_BGCHK_DRIVER_CORRUPTED_EXPOOL TD_IOCTL(8)
  50. #define IOCTL_BGCHK_DRIVER_CORRUPTED_MMPOOL TD_IOCTL(9)
  51. #define IOCTL_TD_IRQL_NOT_LESS_OR_EQUAL TD_IOCTL(10)
  52. #define IOCTL_TD_PAGE_FAULT_BEYOND_END_OF_ALLOCATION TD_IOCTL(11)
  53. #define IOCTL_TD_DRIVER_VERIFIER_DETECTED_VIOLATION TD_IOCTL(12)
  54. #define IOCTL_TD_HANG_PROCESSOR TD_IOCTL(13)
  55. #define IOCTL_TD_CORRUPT_SYSPTES TD_IOCTL(14)
  56. #define IOCTL_TD_CONTIG_MEM_TEST TD_IOCTL(15)
  57. #define IOCTL_TD_SECTION_MAP_TEST_PROCESS_SPACE TD_IOCTL(16)
  58. #define IOCTL_TD_SECTION_MAP_TEST_SYSTEM_SPACE TD_IOCTL(17)
  59. #define IOCTL_TD_COMMONBUFFER_STRESS TD_IOCTL(18)
  60. #define IOCTL_TD_POOLFLAG_STRESS TD_IOCTL(19)
  61. #define IOCTL_TD_ALLOCPCONTIG_STRESS TD_IOCTL(20)
  62. #define IOCTL_TD_MMADDPMEM_STRESS TD_IOCTL(21)
  63. #define IOCTL_TD_MMDELPMEM_STRESS TD_IOCTL(22)
  64. #define IOCTL_TD_PMEM_SIMPLE_STRESS TD_IOCTL(23)
  65. #define IOCTL_TEST_TRACEDB TD_IOCTL(24)
  66. #define IOCTL_TD_MMPROBELOCKFOREVER_STRESS TD_IOCTL(25)
  67. #define IOCTL_TD_MMNAMETOADDR_STRESS TD_IOCTL(26)
  68. #define IOCTL_TD_MMECCBAD_STRESS TD_IOCTL(27)
  69. #define IOCTL_TD_MMMAPVSYSSPACE_LARGEST TD_IOCTL(28)
  70. #define IOCTL_TD_MMMAPVSYSSPACE_TOTAL TD_IOCTL(29)
  71. #define IOCTL_TD_MMMAPVSESSPACE_LARGEST TD_IOCTL(30)
  72. #define IOCTL_TD_MMMAPVSESSPACE_TOTAL TD_IOCTL(31)
  73. #define IOCTL_TD_SESSION_POOL_TEST TD_IOCTL(32)
  74. #define IOCTL_TD_DEADLOCK_MECHANISM_POSITIVE_TEST TD_IOCTL(33)
  75. #define IOCTL_TD_DEADLOCK_MECHANISM_NEGATIVE_TEST TD_IOCTL(34)
  76. #define IOCTL_TD_DEADLOCK_STRESS_TEST TD_IOCTL(35)
  77. #define IOCTL_TD_RESERVEDMAP_SET_SIZE TD_IOCTL(36)
  78. #define IOCTL_TD_RESERVEDMAP_READ_OP TD_IOCTL(37)
  79. #define IOCTL_TD_SYS_PAGED_POOL_MAX_SIZE TD_IOCTL(38)
  80. #define IOCTL_TD_SYS_PAGED_POOL_TOTAL_SIZE TD_IOCTL(39)
  81. #define IOCTL_TD_NONPAGED_POOL_MAX_SIZE TD_IOCTL(40)
  82. #define IOCTL_TD_NONPAGED_POOL_TOTAL_SIZE TD_IOCTL(41)
  83. #define IOCTL_TD_FREE_SYSTEM_PTES TD_IOCTL(42)
  84. #define IOCTL_TD_NEWSTUFF TD_IOCTL(43)
  85. //
  86. // Functions section
  87. //
  88. // For a new operation declare the name of the function called
  89. // when the new ioctl is dispatched to the driver. The declaration
  90. // is needed for the user mode driver controller.
  91. //
  92. #ifdef NO_BUGGY_FUNCTIONS
  93. #define BgChkForceCustomBugcheck DoNothing
  94. #define StressAllocateContiguousMemory DoNothing
  95. #define StressAllocateCommonBuffer DoNothing
  96. #define StressAddPhysicalMemory DoNothing
  97. #define StressDeletePhysicalMemory DoNothing
  98. #define StressPhysicalMemorySimple DoNothing
  99. #define StressPoolFlag DoNothing
  100. #define StressPoolTagTableExtension DoNothing
  101. #define StressLockScenario DoNothing
  102. #define BgChkProcessHasLockedPages DoNothing
  103. #define BgChkNoMoreSystemPtes DoNothing
  104. #define BgChkBadPoolHeader DoNothing
  105. #define BgChkDriverCorruptedSystemPtes DoNothing
  106. #define BgChkDriverCorruptedExPool DoNothing
  107. #define BgChkDriverCorruptedMmPool DoNothing
  108. #define BgChkIrqlNotLessOrEqual DoNothing
  109. #define BgChkPageFaultBeyondEndOfAllocation DoNothing
  110. #define BgChkDriverVerifierDetectedViolation DoNothing
  111. #define BgChkCorruptSystemPtes DoNothing
  112. #define BgChkHangCurrentProcessor DoNothing
  113. #define TdMmAllocateContiguousMemorySpecifyCacheTest DoNothing
  114. #define TdSectionMapTestProcessSpace DoNothing
  115. #define TdSectionMapTestSystemSpace DoNothing
  116. #define TestTraceDatabase DoNothing
  117. #define MmTestProbeLockForEverStress DoNothing
  118. #define MmTestNameToAddressStress DoNothing
  119. #define MmTestEccBadStress DoNothing
  120. #define MmMapViewInSystemSpaceLargest DoNothing
  121. #define MmMapViewInSystemSpaceTotal DoNothing
  122. #define MmMapViewInSessionSpaceLargest DoNothing
  123. #define MmMapViewInSessionSpaceTotal DoNothing
  124. #define SessionPoolTest DoNothing
  125. #define DeadlockPositiveTest DoNothing
  126. #define DeadlockNegativeTest DoNothing
  127. #define DeadlockStressTest DoNothing
  128. #define TdReservedMappingSetSize DoNothing
  129. #define TdReservedMappingDoRead DoNothing
  130. #define TdSysPagedPoolMaxTest DoNothing
  131. #define TdSysPagedPoolTotalTest DoNothing
  132. #define TdNonPagedPoolMaxTest DoNothing
  133. #define TdNonPagedPoolTotalTest DoNothing
  134. #define TdFreeSystemPtesTest DoNothing
  135. #define NewStuff DoNothing
  136. #endif // #ifdef NO_BUGGY_FUNCTIONS
  137. //
  138. // Control section
  139. //
  140. // For a new operation add a new structure at the end of
  141. // BuggyFuns vector (but before the null termination structure).
  142. // Each structure contains the following fields:
  143. //
  144. // - IOCTL code
  145. // - short help text displayed when user mode controller
  146. // prints help information
  147. // - command line option for user mode controller
  148. // - Driver function called when IOCTL gets dispatched
  149. //
  150. BUGGY_IOCTL_HANDLER_INFORMATION BuggyFuns [] = {
  151. {IOCTL_TD_NOTHING,
  152. TEXT("nothing"),
  153. TEXT ("/ioctlnothing"),
  154. DoNothing },
  155. {IOCTL_TD_BUGCHECK,
  156. TEXT("custom bugcheck"),
  157. TEXT ("/ioctlbugcheck CODE PARAM1 PARAM2 PARAM3 PARAM4 (hex)"),
  158. BgChkForceCustomBugcheck },
  159. {IOCTL_TD_ALLOCPCONTIG_STRESS,
  160. TEXT("allocate contiguous memory"),
  161. TEXT ("/ioctlmmalloccontig"),
  162. StressAllocateContiguousMemory },
  163. {IOCTL_TD_COMMONBUFFER_STRESS,
  164. TEXT("allocate common buffer"),
  165. TEXT ("/ioctlcommonbuffer"),
  166. StressAllocateCommonBuffer },
  167. {IOCTL_TD_MMADDPMEM_STRESS,
  168. TEXT("add physical memory"),
  169. TEXT ("/ioctladdpmem"),
  170. StressAddPhysicalMemory },
  171. {IOCTL_TD_MMDELPMEM_STRESS,
  172. TEXT("delete physical memory"),
  173. TEXT ("/ioctldelpmem"),
  174. StressDeletePhysicalMemory },
  175. {IOCTL_TD_PMEM_SIMPLE_STRESS,
  176. TEXT("physical memory simple stress"),
  177. TEXT ("/ioctlpmemsimplestress"),
  178. StressPhysicalMemorySimple },
  179. {IOCTL_TD_POOLFLAG_STRESS,
  180. TEXT("pool flag"),
  181. TEXT ("/ioctlpoolflagstress"),
  182. StressPoolFlag },
  183. {IOCTL_TD_POOL_STRESS,
  184. TEXT("pool tag table extension"),
  185. TEXT ("/ioctlpooltagstress"),
  186. StressPoolTagTableExtension },
  187. {IOCTL_TD_LOCK_SCENARIO,
  188. TEXT("lock scenario"),
  189. TEXT ("/ioctllockscenario"),
  190. StressLockScenario },
  191. {IOCTL_BGCHK_PROCESS_HAS_LOCKED_PAGES,
  192. TEXT("bgchk locked pages"),
  193. TEXT ("/bgchkprocesshaslockedpages"),
  194. BgChkProcessHasLockedPages},
  195. {IOCTL_BGCHK_NO_MORE_SYSTEM_PTES,
  196. TEXT("bgchk no more syptes"),
  197. TEXT ("/bgchknomoresystemptes"),
  198. BgChkNoMoreSystemPtes},
  199. {IOCTL_BGCHK_BAD_POOL_HEADER,
  200. TEXT("bgchk bad pool header"),
  201. TEXT ("/bgchkbadpoolheader"),
  202. BgChkBadPoolHeader},
  203. {IOCTL_BGCHK_DRIVER_CORRUPTED_SYSTEM_PTES,
  204. TEXT("bgchk drv corrupted sysptes"),
  205. TEXT ("/bgchkdrivercorruptedsystemptes"),
  206. BgChkDriverCorruptedSystemPtes},
  207. {IOCTL_BGCHK_DRIVER_CORRUPTED_EXPOOL,
  208. TEXT("bgchk drv corrupted expool"),
  209. TEXT ("/bgchkdrivercorruptedexpool"),
  210. BgChkDriverCorruptedExPool},
  211. {IOCTL_BGCHK_DRIVER_CORRUPTED_MMPOOL,
  212. TEXT("bgchk drv corrupted mmpool"),
  213. TEXT ("/bgchkdrivercorruptedmmpool"),
  214. BgChkDriverCorruptedMmPool},
  215. {IOCTL_TD_IRQL_NOT_LESS_OR_EQUAL,
  216. TEXT("bgchk irql not less or equal"),
  217. TEXT ("/bgchkirqlnotlessorequal"),
  218. BgChkIrqlNotLessOrEqual},
  219. {IOCTL_TD_PAGE_FAULT_BEYOND_END_OF_ALLOCATION,
  220. TEXT("bgchk pgfault beyond allocation"),
  221. TEXT ("/bgchkpagefaultbeyondendofallocation"),
  222. BgChkPageFaultBeyondEndOfAllocation},
  223. {IOCTL_TD_DRIVER_VERIFIER_DETECTED_VIOLATION,
  224. TEXT("bgchk drvvrf detected violation"),
  225. TEXT ("/bgchkdriververifierdetectedviolation"),
  226. BgChkDriverVerifierDetectedViolation},
  227. {IOCTL_TD_CORRUPT_SYSPTES,
  228. TEXT("corrupt system ptes"),
  229. TEXT ("/corruptsysptes"),
  230. BgChkCorruptSystemPtes},
  231. {IOCTL_TD_HANG_PROCESSOR,
  232. TEXT("hang processor"),
  233. TEXT ("/hangprocessor"),
  234. BgChkHangCurrentProcessor},
  235. {IOCTL_TD_CONTIG_MEM_TEST,
  236. TEXT("contiguous memory specify cache"),
  237. TEXT ("/contigmemtest"),
  238. TdMmAllocateContiguousMemorySpecifyCacheTest},
  239. {IOCTL_TD_SECTION_MAP_TEST_PROCESS_SPACE,
  240. TEXT("map test process space"),
  241. TEXT ("/sectionmaptest"),
  242. TdSectionMapTestProcessSpace},
  243. {IOCTL_TD_SECTION_MAP_TEST_SYSTEM_SPACE,
  244. TEXT("map test system space"),
  245. TEXT ("/sectionmaptestsysspace"),
  246. TdSectionMapTestSystemSpace},
  247. {IOCTL_TEST_TRACEDB,
  248. TEXT("test trace database"),
  249. TEXT ("/tracedb"),
  250. TestTraceDatabase},
  251. {IOCTL_TD_MMPROBELOCKFOREVER_STRESS,
  252. TEXT("MmProbeAndLockForEver stress"),
  253. TEXT ("/ioctlprobelockforever"),
  254. MmTestProbeLockForEverStress},
  255. {IOCTL_TD_MMNAMETOADDR_STRESS,
  256. TEXT("MmNameToAddress stress"),
  257. TEXT ("/ioctlnametoaddr"),
  258. MmTestNameToAddressStress},
  259. {IOCTL_TD_MMECCBAD_STRESS,
  260. TEXT("MmEccBad bad stress"),
  261. TEXT ("/ioctleccbad"),
  262. MmTestEccBadStress},
  263. {IOCTL_TD_MMECCBAD_STRESS,
  264. TEXT("MmEccBad good stress - not implemented!!!"),
  265. TEXT ("/ioctleccgood"),
  266. DoNothing},
  267. {IOCTL_TD_MMMAPVSYSSPACE_LARGEST,
  268. TEXT("Determine the max size that can be mapped using MmMapViewInSystemSpace"),
  269. TEXT ("/mapviewsyslargest"),
  270. MmMapViewInSystemSpaceLargest},
  271. {IOCTL_TD_MMMAPVSYSSPACE_TOTAL,
  272. TEXT("Determine the total amount of memory that can be mapped using MmMapViewInSystemSpace"),
  273. TEXT ("/mapviewsystotal"),
  274. MmMapViewInSystemSpaceTotal},
  275. {IOCTL_TD_MMMAPVSESSPACE_LARGEST,
  276. TEXT("Determine the max size that can be mapped using MmMapViewInSessionSpace"),
  277. TEXT ("/mapviewseslargest"),
  278. MmMapViewInSessionSpaceLargest},
  279. {IOCTL_TD_MMMAPVSESSPACE_TOTAL,
  280. TEXT("Determine the total amount of memory that can be mapped using MmMapViewInSessionSpace"),
  281. TEXT ("/mapviewsestotal"),
  282. MmMapViewInSessionSpaceTotal},
  283. {IOCTL_TD_SESSION_POOL_TEST,
  284. TEXT("Determine the total amount of pool that can be allocated with SESSION_POOL_MASK flag"),
  285. TEXT ("/sessionpooltest"),
  286. SessionPoolTest },
  287. {IOCTL_TD_DEADLOCK_MECHANISM_POSITIVE_TEST,
  288. TEXT("Test the deadlock detection mechanism without actually causing deadlocks"),
  289. TEXT ("/deadlockpositive"),
  290. DeadlockPositiveTest },
  291. {IOCTL_TD_DEADLOCK_MECHANISM_NEGATIVE_TEST,
  292. TEXT("Test the deadlock detection mechanism by causing deadlocks"),
  293. TEXT ("/deadlocknegative"),
  294. DeadlockNegativeTest },
  295. {IOCTL_TD_DEADLOCK_STRESS_TEST,
  296. TEXT("Stress test for the deadlock detection mechanism"),
  297. TEXT ("/deadlockstress"),
  298. DeadlockStressTest },
  299. {IOCTL_TD_RESERVEDMAP_SET_SIZE,
  300. TEXT("Set the size of the reserved mapping address (MmMapLockedPagesWithReservedMapping tests)"),
  301. TEXT ("/ReservedMapSetSize"),
  302. TdReservedMappingSetSize },
  303. {IOCTL_TD_RESERVEDMAP_READ_OP,
  304. TEXT("Execute a \"read\" (MmMapLockedPagesWithReservedMapping tests)"),
  305. TEXT ("/ReservedMapRead"),
  306. TdReservedMappingDoRead },
  307. {IOCTL_TD_SYS_PAGED_POOL_MAX_SIZE,
  308. TEXT("Determine the maximum size of a block of paged pool currently available"),
  309. TEXT ("/SysPagedPoolMax"),
  310. TdSysPagedPoolMaxTest },
  311. {IOCTL_TD_SYS_PAGED_POOL_TOTAL_SIZE,
  312. TEXT("Determine the total size of the paged pool currently available (64 Kb - 32 bytes blocks)"),
  313. TEXT ("/SysPagedPoolTotal"),
  314. TdSysPagedPoolTotalTest },
  315. {IOCTL_TD_NONPAGED_POOL_MAX_SIZE,
  316. TEXT("Determine the maximum size of a block of non-paged pool currently available"),
  317. TEXT ("/NonPagedPoolMax"),
  318. TdNonPagedPoolMaxTest },
  319. {IOCTL_TD_NONPAGED_POOL_TOTAL_SIZE,
  320. TEXT("Determine the total size of the non-paged pool currently available (64 Kb - 32 bytes blocks)"),
  321. TEXT ("/NonPagedPoolTotal"),
  322. TdNonPagedPoolTotalTest },
  323. {IOCTL_TD_FREE_SYSTEM_PTES,
  324. TEXT("Determine the total amount of memory that can be mapped using system PTEs (1 Mb chunks)"),
  325. TEXT ("/FreeSystemPtes"),
  326. TdFreeSystemPtesTest },
  327. {IOCTL_TD_NEWSTUFF,
  328. TEXT("new stuff ioctl"),
  329. TEXT ("/newstuff"),
  330. NewStuff},
  331. {0, NULL, NULL, NULL} // termination
  332. };
  333. #endif // #ifndef FUNS_DEFINITION_MODULE
  334. #endif // #ifndef _FUNS_H_INCLUDED_
  335. //
  336. // End of header: funs.h
  337. //