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.

198 lines
5.4 KiB

  1. //
  2. // Method and Access are filled tables, so directly index them
  3. //
  4. #include <wdm.h> // CTL_CODE definition
  5. //
  6. // allow easy access to parts of the ctl code
  7. //
  8. typedef union _CTL_CODE {
  9. ULONG32 Code;
  10. struct {
  11. ULONG32 Method :2;
  12. ULONG32 Function :12;
  13. ULONG32 Access :2;
  14. ULONG32 DeviceType :16;
  15. };
  16. } CTL_CODE, *PCTL_CODE;
  17. typedef struct _IOCTL_DEVICE_TYPE {
  18. PUCHAR Name;
  19. ULONG32 Value;
  20. } IOCTL_DEVICE_TYPE, *PIOCTL_DEVICE_TYPE;
  21. typedef struct _IOCTL_METHOD {
  22. PUCHAR Name;
  23. ULONG32 Value;
  24. } IOCTL_METHOD, *PIOCTL_METHOD;
  25. typedef struct _IOCTL_ACCESS {
  26. PUCHAR Name;
  27. ULONG32 Value;
  28. } IOCTL_ACCESS, *PIOCTL_ACCESS;
  29. typedef struct _IOCTL_VALUE {
  30. PUCHAR Name;
  31. ULONG32 Code;
  32. } IOCTL_VALUE, *PIOCTL_VALUE;
  33. #define SeedIoctlBase(_I) { #_I, _I }
  34. #define SeedIoctlMethod(_I) { #_I, _I }
  35. #define SeedIoctlAccess(_I) { #_I, _I }
  36. #define SeedIoctlValue(_I) { #_I, _I }
  37. //
  38. // code depends upon the fact that these are
  39. // in numeric order, without any skipped values
  40. // the index into the array is also the value.
  41. //
  42. IOCTL_METHOD TableIoctlMethod[] = {
  43. SeedIoctlMethod(METHOD_BUFFERED),
  44. SeedIoctlMethod(METHOD_IN_DIRECT),
  45. SeedIoctlMethod(METHOD_OUT_DIRECT),
  46. SeedIoctlMethod(METHOD_NEITHER),
  47. {NULL, 0}
  48. };
  49. IOCTL_ACCESS TableIoctlAccess[] = {
  50. SeedIoctlAccess(FILE_ANY_ACCESS),
  51. SeedIoctlAccess(FILE_READ_ACCESS),
  52. SeedIoctlAccess(FILE_WRITE_ACCESS),
  53. {"FILE_READ_ACCESS | FILE_WRITE_ACCESS", 3}, // hack, cough
  54. {NULL, 0}
  55. };
  56. IOCTL_DEVICE_TYPE TableIoctlDeviceType[] = {
  57. {"Zero (invalid)", 0},
  58. SeedIoctlBase(FILE_DEVICE_BEEP),
  59. SeedIoctlBase(FILE_DEVICE_CD_ROM),
  60. SeedIoctlBase(FILE_DEVICE_CD_ROM_FILE_SYSTEM),
  61. SeedIoctlBase(FILE_DEVICE_CONTROLLER),
  62. SeedIoctlBase(FILE_DEVICE_DATALINK),
  63. SeedIoctlBase(FILE_DEVICE_DFS),
  64. SeedIoctlBase(FILE_DEVICE_DISK),
  65. SeedIoctlBase(FILE_DEVICE_DISK_FILE_SYSTEM),
  66. SeedIoctlBase(FILE_DEVICE_FILE_SYSTEM),
  67. SeedIoctlBase(FILE_DEVICE_INPORT_PORT),
  68. SeedIoctlBase(FILE_DEVICE_KEYBOARD),
  69. SeedIoctlBase(FILE_DEVICE_MAILSLOT),
  70. SeedIoctlBase(FILE_DEVICE_MIDI_IN),
  71. SeedIoctlBase(FILE_DEVICE_MIDI_OUT),
  72. SeedIoctlBase(FILE_DEVICE_MOUSE),
  73. SeedIoctlBase(FILE_DEVICE_MULTI_UNC_PROVIDER),
  74. SeedIoctlBase(FILE_DEVICE_NAMED_PIPE),
  75. SeedIoctlBase(FILE_DEVICE_NETWORK),
  76. SeedIoctlBase(FILE_DEVICE_NETWORK_BROWSER),
  77. SeedIoctlBase(FILE_DEVICE_NETWORK_FILE_SYSTEM),
  78. SeedIoctlBase(FILE_DEVICE_NULL),
  79. SeedIoctlBase(FILE_DEVICE_PARALLEL_PORT),
  80. SeedIoctlBase(FILE_DEVICE_PHYSICAL_NETCARD),
  81. SeedIoctlBase(FILE_DEVICE_PRINTER),
  82. SeedIoctlBase(FILE_DEVICE_SCANNER),
  83. SeedIoctlBase(FILE_DEVICE_SERIAL_MOUSE_PORT),
  84. SeedIoctlBase(FILE_DEVICE_SERIAL_PORT),
  85. SeedIoctlBase(FILE_DEVICE_SCREEN),
  86. SeedIoctlBase(FILE_DEVICE_SOUND),
  87. SeedIoctlBase(FILE_DEVICE_STREAMS),
  88. SeedIoctlBase(FILE_DEVICE_TAPE),
  89. SeedIoctlBase(FILE_DEVICE_TAPE_FILE_SYSTEM),
  90. SeedIoctlBase(FILE_DEVICE_TRANSPORT),
  91. SeedIoctlBase(FILE_DEVICE_UNKNOWN),
  92. SeedIoctlBase(FILE_DEVICE_VIDEO),
  93. SeedIoctlBase(FILE_DEVICE_VIRTUAL_DISK),
  94. SeedIoctlBase(FILE_DEVICE_WAVE_IN),
  95. SeedIoctlBase(FILE_DEVICE_WAVE_OUT),
  96. SeedIoctlBase(FILE_DEVICE_8042_PORT),
  97. SeedIoctlBase(FILE_DEVICE_NETWORK_REDIRECTOR),
  98. SeedIoctlBase(FILE_DEVICE_BATTERY),
  99. SeedIoctlBase(FILE_DEVICE_BUS_EXTENDER),
  100. SeedIoctlBase(FILE_DEVICE_MODEM),
  101. SeedIoctlBase(FILE_DEVICE_VDM),
  102. SeedIoctlBase(FILE_DEVICE_MASS_STORAGE),
  103. SeedIoctlBase(FILE_DEVICE_SMB),
  104. SeedIoctlBase(FILE_DEVICE_KS),
  105. SeedIoctlBase(FILE_DEVICE_CHANGER),
  106. SeedIoctlBase(FILE_DEVICE_SMARTCARD),
  107. SeedIoctlBase(FILE_DEVICE_ACPI),
  108. SeedIoctlBase(FILE_DEVICE_DVD),
  109. SeedIoctlBase(FILE_DEVICE_FULLSCREEN_VIDEO),
  110. SeedIoctlBase(FILE_DEVICE_DFS_FILE_SYSTEM),
  111. SeedIoctlBase(FILE_DEVICE_DFS_VOLUME),
  112. SeedIoctlBase(FILE_DEVICE_SERENUM),
  113. SeedIoctlBase(FILE_DEVICE_TERMSRV),
  114. SeedIoctlBase(FILE_DEVICE_KSEC),
  115. {NULL, 0}
  116. };
  117. //
  118. // max must subtract one null-termination
  119. //
  120. #define MAX_IOCTL_METHOD ((sizeof(TableIoctlMethod)/sizeof(IOCTL_METHOD)-1))
  121. #define MAX_IOCTL_ACCESS ((sizeof(TableIoctlAccess)/sizeof(IOCTL_ACCESS)-1))
  122. #define MAX_IOCTL_DEVICE_TYPE ((sizeof(TableIoctlDeviceType)/sizeof(IOCTL_DEVICE_TYPE)-1))
  123. //
  124. // seed all the ioctls from the sdk
  125. //
  126. #include "batclass.h"
  127. #include "dfsfsctl.h"
  128. #include "gameport.h"
  129. #include "hidclass.h"
  130. #include "mountmgr.h"
  131. #include "ntddaux.h"
  132. #include "ntddbeep.h"
  133. #include "ntddbrow.h"
  134. #include "ntddcdrm.h"
  135. #include "ntddcdvd.h"
  136. #include "ntddchgr.h"
  137. #include "ntdddisk.h"
  138. #include "ntdddlc.h"
  139. #include "ntddfs.h"
  140. //#include "ntddip.h"
  141. #include "ntddjoy.h"
  142. #include "ntddkbd.h"
  143. #include "ntddksec.h"
  144. #include "ntddmidi.h"
  145. #include "ntddmodm.h"
  146. #include "ntddmou.h"
  147. #include "ntddmup.h"
  148. #include "ntddndis.h"
  149. #include "ntddnpfs.h"
  150. #include "ntddnull.h"
  151. #include "ntddpar.h"
  152. #include "ntddpcm.h"
  153. #include "ntddrdr.h"
  154. #include "ntddscsi.h"
  155. #include "ntddser.h"
  156. #include "ntddsnd.h"
  157. #include "ntddstor.h"
  158. #include "ntddstrm.h"
  159. #include "ntddtape.h"
  160. #include "ntddtdi.h"
  161. #include "ntddtime.h"
  162. #include "ntddtx.h"
  163. #include "ntddvdeo.h"
  164. #include "ntddvdsk.h"
  165. #include "ntddvol.h"
  166. #include "ntddwave.h"
  167. #include "scsiscan.h"
  168. #include "swenum.h"
  169. #include "usbioctl.h"
  170. #include "usbscan.h"
  171. #include "wdm.h"
  172. #include "winsmcrd.h"
  173. #include "wmistr.h"
  174. #include "wmiumkm.h"
  175. // #include "i2osmi.h" // can't find "I2OUtil.h"
  176. // #include "hydra\ica*" // bad definitions
  177. #include "sdkioctl.h"