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.

438 lines
16 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_SESSION_POOL_MAX_SIZE TD_IOCTL(43)
  85. #define IOCTL_TD_SESSION_POOL_TOTAL_SIZE TD_IOCTL(44)
  86. #define IOCTL_TD_NONPAGEDPOOLMDLTEST_MAP TD_IOCTL(45)
  87. #define IOCTL_TD_NONPAGEDPOOLMDLTEST_UNMAP TD_IOCTL(46)
  88. #define IOCTL_TD_NEWSTUFF TD_IOCTL(47)
  89. //
  90. // Functions section
  91. //
  92. // For a new operation declare the name of the function called
  93. // when the new ioctl is dispatched to the driver. The declaration
  94. // is needed for the user mode driver controller.
  95. //
  96. #ifdef NO_BUGGY_FUNCTIONS
  97. #define BgChkForceCustomBugcheck DoNothing
  98. #define StressAllocateContiguousMemory DoNothing
  99. #define StressAllocateCommonBuffer DoNothing
  100. #define StressAddPhysicalMemory DoNothing
  101. #define StressDeletePhysicalMemory DoNothing
  102. #define StressPhysicalMemorySimple DoNothing
  103. #define StressPoolFlag DoNothing
  104. #define StressPoolTagTableExtension DoNothing
  105. #define StressLockScenario DoNothing
  106. #define BgChkProcessHasLockedPages DoNothing
  107. #define BgChkNoMoreSystemPtes DoNothing
  108. #define BgChkBadPoolHeader DoNothing
  109. #define BgChkDriverCorruptedSystemPtes DoNothing
  110. #define BgChkDriverCorruptedExPool DoNothing
  111. #define BgChkDriverCorruptedMmPool DoNothing
  112. #define BgChkIrqlNotLessOrEqual DoNothing
  113. #define BgChkPageFaultBeyondEndOfAllocation DoNothing
  114. #define BgChkDriverVerifierDetectedViolation DoNothing
  115. #define BgChkCorruptSystemPtes DoNothing
  116. #define BgChkHangCurrentProcessor DoNothing
  117. #define TdMmAllocateContiguousMemorySpecifyCacheTest DoNothing
  118. #define TdSectionMapTestProcessSpace DoNothing
  119. #define TdSectionMapTestSystemSpace DoNothing
  120. #define TestTraceDatabase DoNothing
  121. #define MmTestProbeLockForEverStress DoNothing
  122. #define MmTestNameToAddressStress DoNothing
  123. #define MmTestEccBadStress DoNothing
  124. #define MmMapViewInSystemSpaceLargest DoNothing
  125. #define MmMapViewInSystemSpaceTotal DoNothing
  126. #define MmMapViewInSessionSpaceLargest DoNothing
  127. #define MmMapViewInSessionSpaceTotal DoNothing
  128. #define SessionPoolTest DoNothing
  129. #define DeadlockPositiveTest DoNothing
  130. #define DeadlockNegativeTest DoNothing
  131. #define DeadlockStressTest DoNothing
  132. #define TdReservedMappingSetSize DoNothing
  133. #define TdReservedMappingDoRead DoNothing
  134. #define TdSysPagedPoolMaxTest DoNothing
  135. #define TdSysPagedPoolTotalTest DoNothing
  136. #define TdNonPagedPoolMaxTest DoNothing
  137. #define TdNonPagedPoolTotalTest DoNothing
  138. #define TdFreeSystemPtesTest DoNothing
  139. #define TdSessionPoolMaxTest DoNothing
  140. #define TdSessionPoolTotalTest DoNothing
  141. #define TdNonPagedPoolMdlTestMap DoNothing
  142. #define TdNonPagedPoolMdlTestUnMap DoNothing
  143. #define NewStuff DoNothing
  144. #endif // #ifdef NO_BUGGY_FUNCTIONS
  145. //
  146. // Control section
  147. //
  148. // For a new operation add a new structure at the end of
  149. // BuggyFuns vector (but before the null termination structure).
  150. // Each structure contains the following fields:
  151. //
  152. // - IOCTL code
  153. // - short help text displayed when user mode controller
  154. // prints help information
  155. // - command line option for user mode controller
  156. // - Driver function called when IOCTL gets dispatched
  157. //
  158. BUGGY_IOCTL_HANDLER_INFORMATION BuggyFuns [] = {
  159. {IOCTL_TD_NOTHING,
  160. TEXT("nothing"),
  161. TEXT ("/ioctlnothing"),
  162. DoNothing },
  163. {IOCTL_TD_BUGCHECK,
  164. TEXT("custom bugcheck"),
  165. TEXT ("/ioctlbugcheck CODE PARAM1 PARAM2 PARAM3 PARAM4 (hex)"),
  166. BgChkForceCustomBugcheck },
  167. {IOCTL_TD_ALLOCPCONTIG_STRESS,
  168. TEXT("allocate contiguous memory"),
  169. TEXT ("/ioctlmmalloccontig"),
  170. StressAllocateContiguousMemory },
  171. {IOCTL_TD_COMMONBUFFER_STRESS,
  172. TEXT("allocate common buffer"),
  173. TEXT ("/ioctlcommonbuffer"),
  174. StressAllocateCommonBuffer },
  175. {IOCTL_TD_MMADDPMEM_STRESS,
  176. TEXT("add physical memory"),
  177. TEXT ("/ioctladdpmem"),
  178. StressAddPhysicalMemory },
  179. {IOCTL_TD_MMDELPMEM_STRESS,
  180. TEXT("delete physical memory"),
  181. TEXT ("/ioctldelpmem"),
  182. StressDeletePhysicalMemory },
  183. {IOCTL_TD_PMEM_SIMPLE_STRESS,
  184. TEXT("physical memory simple stress"),
  185. TEXT ("/ioctlpmemsimplestress"),
  186. StressPhysicalMemorySimple },
  187. {IOCTL_TD_POOLFLAG_STRESS,
  188. TEXT("pool flag"),
  189. TEXT ("/ioctlpoolflagstress"),
  190. StressPoolFlag },
  191. {IOCTL_TD_POOL_STRESS,
  192. TEXT("pool tag table extension"),
  193. TEXT ("/ioctlpooltagstress"),
  194. StressPoolTagTableExtension },
  195. {IOCTL_TD_LOCK_SCENARIO,
  196. TEXT("lock scenario"),
  197. TEXT ("/ioctllockscenario"),
  198. StressLockScenario },
  199. {IOCTL_BGCHK_PROCESS_HAS_LOCKED_PAGES,
  200. TEXT("bgchk locked pages"),
  201. TEXT ("/bgchkprocesshaslockedpages"),
  202. BgChkProcessHasLockedPages},
  203. {IOCTL_BGCHK_NO_MORE_SYSTEM_PTES,
  204. TEXT("bgchk no more syptes"),
  205. TEXT ("/bgchknomoresystemptes"),
  206. BgChkNoMoreSystemPtes},
  207. {IOCTL_BGCHK_BAD_POOL_HEADER,
  208. TEXT("bgchk bad pool header"),
  209. TEXT ("/bgchkbadpoolheader"),
  210. BgChkBadPoolHeader},
  211. {IOCTL_BGCHK_DRIVER_CORRUPTED_SYSTEM_PTES,
  212. TEXT("bgchk drv corrupted sysptes"),
  213. TEXT ("/bgchkdrivercorruptedsystemptes"),
  214. BgChkDriverCorruptedSystemPtes},
  215. {IOCTL_BGCHK_DRIVER_CORRUPTED_EXPOOL,
  216. TEXT("bgchk drv corrupted expool"),
  217. TEXT ("/bgchkdrivercorruptedexpool"),
  218. BgChkDriverCorruptedExPool},
  219. {IOCTL_BGCHK_DRIVER_CORRUPTED_MMPOOL,
  220. TEXT("bgchk drv corrupted mmpool"),
  221. TEXT ("/bgchkdrivercorruptedmmpool"),
  222. BgChkDriverCorruptedMmPool},
  223. {IOCTL_TD_IRQL_NOT_LESS_OR_EQUAL,
  224. TEXT("bgchk irql not less or equal"),
  225. TEXT ("/bgchkirqlnotlessorequal"),
  226. BgChkIrqlNotLessOrEqual},
  227. {IOCTL_TD_PAGE_FAULT_BEYOND_END_OF_ALLOCATION,
  228. TEXT("bgchk pgfault beyond allocation"),
  229. TEXT ("/bgchkpagefaultbeyondendofallocation"),
  230. BgChkPageFaultBeyondEndOfAllocation},
  231. {IOCTL_TD_DRIVER_VERIFIER_DETECTED_VIOLATION,
  232. TEXT("bgchk drvvrf detected violation"),
  233. TEXT ("/bgchkdriververifierdetectedviolation"),
  234. BgChkDriverVerifierDetectedViolation},
  235. {IOCTL_TD_CORRUPT_SYSPTES,
  236. TEXT("corrupt system ptes"),
  237. TEXT ("/corruptsysptes"),
  238. BgChkCorruptSystemPtes},
  239. {IOCTL_TD_HANG_PROCESSOR,
  240. TEXT("hang processor"),
  241. TEXT ("/hangprocessor"),
  242. BgChkHangCurrentProcessor},
  243. {IOCTL_TD_CONTIG_MEM_TEST,
  244. TEXT("contiguous memory specify cache"),
  245. TEXT ("/contigmemtest"),
  246. TdMmAllocateContiguousMemorySpecifyCacheTest},
  247. {IOCTL_TD_SECTION_MAP_TEST_PROCESS_SPACE,
  248. TEXT("map test process space"),
  249. TEXT ("/sectionmaptest"),
  250. TdSectionMapTestProcessSpace},
  251. {IOCTL_TD_SECTION_MAP_TEST_SYSTEM_SPACE,
  252. TEXT("map test system space"),
  253. TEXT ("/sectionmaptestsysspace"),
  254. TdSectionMapTestSystemSpace},
  255. {IOCTL_TEST_TRACEDB,
  256. TEXT("test trace database"),
  257. TEXT ("/tracedb"),
  258. TestTraceDatabase},
  259. {IOCTL_TD_MMPROBELOCKFOREVER_STRESS,
  260. TEXT("MmProbeAndLockForEver stress"),
  261. TEXT ("/ioctlprobelockforever"),
  262. MmTestProbeLockForEverStress},
  263. {IOCTL_TD_MMNAMETOADDR_STRESS,
  264. TEXT("MmNameToAddress stress"),
  265. TEXT ("/ioctlnametoaddr"),
  266. MmTestNameToAddressStress},
  267. {IOCTL_TD_MMECCBAD_STRESS,
  268. TEXT("MmEccBad bad stress"),
  269. TEXT ("/ioctleccbad"),
  270. MmTestEccBadStress},
  271. {IOCTL_TD_MMECCBAD_STRESS,
  272. TEXT("MmEccBad good stress - not implemented!!!"),
  273. TEXT ("/ioctleccgood"),
  274. DoNothing},
  275. {IOCTL_TD_MMMAPVSYSSPACE_LARGEST,
  276. TEXT("Determine the max size that can be mapped using MmMapViewInSystemSpace"),
  277. TEXT ("/mapviewsyslargest"),
  278. MmMapViewInSystemSpaceLargest},
  279. {IOCTL_TD_MMMAPVSYSSPACE_TOTAL,
  280. TEXT("Determine the total amount of memory that can be mapped using MmMapViewInSystemSpace"),
  281. TEXT ("/mapviewsystotal"),
  282. MmMapViewInSystemSpaceTotal},
  283. {IOCTL_TD_MMMAPVSESSPACE_LARGEST,
  284. TEXT("Determine the max size that can be mapped using MmMapViewInSessionSpace"),
  285. TEXT ("/mapviewseslargest"),
  286. MmMapViewInSessionSpaceLargest},
  287. {IOCTL_TD_MMMAPVSESSPACE_TOTAL,
  288. TEXT("Determine the total amount of memory that can be mapped using MmMapViewInSessionSpace"),
  289. TEXT ("/mapviewsestotal"),
  290. MmMapViewInSessionSpaceTotal},
  291. {IOCTL_TD_SESSION_POOL_TEST,
  292. TEXT("Determine the total amount of pool that can be allocated with SESSION_POOL_MASK flag"),
  293. TEXT ("/sessionpooltest"),
  294. SessionPoolTest },
  295. {IOCTL_TD_DEADLOCK_MECHANISM_POSITIVE_TEST,
  296. TEXT("Test the deadlock detection mechanism without actually causing deadlocks"),
  297. TEXT ("/deadlockpositive"),
  298. DeadlockPositiveTest },
  299. {IOCTL_TD_DEADLOCK_MECHANISM_NEGATIVE_TEST,
  300. TEXT("Test the deadlock detection mechanism by causing deadlocks"),
  301. TEXT ("/deadlocknegative"),
  302. DeadlockNegativeTest },
  303. {IOCTL_TD_DEADLOCK_STRESS_TEST,
  304. TEXT("Stress test for the deadlock detection mechanism"),
  305. TEXT ("/deadlockstress"),
  306. DeadlockStressTest },
  307. {IOCTL_TD_RESERVEDMAP_SET_SIZE,
  308. TEXT("Set the size of the reserved mapping address (MmMapLockedPagesWithReservedMapping tests)"),
  309. TEXT ("/ReservedMapSetSize"),
  310. TdReservedMappingSetSize },
  311. {IOCTL_TD_RESERVEDMAP_READ_OP,
  312. TEXT("Execute a \"read\" (MmMapLockedPagesWithReservedMapping tests)"),
  313. TEXT ("/ReservedMapRead"),
  314. TdReservedMappingDoRead },
  315. {IOCTL_TD_SYS_PAGED_POOL_MAX_SIZE,
  316. TEXT("Determine the maximum size of a block of paged pool currently available"),
  317. TEXT ("/SysPagedPoolMax"),
  318. TdSysPagedPoolMaxTest },
  319. {IOCTL_TD_SYS_PAGED_POOL_TOTAL_SIZE,
  320. TEXT("Determine the total size of the paged pool currently available (64 Kb - 32 bytes blocks)"),
  321. TEXT ("/SysPagedPoolTotal"),
  322. TdSysPagedPoolTotalTest },
  323. {IOCTL_TD_NONPAGED_POOL_MAX_SIZE,
  324. TEXT("Determine the maximum size of a block of non-paged pool currently available"),
  325. TEXT ("/NonPagedPoolMax"),
  326. TdNonPagedPoolMaxTest },
  327. {IOCTL_TD_NONPAGED_POOL_TOTAL_SIZE,
  328. TEXT("Determine the total size of the non-paged pool currently available (64 Kb - 32 bytes blocks)"),
  329. TEXT ("/NonPagedPoolTotal"),
  330. TdNonPagedPoolTotalTest },
  331. {IOCTL_TD_FREE_SYSTEM_PTES,
  332. TEXT("Determine the total amount of memory that can be mapped using system PTEs (1 Mb chunks)"),
  333. TEXT ("/FreeSystemPtes"),
  334. TdFreeSystemPtesTest },
  335. {IOCTL_TD_SESSION_POOL_MAX_SIZE,
  336. TEXT("Determine the maximum size of a block of session pool currently available"),
  337. TEXT ("/SessionPoolMax"),
  338. TdSessionPoolMaxTest },
  339. {IOCTL_TD_SESSION_POOL_TOTAL_SIZE,
  340. TEXT("Determine the total size of the session pool currently available (64 Kb - 32 bytes blocks)"),
  341. TEXT ("/SessionPoolTotal"),
  342. TdSessionPoolTotalTest },
  343. {IOCTL_TD_NONPAGEDPOOLMDLTEST_MAP,
  344. TEXT("MmBuildMdlForNonPagedPoolMap"),
  345. TEXT ("/BuildMdlForNonPagedPoolTest"),
  346. TdNonPagedPoolMdlTestMap },
  347. {IOCTL_TD_NONPAGEDPOOLMDLTEST_UNMAP,
  348. TEXT("MmBuildMdlForNonPagedPoolUnMap"),
  349. NULL,
  350. TdNonPagedPoolMdlTestUnMap },
  351. {IOCTL_TD_NEWSTUFF,
  352. TEXT("new stuff ioctl"),
  353. TEXT ("/newstuff"),
  354. NewStuff},
  355. {0, NULL, NULL, NULL} // termination
  356. };
  357. #endif // #ifndef FUNS_DEFINITION_MODULE
  358. #endif // #ifndef _FUNS_H_INCLUDED_
  359. //
  360. // End of header: funs.h
  361. //