home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 April / PCWorld_2008-04_cd.bin / temacd / devc++ / devcpp-4.9.9.2_setup.exe / ntddchgr.h < prev    next >
C/C++ Source or Header  |  2005-01-29  |  12KB  |  354 lines

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