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.

137 lines
4.8 KiB

  1. typedef struct _SCSI_PASS_THROUGH_WITH_BUFFERS {
  2. SCSI_PASS_THROUGH spt;
  3. ULONG Filler; // realign buffers to double word boundary
  4. UCHAR ucSenseBuf[32];
  5. UCHAR ucDataBuf[512];
  6. } SCSI_PASS_THROUGH_WITH_BUFFERS, *PSCSI_PASS_THROUGH_WITH_BUFFERS;
  7. typedef struct _SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER {
  8. SCSI_PASS_THROUGH_DIRECT sptd;
  9. ULONG Filler; // realign buffer to double word boundary
  10. UCHAR ucSenseBuf[32];
  11. } SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, *PSCSI_PASS_THROUGH_DIRECT_WITH_BUFFER;
  12. VOID
  13. PrintError(ULONG);
  14. VOID
  15. PrintDataBuffer(PUCHAR, ULONG);
  16. VOID
  17. PrintInquiryData(PCHAR /*PVOID*/);
  18. PUCHAR
  19. AllocateAlignedBuffer(ULONG, ULONG);
  20. VOID
  21. PrintStatusResults(BOOLEAN, DWORD, PSCSI_PASS_THROUGH_WITH_BUFFERS, ULONG);
  22. VOID
  23. PrintSenseInfo(PSCSI_PASS_THROUGH_WITH_BUFFERS);
  24. //
  25. // Command Descriptor Block constants.
  26. //
  27. #define CDB6GENERIC_LENGTH 6
  28. #define CDB10GENERIC_LENGTH 10
  29. #define CDB12GENERIC_LENGTH 12
  30. #define SENSE_BUFFER_SIZE 18
  31. #define SETBITON 1
  32. #define SETBITOFF 0
  33. //
  34. // Mode Sense/Select page constants.
  35. //
  36. #define MODE_PAGE_ERROR_RECOVERY 0x01
  37. #define MODE_PAGE_DISCONNECT 0x02
  38. #define MODE_PAGE_FORMAT_DEVICE 0x03
  39. #define MODE_PAGE_RIGID_GEOMETRY 0x04
  40. #define MODE_PAGE_FLEXIBILE 0x05
  41. #define MODE_PAGE_VERIFY_ERROR 0x07
  42. #define MODE_PAGE_CACHING 0x08
  43. #define MODE_PAGE_PERIPHERAL 0x09
  44. #define MODE_PAGE_CONTROL 0x0A
  45. #define MODE_PAGE_MEDIUM_TYPES 0x0B
  46. #define MODE_PAGE_NOTCH_PARTITION 0x0C
  47. #define MODE_SENSE_RETURN_ALL 0x3f
  48. #define MODE_SENSE_CURRENT_VALUES 0x00
  49. #define MODE_SENSE_CHANGEABLE_VALUES 0x40
  50. #define MODE_SENSE_DEFAULT_VAULES 0x80
  51. #define MODE_SENSE_SAVED_VALUES 0xc0
  52. #define MODE_PAGE_DEVICE_CONFIG 0x10
  53. #define MODE_PAGE_MEDIUM_PARTITION 0x11
  54. #define MODE_PAGE_DATA_COMPRESS 0x0f
  55. //
  56. // SCSI CDB operation codes
  57. //
  58. #define SCSIOP_TEST_UNIT_READY 0x00
  59. #define SCSIOP_REZERO_UNIT 0x01
  60. #define SCSIOP_REWIND 0x01
  61. #define SCSIOP_REQUEST_BLOCK_ADDR 0x02
  62. #define SCSIOP_REQUEST_SENSE 0x03
  63. #define SCSIOP_FORMAT_UNIT 0x04
  64. #define SCSIOP_READ_BLOCK_LIMITS 0x05
  65. #define SCSIOP_REASSIGN_BLOCKS 0x07
  66. #define SCSIOP_READ6 0x08
  67. #define SCSIOP_RECEIVE 0x08
  68. #define SCSIOP_WRITE6 0x0A
  69. #define SCSIOP_PRINT 0x0A
  70. #define SCSIOP_SEND 0x0A
  71. #define SCSIOP_SEEK6 0x0B
  72. #define SCSIOP_TRACK_SELECT 0x0B
  73. #define SCSIOP_SLEW_PRINT 0x0B
  74. #define SCSIOP_SEEK_BLOCK 0x0C
  75. #define SCSIOP_PARTITION 0x0D
  76. #define SCSIOP_READ_REVERSE 0x0F
  77. #define SCSIOP_WRITE_FILEMARKS 0x10
  78. #define SCSIOP_FLUSH_BUFFER 0x10
  79. #define SCSIOP_SPACE 0x11
  80. #define SCSIOP_INQUIRY 0x12
  81. #define SCSIOP_VERIFY6 0x13
  82. #define SCSIOP_RECOVER_BUF_DATA 0x14
  83. #define SCSIOP_MODE_SELECT 0x15
  84. #define SCSIOP_RESERVE_UNIT 0x16
  85. #define SCSIOP_RELEASE_UNIT 0x17
  86. #define SCSIOP_COPY 0x18
  87. #define SCSIOP_ERASE 0x19
  88. #define SCSIOP_MODE_SENSE 0x1A
  89. #define SCSIOP_START_STOP_UNIT 0x1B
  90. #define SCSIOP_STOP_PRINT 0x1B
  91. #define SCSIOP_LOAD_UNLOAD 0x1B
  92. #define SCSIOP_RECEIVE_DIAGNOSTIC 0x1C
  93. #define SCSIOP_SEND_DIAGNOSTIC 0x1D
  94. #define SCSIOP_MEDIUM_REMOVAL 0x1E
  95. #define SCSIOP_READ_CAPACITY 0x25
  96. #define SCSIOP_READ 0x28
  97. #define SCSIOP_WRITE 0x2A
  98. #define SCSIOP_SEEK 0x2B
  99. #define SCSIOP_LOCATE 0x2B
  100. #define SCSIOP_WRITE_VERIFY 0x2E
  101. #define SCSIOP_VERIFY 0x2F
  102. #define SCSIOP_SEARCH_DATA_HIGH 0x30
  103. #define SCSIOP_SEARCH_DATA_EQUAL 0x31
  104. #define SCSIOP_SEARCH_DATA_LOW 0x32
  105. #define SCSIOP_SET_LIMITS 0x33
  106. #define SCSIOP_READ_POSITION 0x34
  107. #define SCSIOP_SYNCHRONIZE_CACHE 0x35
  108. #define SCSIOP_COMPARE 0x39
  109. #define SCSIOP_COPY_COMPARE 0x3A
  110. #define SCSIOP_WRITE_DATA_BUFF 0x3B
  111. #define SCSIOP_READ_DATA_BUFF 0x3C
  112. #define SCSIOP_CHANGE_DEFINITION 0x40
  113. #define SCSIOP_READ_SUB_CHANNEL 0x42
  114. #define SCSIOP_READ_TOC 0x43
  115. #define SCSIOP_READ_HEADER 0x44
  116. #define SCSIOP_PLAY_AUDIO 0x45
  117. #define SCSIOP_PLAY_AUDIO_MSF 0x47
  118. #define SCSIOP_PLAY_TRACK_INDEX 0x48
  119. #define SCSIOP_PLAY_TRACK_RELATIVE 0x49
  120. #define SCSIOP_PAUSE_RESUME 0x4B
  121. #define SCSIOP_LOG_SELECT 0x4C
  122. #define SCSIOP_LOG_SENSE 0x4D