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.

244 lines
4.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: cdchgr.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #include <stdarg.h>
  11. #include <stdio.h>
  12. #include <ntddk.h>
  13. #include <scsi.h>
  14. #include "ntddchgr.h"
  15. #include "ntddscsi.h"
  16. #ifdef DebugPrint
  17. #undef DebugPrint
  18. #endif
  19. #if DBG
  20. #define DebugPrint(x) ChgrDebugPrint x
  21. #else
  22. #define DebugPrint(x)
  23. #endif
  24. VOID
  25. ChgrDebugPrint(
  26. ULONG DebugPrintLevel,
  27. PCCHAR DebugMessage,
  28. ...
  29. );
  30. //
  31. // Default timeout for all requests.
  32. //
  33. #define CDCHGR_TIMEOUT 30
  34. #define MAX_INQUIRY_DATA 252
  35. #define SLOT_STATE_NOT_INITIALIZED 0x80000000
  36. //
  37. // DriveType identifiers
  38. //
  39. #define ATAPI_25 0x0001
  40. #define TORISAN 0x0002
  41. #define ALPS_25 0x0003
  42. #define NEC_SCSI 0x0004
  43. #define PNR_SCSI 0x0005
  44. //
  45. // Device Extension
  46. //
  47. typedef struct _DEVICE_EXTENSION {
  48. //
  49. // Back pointer to device object
  50. //
  51. PDEVICE_OBJECT DeviceObject;
  52. //
  53. // Device Object for the underlying cdrom device.
  54. //
  55. PDEVICE_OBJECT CdromTargetDeviceObject;
  56. //
  57. // Determination of the device type.
  58. //
  59. ULONG DeviceType;
  60. //
  61. // Unique data for the DeviceType.
  62. // ATAPI_25 will be NumberOfSlots
  63. //
  64. ULONG NumberOfSlots;
  65. //
  66. // Indicates the currently selected platter of Torisan units.
  67. // Used in TURs (as the device overloads this command).
  68. //
  69. ULONG CurrentPlatter;
  70. //
  71. // The mechanism type - Cartridge (1) or individually changable media (0).
  72. //
  73. ULONG MechType;
  74. //
  75. // Ordinal of the underlying target.
  76. //
  77. ULONG CdRomDeviceNumber;
  78. //
  79. // PagingPathRequirements
  80. //
  81. ULONG PagingPathCount;
  82. KEVENT PagingPathCountEvent;
  83. //
  84. // The address of the underlying cdrom device.
  85. //
  86. SCSI_ADDRESS ScsiAddress;
  87. //
  88. // Indicates whether InterfaceState is currently set.
  89. //
  90. ULONG InterfaceStateSet;
  91. //
  92. // Symbolic link setup by IoRegisterDeviceInterface.
  93. // Used for IoSetDeviceState
  94. //
  95. UNICODE_STRING InterfaceName;
  96. //
  97. // Cached inquiry data.
  98. //
  99. INQUIRYDATA InquiryData;
  100. } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
  101. #define DEVICE_EXTENSION_SIZE sizeof(DEVICE_EXTENSION)
  102. typedef struct _PASS_THROUGH_REQUEST {
  103. SCSI_PASS_THROUGH Srb;
  104. SENSE_DATA SenseInfoBuffer;
  105. CHAR DataBuffer[0];
  106. } PASS_THROUGH_REQUEST, *PPASS_THROUGH_REQUEST;
  107. //
  108. // Changer function declarations.
  109. //
  110. NTSTATUS
  111. SendPassThrough(
  112. IN PDEVICE_OBJECT DeviceObject,
  113. IN PPASS_THROUGH_REQUEST ScsiPassThrough
  114. );
  115. BOOLEAN
  116. ChgrIoctl(
  117. IN ULONG Code
  118. );
  119. NTSTATUS
  120. ChgrGetStatus(
  121. IN PDEVICE_OBJECT DeviceObject,
  122. IN PIRP Irp
  123. );
  124. NTSTATUS
  125. ChgrGetParameters(
  126. IN PDEVICE_OBJECT DeviceObject,
  127. IN PIRP Irp
  128. );
  129. NTSTATUS
  130. ChgrGetStatus(
  131. IN PDEVICE_OBJECT DeviceObject,
  132. IN PIRP Irp
  133. );
  134. NTSTATUS
  135. ChgrGetProductData(
  136. IN PDEVICE_OBJECT DeviceObject,
  137. IN PIRP Irp
  138. );
  139. NTSTATUS
  140. ChgrSetAccess(
  141. IN PDEVICE_OBJECT DeviceObject,
  142. IN PIRP Irp
  143. );
  144. NTSTATUS
  145. ChgrGetElementStatus(
  146. IN PDEVICE_OBJECT DeviceObject,
  147. IN PIRP Irp
  148. );
  149. NTSTATUS
  150. ChgrInitializeElementStatus(
  151. IN PDEVICE_OBJECT DeviceObject,
  152. IN PIRP Irp
  153. );
  154. NTSTATUS
  155. ChgrSetPosition(
  156. IN PDEVICE_OBJECT DeviceObject,
  157. IN PIRP Irp
  158. );
  159. NTSTATUS
  160. ChgrExchangeMedium(
  161. IN PDEVICE_OBJECT DeviceObject,
  162. IN PIRP Irp
  163. );
  164. NTSTATUS
  165. ChgrReinitializeUnit(
  166. IN PDEVICE_OBJECT DeviceObject,
  167. IN PIRP Irp
  168. );
  169. NTSTATUS
  170. ChgrQueryVolumeTags(
  171. IN PDEVICE_OBJECT DeviceObject,
  172. IN PIRP Irp
  173. );
  174. NTSTATUS
  175. ChgrMoveMedium(
  176. IN PDEVICE_OBJECT DeviceObject,
  177. IN PIRP Irp
  178. );
  179. NTSTATUS
  180. SendTorisanCheckVerify(
  181. PDEVICE_OBJECT DeviceObject,
  182. PIRP Irp
  183. );