[1166] | 1 | /*
|
---|
| 2 | * ntddchgr.h
|
---|
| 3 | *
|
---|
| 4 | * Media changer IOCTL interface.
|
---|
| 5 | *
|
---|
| 6 | * This file is part of the w32api package.
|
---|
| 7 | *
|
---|
| 8 | * Contributors:
|
---|
| 9 | * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
|
---|
| 10 | *
|
---|
| 11 | * THIS SOFTWARE IS NOT COPYRIGHTED
|
---|
| 12 | *
|
---|
| 13 | * This source code is offered for use in the public domain. You may
|
---|
| 14 | * use, modify or distribute it freely.
|
---|
| 15 | *
|
---|
| 16 | * This code is distributed in the hope that it will be useful but
|
---|
| 17 | * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
---|
| 18 | * DISCLAIMED. This includes but is not limited to warranties of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 20 | *
|
---|
| 21 | */
|
---|
| 22 |
|
---|
| 23 | #pragma once
|
---|
| 24 |
|
---|
| 25 | #include "ntddstor.h"
|
---|
| 26 |
|
---|
| 27 | #ifdef __cplusplus
|
---|
| 28 | extern "C" {
|
---|
| 29 | #endif
|
---|
| 30 |
|
---|
| 31 | #define DD_CHANGER_DEVICE_NAME "\\Device\\Changer"
|
---|
| 32 | #define DD_CHANGER_DEVICE_NAME_U L"\\Device\\Changer"
|
---|
| 33 |
|
---|
| 34 | #define IOCTL_CHANGER_BASE FILE_DEVICE_CHANGER
|
---|
| 35 |
|
---|
| 36 | #define IOCTL_CHANGER_EXCHANGE_MEDIUM \
|
---|
| 37 | CTL_CODE(IOCTL_CHANGER_BASE, 0x0008, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
| 38 |
|
---|
| 39 | #define IOCTL_CHANGER_GET_ELEMENT_STATUS \
|
---|
| 40 | CTL_CODE(IOCTL_CHANGER_BASE, 0x0005, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
---|
| 41 |
|
---|
| 42 | #define IOCTL_CHANGER_GET_PARAMETERS \
|
---|
| 43 | CTL_CODE(IOCTL_CHANGER_BASE, 0x0000, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
| 44 |
|
---|
| 45 | #define IOCTL_CHANGER_GET_PRODUCT_DATA \
|
---|
| 46 | CTL_CODE(IOCTL_CHANGER_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
| 47 |
|
---|
| 48 | #define IOCTL_CHANGER_GET_STATUS \
|
---|
| 49 | CTL_CODE(IOCTL_CHANGER_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
| 50 |
|
---|
| 51 | #define IOCTL_CHANGER_INITIALIZE_ELEMENT_STATUS \
|
---|
| 52 | CTL_CODE(IOCTL_CHANGER_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
| 53 |
|
---|
| 54 | #define IOCTL_CHANGER_MOVE_MEDIUM \
|
---|
| 55 | CTL_CODE(IOCTL_CHANGER_BASE, 0x0009, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
| 56 |
|
---|
| 57 | #define IOCTL_CHANGER_QUERY_VOLUME_TAGS \
|
---|
| 58 | CTL_CODE(IOCTL_CHANGER_BASE, 0x000B, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
---|
| 59 |
|
---|
| 60 | #define IOCTL_CHANGER_REINITIALIZE_TRANSPORT \
|
---|
| 61 | CTL_CODE(IOCTL_CHANGER_BASE, 0x000A, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
| 62 |
|
---|
| 63 | #define IOCTL_CHANGER_SET_ACCESS \
|
---|
| 64 | CTL_CODE(IOCTL_CHANGER_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
---|
| 65 |
|
---|
| 66 | #define IOCTL_CHANGER_SET_POSITION \
|
---|
| 67 | CTL_CODE(IOCTL_CHANGER_BASE, 0x0007, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
| 68 |
|
---|
| 69 | #define MAX_VOLUME_ID_SIZE 36
|
---|
| 70 | #define MAX_VOLUME_TEMPLATE_SIZE 40
|
---|
| 71 |
|
---|
| 72 | #define VENDOR_ID_LENGTH 8
|
---|
| 73 | #define PRODUCT_ID_LENGTH 16
|
---|
| 74 | #define REVISION_LENGTH 4
|
---|
| 75 | #define SERIAL_NUMBER_LENGTH 32
|
---|
| 76 |
|
---|
| 77 | /* GET_CHANGER_PARAMETERS.Features0 constants */
|
---|
| 78 | #define CHANGER_BAR_CODE_SCANNER_INSTALLED 0x00000001
|
---|
| 79 | #define CHANGER_INIT_ELEM_STAT_WITH_RANGE 0x00000002
|
---|
| 80 | #define CHANGER_CLOSE_IEPORT 0x00000004
|
---|
| 81 | #define CHANGER_OPEN_IEPORT 0x00000008
|
---|
| 82 | #define CHANGER_STATUS_NON_VOLATILE 0x00000010
|
---|
| 83 | #define CHANGER_EXCHANGE_MEDIA 0x00000020
|
---|
| 84 | #define CHANGER_CLEANER_SLOT 0x00000040
|
---|
| 85 | #define CHANGER_LOCK_UNLOCK 0x00000080
|
---|
| 86 | #define CHANGER_CARTRIDGE_MAGAZINE 0x00000100
|
---|
| 87 | #define CHANGER_MEDIUM_FLIP 0x00000200
|
---|
| 88 | #define CHANGER_POSITION_TO_ELEMENT 0x00000400
|
---|
| 89 | #define CHANGER_REPORT_IEPORT_STATE 0x00000800
|
---|
| 90 | #define CHANGER_STORAGE_DRIVE 0x00001000
|
---|
| 91 | #define CHANGER_STORAGE_IEPORT 0x00002000
|
---|
| 92 | #define CHANGER_STORAGE_SLOT 0x00004000
|
---|
| 93 | #define CHANGER_STORAGE_TRANSPORT 0x00008000
|
---|
| 94 | #define CHANGER_DRIVE_CLEANING_REQUIRED 0x00010000
|
---|
| 95 | #define CHANGER_PREDISMOUNT_EJECT_REQUIRED 0x00020000
|
---|
| 96 | #define CHANGER_CLEANER_ACCESS_NOT_VALID 0x00040000
|
---|
| 97 | #define CHANGER_PREMOUNT_EJECT_REQUIRED 0x00080000
|
---|
| 98 | #define CHANGER_VOLUME_IDENTIFICATION 0x00100000
|
---|
| 99 | #define CHANGER_VOLUME_SEARCH 0x00200000
|
---|
| 100 | #define CHANGER_VOLUME_ASSERT 0x00400000
|
---|
| 101 | #define CHANGER_VOLUME_REPLACE 0x00800000
|
---|
| 102 | #define CHANGER_VOLUME_UNDEFINE 0x01000000
|
---|
| 103 | #define CHANGER_SERIAL_NUMBER_VALID 0x04000000
|
---|
| 104 | #define CHANGER_DEVICE_REINITIALIZE_CAPABLE 0x08000000
|
---|
| 105 | #define CHANGER_KEYPAD_ENABLE_DISABLE 0x10000000
|
---|
| 106 | #define CHANGER_DRIVE_EMPTY_ON_DOOR_ACCESS 0x20000000
|
---|
| 107 | #define CHANGER_RESERVED_BIT 0x80000000
|
---|
| 108 |
|
---|
| 109 | /* GET_CHANGER_PARAMETERS.Features1 constants */
|
---|
| 110 | #define CHANGER_PREDISMOUNT_ALIGN_TO_SLOT 0x80000001
|
---|
| 111 | #define CHANGER_PREDISMOUNT_ALIGN_TO_DRIVE 0x80000002
|
---|
| 112 | #define CHANGER_CLEANER_AUTODISMOUNT 0x80000004
|
---|
| 113 | #define CHANGER_TRUE_EXCHANGE_CAPABLE 0x80000008
|
---|
| 114 | #define CHANGER_SLOTS_USE_TRAYS 0x80000010
|
---|
| 115 | #define CHANGER_RTN_MEDIA_TO_ORIGINAL_ADDR 0x80000020
|
---|
| 116 | #define CHANGER_CLEANER_OPS_NOT_SUPPORTED 0x80000040
|
---|
| 117 | #define CHANGER_IEPORT_USER_CONTROL_OPEN 0x80000080
|
---|
| 118 | #define CHANGER_IEPORT_USER_CONTROL_CLOSE 0x80000100
|
---|
| 119 | #define CHANGER_MOVE_EXTENDS_IEPORT 0x80000200
|
---|
| 120 | #define CHANGER_MOVE_RETRACTS_IEPORT 0x80000400
|
---|
| 121 |
|
---|
| 122 | /* GET_CHANGER_PARAMETERS.MoveFrom,ExchangeFrom,PositionCapabilities constants */
|
---|
| 123 | #define CHANGER_TO_TRANSPORT 0x01
|
---|
| 124 | #define CHANGER_TO_SLOT 0x02
|
---|
| 125 | #define CHANGER_TO_IEPORT 0x04
|
---|
| 126 | #define CHANGER_TO_DRIVE 0x08
|
---|
| 127 |
|
---|
| 128 | /* GET_CHANGER_PARAMETERS.LockUnlockCapabilities constants */
|
---|
| 129 | #define LOCK_UNLOCK_IEPORT 0x01
|
---|
| 130 | #define LOCK_UNLOCK_DOOR 0x02
|
---|
| 131 | #define LOCK_UNLOCK_KEYPAD 0x04
|
---|
| 132 |
|
---|
| 133 | /* CHANGER_SET_ACCESS.Control constants */
|
---|
| 134 | #define LOCK_ELEMENT 0
|
---|
| 135 | #define UNLOCK_ELEMENT 1
|
---|
| 136 | #define EXTEND_IEPORT 2
|
---|
| 137 | #define RETRACT_IEPORT 3
|
---|
| 138 |
|
---|
| 139 | /* CHANGER_ELEMENT_STATUS(_EX).Flags constants */
|
---|
| 140 | #define ELEMENT_STATUS_FULL 0x00000001
|
---|
| 141 | #define ELEMENT_STATUS_IMPEXP 0x00000002
|
---|
| 142 | #define ELEMENT_STATUS_EXCEPT 0x00000004
|
---|
| 143 | #define ELEMENT_STATUS_ACCESS 0x00000008
|
---|
| 144 | #define ELEMENT_STATUS_EXENAB 0x00000010
|
---|
| 145 | #define ELEMENT_STATUS_INENAB 0x00000020
|
---|
| 146 | #define ELEMENT_STATUS_PRODUCT_DATA 0x00000040
|
---|
| 147 | #define ELEMENT_STATUS_LUN_VALID 0x00001000
|
---|
| 148 | #define ELEMENT_STATUS_ID_VALID 0x00002000
|
---|
| 149 | #define ELEMENT_STATUS_NOT_BUS 0x00008000
|
---|
| 150 | #define ELEMENT_STATUS_INVERT 0x00400000
|
---|
| 151 | #define ELEMENT_STATUS_SVALID 0x00800000
|
---|
| 152 | #define ELEMENT_STATUS_PVOLTAG 0x10000000
|
---|
| 153 | #define ELEMENT_STATUS_AVOLTAG 0x20000000
|
---|
| 154 |
|
---|
| 155 | /* CHANGER_ELEMENT_STATUS(_EX).ExceptionCode constants */
|
---|
| 156 | #define ERROR_LABEL_UNREADABLE 0x00000001
|
---|
| 157 | #define ERROR_LABEL_QUESTIONABLE 0x00000002
|
---|
| 158 | #define ERROR_SLOT_NOT_PRESENT 0x00000004
|
---|
| 159 | #define ERROR_DRIVE_NOT_INSTALLED 0x00000008
|
---|
| 160 | #define ERROR_TRAY_MALFUNCTION 0x00000010
|
---|
| 161 | #define ERROR_INIT_STATUS_NEEDED 0x00000011
|
---|
| 162 | #define ERROR_UNHANDLED_ERROR 0xFFFFFFFF
|
---|
| 163 |
|
---|
| 164 | /* CHANGER_SEND_VOLUME_TAG_INFORMATION.ActionCode constants */
|
---|
| 165 | #define SEARCH_ALL 0x0
|
---|
| 166 | #define SEARCH_PRIMARY 0x1
|
---|
| 167 | #define SEARCH_ALTERNATE 0x2
|
---|
| 168 | #define SEARCH_ALL_NO_SEQ 0x4
|
---|
| 169 | #define SEARCH_PRI_NO_SEQ 0x5
|
---|
| 170 | #define SEARCH_ALT_NO_SEQ 0x6
|
---|
| 171 | #define ASSERT_PRIMARY 0x8
|
---|
| 172 | #define ASSERT_ALTERNATE 0x9
|
---|
| 173 | #define REPLACE_PRIMARY 0xA
|
---|
| 174 | #define REPLACE_ALTERNATE 0xB
|
---|
| 175 | #define UNDEFINE_PRIMARY 0xC
|
---|
| 176 | #define UNDEFINE_ALTERNATE 0xD
|
---|
| 177 |
|
---|
| 178 | typedef enum _ELEMENT_TYPE {
|
---|
| 179 | AllElements,
|
---|
| 180 | ChangerTransport,
|
---|
| 181 | ChangerSlot,
|
---|
| 182 | ChangerIEPort,
|
---|
| 183 | ChangerDrive,
|
---|
| 184 | ChangerDoor,
|
---|
| 185 | ChangerKeypad,
|
---|
| 186 | ChangerMaxElement
|
---|
| 187 | } ELEMENT_TYPE, *PELEMENT_TYPE;
|
---|
| 188 |
|
---|
| 189 | typedef struct _CHANGER_ELEMENT {
|
---|
| 190 | ELEMENT_TYPE ElementType;
|
---|
| 191 | ULONG ElementAddress;
|
---|
| 192 | } CHANGER_ELEMENT, *PCHANGER_ELEMENT;
|
---|
| 193 |
|
---|
| 194 | typedef struct _CHANGER_ELEMENT_LIST {
|
---|
| 195 | CHANGER_ELEMENT Element;
|
---|
| 196 | ULONG NumberOfElements;
|
---|
| 197 | } CHANGER_ELEMENT_LIST, *PCHANGER_ELEMENT_LIST;
|
---|
| 198 |
|
---|
| 199 | typedef struct _GET_CHANGER_PARAMETERS {
|
---|
| 200 | ULONG Size;
|
---|
| 201 | USHORT NumberTransportElements;
|
---|
| 202 | USHORT NumberStorageElements;
|
---|
| 203 | USHORT NumberCleanerSlots;
|
---|
| 204 | USHORT NumberIEElements;
|
---|
| 205 | USHORT NumberDataTransferElements;
|
---|
| 206 | USHORT NumberOfDoors;
|
---|
| 207 | USHORT FirstSlotNumber;
|
---|
| 208 | USHORT FirstDriveNumber;
|
---|
| 209 | USHORT FirstTransportNumber;
|
---|
| 210 | USHORT FirstIEPortNumber;
|
---|
| 211 | USHORT FirstCleanerSlotAddress;
|
---|
| 212 | USHORT MagazineSize;
|
---|
| 213 | ULONG DriveCleanTimeout;
|
---|
| 214 | ULONG Features0;
|
---|
| 215 | ULONG Features1;
|
---|
| 216 | UCHAR MoveFromTransport;
|
---|
| 217 | UCHAR MoveFromSlot;
|
---|
| 218 | UCHAR MoveFromIePort;
|
---|
| 219 | UCHAR MoveFromDrive;
|
---|
| 220 | UCHAR ExchangeFromTransport;
|
---|
| 221 | UCHAR ExchangeFromSlot;
|
---|
| 222 | UCHAR ExchangeFromIePort;
|
---|
| 223 | UCHAR ExchangeFromDrive;
|
---|
| 224 | UCHAR LockUnlockCapabilities;
|
---|
| 225 | UCHAR PositionCapabilities;
|
---|
| 226 | UCHAR Reserved1[2];
|
---|
| 227 | ULONG Reserved2[2];
|
---|
| 228 | } GET_CHANGER_PARAMETERS, * PGET_CHANGER_PARAMETERS;
|
---|
| 229 |
|
---|
| 230 | typedef struct _CHANGER_PRODUCT_DATA {
|
---|
| 231 | UCHAR VendorId[VENDOR_ID_LENGTH];
|
---|
| 232 | UCHAR ProductId[PRODUCT_ID_LENGTH];
|
---|
| 233 | UCHAR Revision[REVISION_LENGTH];
|
---|
| 234 | UCHAR SerialNumber[SERIAL_NUMBER_LENGTH];
|
---|
| 235 | UCHAR DeviceType;
|
---|
| 236 | } CHANGER_PRODUCT_DATA, *PCHANGER_PRODUCT_DATA;
|
---|
| 237 |
|
---|
| 238 | typedef struct _CHANGER_SET_ACCESS {
|
---|
| 239 | CHANGER_ELEMENT Element;
|
---|
| 240 | ULONG Control;
|
---|
| 241 | } CHANGER_SET_ACCESS, *PCHANGER_SET_ACCESS;
|
---|
| 242 |
|
---|
| 243 | typedef struct _CHANGER_READ_ELEMENT_STATUS {
|
---|
| 244 | CHANGER_ELEMENT_LIST ElementList;
|
---|
| 245 | BOOLEAN VolumeTagInfo;
|
---|
| 246 | } CHANGER_READ_ELEMENT_STATUS, *PCHANGER_READ_ELEMENT_STATUS;
|
---|
| 247 |
|
---|
| 248 | typedef struct _CHANGER_ELEMENT_STATUS {
|
---|
| 249 | CHANGER_ELEMENT Element;
|
---|
| 250 | CHANGER_ELEMENT SrcElementAddress;
|
---|
| 251 | ULONG Flags;
|
---|
| 252 | ULONG ExceptionCode;
|
---|
| 253 | UCHAR TargetId;
|
---|
| 254 | UCHAR Lun;
|
---|
| 255 | USHORT Reserved;
|
---|
| 256 | UCHAR PrimaryVolumeID[MAX_VOLUME_ID_SIZE];
|
---|
| 257 | UCHAR AlternateVolumeID[MAX_VOLUME_ID_SIZE];
|
---|
| 258 | } CHANGER_ELEMENT_STATUS, *PCHANGER_ELEMENT_STATUS;
|
---|
| 259 |
|
---|
| 260 | typedef struct _CHANGER_ELEMENT_STATUS_EX {
|
---|
| 261 | CHANGER_ELEMENT Element;
|
---|
| 262 | CHANGER_ELEMENT SrcElementAddress;
|
---|
| 263 | ULONG Flags;
|
---|
| 264 | ULONG ExceptionCode;
|
---|
| 265 | UCHAR TargetId;
|
---|
| 266 | UCHAR Lun;
|
---|
| 267 | USHORT Reserved;
|
---|
| 268 | UCHAR PrimaryVolumeID[MAX_VOLUME_ID_SIZE];
|
---|
| 269 | UCHAR AlternateVolumeID[MAX_VOLUME_ID_SIZE];
|
---|
| 270 | UCHAR VendorIdentification[VENDOR_ID_LENGTH];
|
---|
| 271 | UCHAR ProductIdentification[PRODUCT_ID_LENGTH];
|
---|
| 272 | UCHAR SerialNumber[SERIAL_NUMBER_LENGTH];
|
---|
| 273 | } CHANGER_ELEMENT_STATUS_EX, *PCHANGER_ELEMENT_STATUS_EX;
|
---|
| 274 |
|
---|
| 275 | typedef struct _CHANGER_INITIALIZE_ELEMENT_STATUS {
|
---|
| 276 | CHANGER_ELEMENT_LIST ElementList;
|
---|
| 277 | BOOLEAN BarCodeScan;
|
---|
| 278 | } CHANGER_INITIALIZE_ELEMENT_STATUS, *PCHANGER_INITIALIZE_ELEMENT_STATUS;
|
---|
| 279 |
|
---|
| 280 | typedef struct _CHANGER_SET_POSITION {
|
---|
| 281 | CHANGER_ELEMENT Transport;
|
---|
| 282 | CHANGER_ELEMENT Destination;
|
---|
| 283 | BOOLEAN Flip;
|
---|
| 284 | } CHANGER_SET_POSITION, *PCHANGER_SET_POSITION;
|
---|
| 285 |
|
---|
| 286 | typedef struct _CHANGER_EXCHANGE_MEDIUM {
|
---|
| 287 | CHANGER_ELEMENT Transport;
|
---|
| 288 | CHANGER_ELEMENT Source;
|
---|
| 289 | CHANGER_ELEMENT Destination1;
|
---|
| 290 | CHANGER_ELEMENT Destination2;
|
---|
| 291 | BOOLEAN Flip1;
|
---|
| 292 | BOOLEAN Flip2;
|
---|
| 293 | } CHANGER_EXCHANGE_MEDIUM, *PCHANGER_EXCHANGE_MEDIUM;
|
---|
| 294 |
|
---|
| 295 | typedef struct _CHANGER_MOVE_MEDIUM {
|
---|
| 296 | CHANGER_ELEMENT Transport;
|
---|
| 297 | CHANGER_ELEMENT Source;
|
---|
| 298 | CHANGER_ELEMENT Destination;
|
---|
| 299 | BOOLEAN Flip;
|
---|
| 300 | } CHANGER_MOVE_MEDIUM, *PCHANGER_MOVE_MEDIUM;
|
---|
| 301 |
|
---|
| 302 | typedef struct _CHANGER_SEND_VOLUME_TAG_INFORMATION {
|
---|
| 303 | CHANGER_ELEMENT StartingElement;
|
---|
| 304 | ULONG ActionCode;
|
---|
| 305 | UCHAR VolumeIDTemplate[MAX_VOLUME_TEMPLATE_SIZE];
|
---|
| 306 | } CHANGER_SEND_VOLUME_TAG_INFORMATION, *PCHANGER_SEND_VOLUME_TAG_INFORMATION;
|
---|
| 307 |
|
---|
| 308 | typedef struct READ_ELEMENT_ADDRESS_INFO {
|
---|
| 309 | ULONG NumberOfElements;
|
---|
| 310 | CHANGER_ELEMENT_STATUS ElementStatus[1];
|
---|
| 311 | } READ_ELEMENT_ADDRESS_INFO, *PREAD_ELEMENT_ADDRESS_INFO;
|
---|
| 312 |
|
---|
| 313 | typedef enum _CHANGER_DEVICE_PROBLEM_TYPE {
|
---|
| 314 | DeviceProblemNone,
|
---|
| 315 | DeviceProblemHardware,
|
---|
| 316 | DeviceProblemCHMError,
|
---|
| 317 | DeviceProblemDoorOpen,
|
---|
| 318 | DeviceProblemCalibrationError,
|
---|
| 319 | DeviceProblemTargetFailure,
|
---|
| 320 | DeviceProblemCHMMoveError,
|
---|
| 321 | DeviceProblemCHMZeroError,
|
---|
| 322 | DeviceProblemCartridgeInsertError,
|
---|
| 323 | DeviceProblemPositionError,
|
---|
| 324 | DeviceProblemSensorError,
|
---|
| 325 | DeviceProblemCartridgeEjectError,
|
---|
| 326 | DeviceProblemGripperError,
|
---|
| 327 | DeviceProblemDriveError
|
---|
| 328 | } CHANGER_DEVICE_PROBLEM_TYPE, *PCHANGER_DEVICE_PROBLEM_TYPE;
|
---|
| 329 |
|
---|
| 330 | #ifdef __cplusplus
|
---|
| 331 | }
|
---|
| 332 | #endif
|
---|