home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / AutoPC / apcsdk10.exe / data1.cab / Emulation_Include_Files / cdioctl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-13  |  53.1 KB  |  1,361 lines

  1.  
  2. /***    CDIOCTL.H
  3.  *
  4.  *      WARNING: PLEASE READ AND UNDERSTAND THE IMPLEMENTATION WARNINGS !!!
  5.  *
  6.  *      This file contains the definitions for the CDROM IOCTL commands.
  7.  *      These commands are used to utilize and control the various
  8.  *      hardware features which are unique to CD-ROM drives.
  9.  *
  10.  *      WARNING: USE AT YOUR OWN RISK.
  11.  *
  12.  *      IMPLEMENTATION WARNINGS:
  13.  *          1) These interfaces are for use by VxD drivers only.
  14.  *              That is, the client of these interfaces must be a
  15.  *              VxD driver.
  16.  *
  17.  *          2) These interfaces are only used to communicate with
  18.  *              CD-ROM devices controlled by Protect-Mode CD-ROM
  19.  *              device drivers.
  20.  *
  21.  *          3) These interfaces are not functional for real-mode
  22.  *              CD-ROM drivers.
  23.  *
  24.  *          4) These interfaces are currently not supported via
  25.  *              Win32 APIs.
  26.  *
  27.  *          5) Several of these functions are empty placeholder
  28.  *              specifications with no working code to make them
  29.  *              actually work.
  30.  *
  31.  *             Those unimplemented functions are merely placeholder
  32.  *              specifications for features which may or may not be
  33.  *              implemented in the future.
  34.  *
  35.  *             For example, none of the the commands for controlling
  36.  *              the playback speed of the CD-ROM drive are actually
  37.  *              implemented.
  38.  *
  39.  *          6) Microsoft reserves all rights to these functions.
  40.  *              Microsoft reserves the right to add, alter or remove
  41.  *              the specification or implementation of any or all of
  42.  *              these functions at any time, without notice.
  43.  *
  44.  *          7) Microsoft makes no warranties with respect to the proper
  45.  *              or reliable functioning of any of the functions specified
  46.  *              herein.  Microsoft will not be held liable for any
  47.  *              circumstances arising from the use of these interfaces.
  48.  *
  49.  *
  50.  *      Microsoft Confidential
  51.  *      Copyright (c) Microsoft Corporation 1995
  52.  *      All Rights Reserved
  53.  *
  54.  *      Standards for Recording:
  55.  *          Redbook: ISO/IEC 908.
  56.  *              - Defines CD-Digital Audio
  57.  *          Yellowbook: ISO/IEC 10149
  58.  *              - Defines CD-ROM.
  59.  *              - CD-XA is an extension of the Yellowbook
  60.  *          Orangebook:
  61.  *              - Defines CD-MO and CD-WO recordable media technologies.
  62.  *
  63.  *          The RSTUVW subchannels are not defined by these standards.
  64.  *          Some common formats are CD+G and CD+MIDI.
  65.  *
  66.  *      Notes:
  67.  *        - CDROM_IOCTL_GET_VOLUME_SIZE replaced by CDROM_IOCTL_DISC_INFO
  68.  *        - CDROM_IOCTL_GET_SESSION_INFO replaced by CDROM_IOCTL_DISC_INFO
  69.  *        - Structures DWORD aligned
  70.  *        - Commands which take structures all given a reserved zero DWORD.
  71.  *
  72.  */
  73.  
  74.  
  75. /***    Definitions for CD-ROM Disk Addresses
  76.  *
  77.  *      Two standards are available for addressing the disk, known as
  78.  *      the Redbook (MSF) or the High Sierra Group (HSG) addresses.
  79.  *      Redbook addresses are given as Minute, Second, and Frame numbers.
  80.  *      HSG addresses are just logical block addresses, as an unsigned long.
  81.  *      The term "LBA", for "logical block address", is preferred over HSG.
  82.  *      The standard conversion formula between these two formats is
  83.  *      Sector = (((Minute*60) + Second)*75) + Frame;
  84.  */
  85.  
  86.  
  87. /***    The MSF_ADDR structure describes a disk address in Redbook format.
  88.  *      The Minute, Second, and Frame are given as binary numbers.
  89.  *      BEWARE: In some cases, the MSF is given as 3 pairs of BCD digits
  90.  *      on disk.   This format only specifies the binary number version.
  91.  */
  92.  
  93. typedef struct  MSF_ADDR { /* */
  94.     UCHAR   msf_Frame;
  95.     UCHAR   msf_Second;
  96.     UCHAR   msf_Minute;
  97.     UCHAR   msf_Filler;
  98. } MSF_ADDR, *PMSF_ADDR;
  99.  
  100.  
  101. /***    The LBA_ADDR typedef describes a disk address in HSG format.
  102.  */
  103.  
  104. typedef ULONG   LBA_ADDR;
  105.  
  106.  
  107. /***    The MSF_LBA union combines both Redbook and HSG formats
  108.  */
  109.  
  110. typedef union   MSF_LBA { /* */
  111.     MSF_ADDR    msf;
  112.     LBA_ADDR    lba;
  113. } MSF_LBA;
  114.  
  115.  
  116. /***    The Addressing Mode Indicator indicates whether LBA or MSF is used.
  117.  */
  118.  
  119. #define CDROM_ADDR_LBA  0
  120. #define CDROM_ADDR_MSF  1
  121.  
  122.  
  123. /***    The CDROM_ADDR structure is used to store addresses of either format.
  124.  */
  125.  
  126. typedef struct  CDROM_ADDR { /* */
  127.     ULONG   Mode;
  128.     MSF_LBA Address;
  129. } CDROM_ADDR, *PCDROM_ADDR;
  130.  
  131.  
  132. /***    CDROM_REGION
  133.  *
  134.  *      The CDROM_REGION structure is used to store addresses for
  135.  *      instructions that require a start and finish address.  The
  136.  *      mode of both addresses must be indicated by the mode flag.
  137.  */
  138.  
  139. typedef struct  CDROM_REGION { /* */
  140.     ULONG   Mode;
  141.     MSF_LBA StartAddr;
  142.     MSF_LBA EndAddr;
  143. } CDROM_REGION, *PCDROM_REGION;
  144.  
  145.  
  146. /***    These macros convert either format of CDROM address to the other.
  147.  *      They are written as expressions rather than functions to simplify
  148.  *      callers.  Converting LBA to MSF format is more difficult, and
  149.  *      requires a temporary variable of type MSF_ADDR.
  150.  */
  151.  
  152. #define CDROM_MSF_TO_LBA(pcdra)                 \
  153.     (((pcdra)-> Mode = CDROM_ADDR_LBA),         \
  154.      (((pcdra)-> Address.lba) = (LBA_ADDR) (       \
  155.        (((pcdra)-> Address.msf.msf_Minute) * 60 +  \
  156.         ((pcdra)-> Address.msf.msf_Second)) * 75 + \
  157.        ((pcdra)-> Address.msf.msf_Frame)) - 150))
  158.  
  159. #define CDROM_MSFCOMP_TO_LBA(min, sec, frame)   \
  160.     ((LBA_ADDR)((((min) * 60 + (sec)) * 75 + ((frame)) - 150)))
  161.        
  162. #define CDROM_LBA_TO_MSF(pcdra,msfTemp)                         \
  163.     (                                                           \
  164.         ((pcdra)-> Mode = CDROM_ADDR_MSF),                      \
  165.         (((pcdra)-> Address.lba) += 150),                       \
  166.         (msfTemp.msf_Frame  = (UCHAR)(((pcdra)-> Address.lba) % 75)),   \
  167.         (((pcdra)-> Address.lba) /= 75),                        \
  168.         (msfTemp.msf_Second = (UCHAR)(((pcdra)-> Address.lba) % 60)),   \
  169.         (((pcdra)-> Address.lba) /= 60),                        \
  170.         (msfTemp.msf_Minute = (UCHAR)(((pcdra)-> Address.lba))),        \
  171.         (msfTemp.msf_Filler = 0),                               \
  172.         ((pcdra)-> Address.msf.msf_Filler = msfTemp.msf_Filler),\
  173.         ((pcdra)-> Address.msf.msf_Minute = msfTemp.msf_Minute),\
  174.         ((pcdra)-> Address.msf.msf_Second = msfTemp.msf_Second),\
  175.         ((pcdra)-> Address.msf.msf_Frame  = msfTemp.msf_Frame)  \
  176.     )
  177.  
  178.  
  179. /***    These macros convert either format of CDROM address to the desired
  180.  *      format.  These are typically used on driver entry to simplify
  181.  *      the driver code so the driver can work with a consistent format.
  182.  */
  183.  
  184. #define CDROM_CDADDR_TO_LBA(pcdra)                                          \
  185.     (((pcdra)-> Mode == CDROM_ADDR_LBA) || CDROM_MSF_TO_LBA(pcdra))
  186.  
  187.  
  188. #define CDROM_CDADDR_TO_MSF(pcdra, msfTemp)                                 \
  189.     (((pcdra)-> Mode == CDROM_ADDR_MSF) || CDROM_LBA_TO_MSF(pcdra,msfTemp))
  190.  
  191.  
  192. /***    IOCTL Command Definitions
  193.  *      IOCTL Command Codes
  194.  *
  195.  *      CDROM_IOCTL_GET_VOLUME_SIZE replaced by CDROM_IOCTL_DISC_INFO
  196.  *      CDROM_IOCTL_GET_SESSION_INFO replaced by CDROM_IOCTL_DISC_INFO
  197.  */
  198.  
  199. #define CDROM_IOCTL_RESET_DRIVE         0xCD00  // Reset CD-ROM Drive
  200. #define CDROM_IOCTL_SEEK                0xCD01  // Seek the Read Head
  201. #define CDROM_IOCTL_GET_DEVICE_STATUS   0xCD02  // Get Device Status Info
  202. #define CDROM_IOCTL_GET_SECTOR_SIZE     0xCD03  // Get Current Sector Size
  203. #define CDROM_IOCTL_GET_HEAD_LOCATION   0xCD04  // Get Head Location
  204. #define CDROM_IOCTL_QCHAN_UPC           0xCD05  // Get Media Catalog Number
  205. #define CDROM_IOCTL_QCHAN_ISRC          0xCD06  // Get ISRC for Track
  206. #define CDROM_IOCTL_QCHAN_CURRENT_INFO  0xCD07  // Get Current Q Channel Info
  207. #define CDROM_IOCTL_GET_AUDIO_STATE     0xCD08  // Get Audio Pause State
  208. #define CDROM_IOCTL_GET_AUDIO_CHAN_CTRL 0XCD09  // Get Audio Volume Controls
  209. #define CDROM_IOCTL_SET_AUDIO_CHAN_CTRL 0xCD0A  // Set Audio Volume Controls
  210. #define CDROM_IOCTL_DISC_INFO           0XCD0B  // Get Disk Information
  211. #define CDROM_IOCTL_TRACK_INFO          0XCD0C  // Get Track Parameters
  212. #define CDROM_IOCTL_AUDIO_SUB_CHAN_INFO 0XCD0D  // Get P-W Subchannel Vector
  213. #define CDROM_IOCTL_AUDIO_PLAY          0XCD0E  // Play Audio Selection
  214. #define CDROM_IOCTL_AUDIO_STOP          0XCD0F  // Pause or Stop Audio Play
  215. #define CDROM_IOCTL_AUDIO_RESUME        0XCD10  // Resume Audio Play
  216. #define CDROM_IOCTL_SECTOR_INFO         0XCD11  // Get Sector Information
  217. #define CDROM_IOCTL_QUERY_SPEED         0XCD12  // Get Current Device Speed
  218. #define CDROM_IOCTL_QUERY_SPEED_CAPS    0XCD13  // Get Speed Capabilities
  219. #define CDROM_IOCTL_SET_SPEED           0XCD14  // Set New Device Speed
  220. #define CDROM_IOCTL_GENERIC             0XCD15  // Generic Vendor specific IOCTL
  221. #define CDROM_IOCTL_READ_DRIVE_INFO     0XCD16  // Reads driver specific info
  222. #define CDROM_IOCTL_READ_ERROR_STATS    0xCD17  // Reads error statistic info
  223.                                                 // specific to each IOCTL
  224. #define CDROM_IOCTL_WRITE_DRIVE_INFO    0XCD18  // Writes driver specific info
  225. #define CDROM_IOCTL_READ                0xCD19  // Read from disk
  226. #define CDROM_IOCTL_QUERY_IOCTL_FUNC    0xCF00  // Queries IOCTL support caps
  227.  
  228. #define CDROM_IOCTL_CHANGER_GET_NUM_SLOTS        0xCF10 // Get the number of slots in the cd changer
  229. #define CDROM_IOCTL_CHANGER_SELECT_SLOT            0xCF11 // Select a slot
  230. #define CDROM_IOCTL_CHANGER_GET_CURRENT_SLOT    0xCF12 // Get the current selected slot
  231. #define CDROM_IOCTL_CHANGER_GET_DISC_PRESENT_INFO     0xCF13 // Get Disc present info
  232.  
  233. /***    CDROM_IOCTL_RESET_DRIVE - Reset CD-ROM Drive
  234.  *
  235.  *      CDROM_IOCTL_RESET_DRIVE resets and reinitializes the CD-ROM drive.
  236.  *
  237.  *      ENTRY
  238.  *          Request Packet Address = NULL.
  239.  *
  240.  *      EXIT
  241.  *          Success
  242.  *              Returns NO_ERROR
  243.  *              The CD-ROM Drive is reset
  244.  *
  245.  *          Failure
  246.  *              Returns an extended error code.
  247.  *
  248.  */
  249.  
  250.  
  251. /***    CDROM_IOCTL_SEEK - Seek the Read Head
  252.  *
  253.  *      CDROM_IOCTL_SEEK relocates the CD-ROM read head to the
  254.  *      position passed in.
  255.  *
  256.  *      Control returns immediately to the caller without waiting for
  257.  *      the seek to be completed.
  258.  *
  259.  *      Further requests for disk activity will wait until the seek
  260.  *      operation is completed.
  261.  *
  262.  *      If the address is not within the range of the disk, a Seek Error
  263.  *      is returned immediately.
  264.  *
  265.  *      This function may be treated as advisory.  On devices which do
  266.  *      not support plain head seeks, CDROM_IOCTL_SEEK may return
  267.  *      success without acutally moving the read head.
  268.  *
  269.  *      ENTRY
  270.  *          IOCTL Packet format specified by CDROM_SEEK structure.
  271.  *          Reserved    - Reserved Zero
  272.  *          SeekAddr    - Set to sector number to locate the head at.
  273.  *                          This may be in a MSF or LBA format.
  274.  *
  275.  *      EXIT
  276.  *          Success
  277.  *              Returns NO_ERROR
  278.  *
  279.  *          Failure
  280.  *              Returns an extended error code.
  281.  *                  ERROR_UNKNOWN_COMMAND - The command is not supported
  282.  *                  ERROR_INVALID_PARAMETER - The sector number was invalid
  283.  *                  Other Extended Errors may also be returned
  284.  *
  285.  */
  286.  
  287. typedef struct  CDROM_SEEK { /* */
  288.     ULONG       Reserved;               // Reserved - must be zero
  289.     CDROM_ADDR  SeekAddr;               // Sector number to locate head at.
  290. } CDROM_SEEK, *PCDROM_SEEK;
  291.  
  292.  
  293. /***    CDROM_IOCTL_GET_DEVICE_STATUS - Get Device Status Info
  294.  *
  295.  *      CDROM_IOCTL_GET_DEVICE_STATUS returns the current status of the
  296.  *      CD-ROM drive.
  297.  *
  298.  *      This command can be issued at any time to get information about
  299.  *      the current settings on the drive.
  300.  *
  301.  *      ENTRY
  302.  *          IOCTL Packet format specified by CDROM_DEVSTAT structure.
  303.  *          Reserved - Reserved Zero
  304.  *          DeviceStatus - Don't care
  305.  *
  306.  *      EXIT
  307.  *          Success
  308.  *              Returns NO_ERROR
  309.  *              Bits of DeviceStatus set according to CDDEVSTAT definitions
  310.  *
  311.  *              Protect Mode Drivers must obey the following:
  312.  *                  The CDDEVSTAT_INTERLEAVE bit must be clear.
  313.  *                  The CDDEVSTAT_REDBOOK_TOO bit must be set.
  314.  *
  315.  *          Failure
  316.  *              Returns an extended error code.
  317.  *
  318.  *      DeviceStatus Bit Definitions
  319.  *      Bit     Definition
  320.  *      0       0 - Door Closed
  321.  *              1 - Door Open
  322.  *      1       0 - Door Locked
  323.  *              1 - Door Unlocked
  324.  *      2       0 - Supports Only Cooked Reading
  325.  *              1 - Supports Cooked and Raw Reading
  326.  *      3       0 - Read Only
  327.  *              1 - Read/Write
  328.  *      4       0 - Data Read Only
  329.  *              1 - Data Read and Plays Audio and/or Video Tracks
  330.  *      5       0 - No Interleaving Supported
  331.  *              1 - Supports ISO-9660 Interleaving Factors
  332.  *      6       0 - Reserved (Must Be Zero)
  333.  *      7       0 - No Prefetching Supported
  334.  *              1 - Supports Prefetching
  335.  *      8       0 - No Audio Channel Manipulation
  336.  *              1 - Supports Audio Channel Manipulation
  337.  *      9       0 - Supports HSG Addressing Mode
  338.  *              1 - Supports HSG and Redbook Addressing Modes
  339.  *      10      0 - Can Not Read Mode 2 Form 1 Sectors
  340.  *              1 - Can Read Mode 2 Form 1 Sectors
  341.  *      11      0 - Disk Present in Drive
  342.  *              1 - Disk Not Present in Drive
  343.  *      12      0 - Does Not Support R-W Subchannels
  344.  *              1 - Supports R-W Subchannels
  345.  *      13      0 - Drive Not Playing Audio
  346.  *              1 - Drive Playing Audio
  347.  *      14      0 - Drive Does Not Support Adjustable Drive Speeds
  348.  *              1 - Drive Supports Adjustable Drive Speeds
  349.  *      15      0 - Current Data Rate is Standard = 150K/sec
  350.  *              1 - Nonstandard Data Rate in Operation
  351.  *      16-31   Reserved
  352.  */
  353.  
  354. typedef struct  CDROM_DEVSTAT { /* */
  355.     ULONG       Reserved;               // Reserved - must be zero
  356.     ULONG       DeviceStatus;           // CD-ROM Device Status Indicator
  357. } CDROM_DEVSTAT, *PCDROM_DEVSTAT;
  358.  
  359.  
  360. #define CDDEVSTAT_DOOR_OPEN         0x00000001
  361. #define CDDEVSTAT_DOOR_UNLOCKED     0x00000002
  362. #define CDDEVSTAT_READ_RAW_TOO      0x00000004
  363. #define CDDEVSTAT_WRITE_TOO         0x00000008
  364. #define CDDEVSTAT_PLAY_AUDIO_TOO    0x00000010
  365. #define CDDEVSTAT_INTERLEAVE        0x00000020
  366. #define CDDEVSTAT_RESERVED_6        0x00000040
  367. #define CDDEVSTAT_PREFETCHING       0x00000080
  368. #define CDDEVSTAT_AUDIO_MANIPULATE  0x00000100
  369. #define CDDEVSTAT_REDBOOK_TOO       0x00000200
  370. #define CDDEVSTAT_CDXA              0x00000400
  371. #define CDDEVSTAT_NO_DISK_IN_DRIVE  0x00000800
  372. #define CDDEVSTAT_RW_CHANNELS_OK    0x00001000
  373. #define CDDEVSTAT_RESERVED_13       0x00002000
  374. #define CDDEVSTAT_PLAYING_AUDIO     0x00004000
  375. #define CDDEVSTAT_SPEED_ADJUSTABLE  0x00008000
  376. #define CDDEVSTAT_SPEED_NONSTANDARD 0x00010000
  377.  
  378.  
  379. /***    CDROM_IOCTL_GET_SECTOR_SIZE - Get Current Sector Size
  380.  *
  381.  *      CDROM_IOCTL_GET_SECTOR_SIZE returns the sector size of
  382.  *      a cooked or raw mode sector.
  383.  *
  384.  *      ENTRY
  385.  *          IOCTL Packet format specified by the CDROM_GETSECSIZE structure.
  386.  *          Reserved - Reserved Zero
  387.  *          ReadMode    - Set to desired read mode
  388.  *                          = CDROM_COOKED_MODE
  389.  *                          = CDROM_RAW_MODE
  390.  *
  391.  *          SectorSize  - Don't care
  392.  *
  393.  *      EXIT
  394.  *          Success
  395.  *              Returns NO_ERROR
  396.  *              ReadMode    - Unchanged
  397.  *              SectorSize  - Set to Sector Size Corresponding to Read Mode
  398.  *                  If ReadMode = CDROM_COOKED_MODE - SectorSize = 2048
  399.  *                  If ReadMode = CDROM_RAW_MODE    - SectorSize = 2352
  400.  *
  401.  *          Failure
  402.  *              Returns an extended error code.
  403.  *
  404.  */
  405.  
  406. typedef struct  CDROM_GETSECSIZE { /* */
  407.     ULONG       Reserved;               // Reserved - must be zero
  408.     ULONG       ReadMode;               // Cooked/Raw Read Mode Indicator
  409.     ULONG       SectorSize;             // Sector Size
  410. } CDROM_GETSECSIZE, *PCDROM_GETSECSIZE;
  411.  
  412. #define CDROM_COOKED_MODE   0
  413. #define CDROM_RAW_MODE      1
  414.  
  415.  
  416. /***    CDROM_IOCTL_GET_HEAD_LOCATION - Get Head Location
  417.  *
  418.  *      CDROM_IOCTL_GET_HEAD_LOCATION returns the address of the
  419.  *      current head position
  420.  *
  421.  *      ENTRY
  422.  *          IOCTL Packet format specified by CDROM_GETHEADLOC structure.
  423.  *          Reserved - Reserved Zero
  424.  *          HeadAddr.Mode set to desired addressing mode
  425.  *          HeadAddr.Address = Don't Care
  426.  *
  427.  *      EXIT
  428.  *          Success
  429.  *              Returns NO_ERROR
  430.  *              HeadAddr.Mode unchanged
  431.  *              HeadAddr.Address set to current head location using the
  432.  *              indicated addressing mode
  433.  *
  434.  *          Failure
  435.  *              Returns an extended error code.
  436.  *
  437.  */
  438.  
  439. typedef struct  CDROM_GETHEADLOC   { /* */
  440.     ULONG       Reserved;               // Reserved - must be zero
  441.     CDROM_ADDR  HeadAddr;               // Current CD-ROM Head Location
  442. } CDROM_GETHEADLOC, *PCDROM_GETHEADLOC;
  443.  
  444.  
  445. /***    CDROM_IOCTL_QCHAN_UPC - Get Media Catalog Number
  446.  *
  447.  *      CDROM_IOCTL_QCHAN_UPC returns the Media Catalog Number for
  448.  *      the disk.  The Media Catalog number is the UPC/EAN number
  449.  *      for the disk.
  450.  *
  451.  *      This information is stored as a q-mode-2 (ADR=2) Q-channel entry,
  452.  *      as defined by the Yellowbook.
  453.  *
  454.  *      The UPC Code is returned as follows:
  455.  *          - Q-Control recorded in nibble 0
  456.  *          - ADR Mode recorded in nibble 1.  Set to 2.
  457.  *          - 13 digits recorded in nibbles 2-14, in BCD notation
  458.  *          - Zero recorded in nibbles 15-17
  459.  *          - A-FRAC field recorded in nibbles 18 and 19
  460.  *
  461.  *      If the Control/ADR byte is zero or if the 13 digits of the UPC
  462.  *      code are all zero, then no catalog number was encoded on the disc.
  463.  *
  464.  *      The two synchronization bits are not included.  The trailing
  465.  *      16 CRC bits are returned as zero.
  466.  *
  467.  *      ENTRY
  468.  *          IOCTL Packet format specified by CDROM_GETUPC structure.
  469.  *          Reserved - Reserved Zero
  470.  *          The CDROM_GETUPC packet contains no input parameters.
  471.  *
  472.  *      EXIT
  473.  *          Success
  474.  *              Returns NO_ERROR
  475.  *              All CDROM_GETUPC packet parameters filled in.
  476.  *
  477.  *              The returned Q-channel information is as defined in the
  478.  *              standards for recording.  The 2 leading synchronization
  479.  *              bits are not included in the Q-channel information.
  480.  *
  481.  *              The CRC bytes (the last 2 bytes) are zero, as the CRC
  482.  *              has already been applied in the hardware.
  483.  *
  484.  *          Failure
  485.  *              Returns an extended error code.
  486.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  487.  *              Other Extended Errors may also be returned
  488.  *
  489.  */
  490.  
  491. typedef struct  CDROM_GETUPC   { /* */
  492.     ULONG       Reserved;               // Reserved - must be zero
  493.     UCHAR       QChan[12];              // Q-channel UPC information
  494. } CDROM_GETUPC, *PCDROM_GETUPC;
  495.  
  496.  
  497. /***    CDROM_IOCTL_QCHAN_ISRC - Get ISRC for a Track
  498.  *
  499.  *      CDROM_IOCTL_QCHAN_ISRC retrieves the ISRC for a track.
  500.  *
  501.  *      The ISRC gives a unique number to an audio track.  It gives
  502.  *      information such as the country, owner, year of recording, and
  503.  *      the serial number of the recording.  This information is stored
  504.  *      as a q-mode-3 (ADR=3) Q-channel entry, as defined by the Redbook.
  505.  *
  506.  *      The Q-channel ISRC information will not necessarily be available
  507.  *      on the disk.  If it is not available, the Q-channel ISRC
  508.  *      information will be returned as all zeros.
  509.  *
  510.  *      The two synchronization bits are not included.  The trailing
  511.  *      16 CRC bits are returned as zero.
  512.  *
  513.  *      ENTRY
  514.  *          IOCTL Packet format specified by CDROM_GETISRC structure.
  515.  *          Reserved - Reserved Zero
  516.  *          Track   - Set to track number of the desired ISRC.
  517.  *
  518.  *      EXIT
  519.  *          Success
  520.  *              Returns NO_ERROR
  521.  *              Track number unchanged
  522.  *              Remainder of CDROM_GETISRC structure filled in
  523.  *
  524.  *              The returned Q-channel information is as defined in the
  525.  *              standards for recording.  The 2 leading synchronization
  526.  *              bits are not included in the Q-channel information.
  527.  *
  528.  *              The CRC bytes (the last 2 bytes) are zero, as the CRC
  529.  *              has already been applied in the hardware.
  530.  *
  531.  *          Failure
  532.  *              Returns an extended error code.
  533.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  534.  *              Other Extended Errors may also be returned
  535.  */
  536.  
  537. typedef struct  CDROM_GETISRC  { /* */
  538.     ULONG       Reserved;               // Reserved - must be zero
  539.     ULONG       Track;                  // Desired Track Number
  540.     UCHAR       ISRC_QChan[12];         // Q-channel ISRC information
  541. } CDROM_GETISRC, *PCDROM_GETISRC;
  542.  
  543.  
  544. /***    CDROM_IOCTL_QCHAN_CURRENT_INFO - Get Current Q Channel Info
  545.  *
  546.  *      CDROM_IOCTL_QCHAN_CURRENT_INFO returns information about the
  547.  *      current position of the media being played.
  548.  *
  549.  *      This function returns the most up-to-date Q-channel address
  550.  *      information available.  The current status of the drive must
  551.  *      not be altered as a result of this operation.  Its intended
  552.  *      purpose is to monitor the location of the read head while
  553.  *      playing audio tracks.
  554.  *
  555.  *      This function should return valid information even when no
  556.  *      audio tracks are playing and the head is stationary.  The
  557.  *      addresses are returned in the Redbook format with binary values.
  558.  *      The track number and Index number are returned as BCD values.
  559.  *
  560.  *      Consult the standards for recording for the format of the
  561.  *      Q-channel frames.
  562.  *
  563.  *      The two synchronization bits are not included.  The trailing
  564.  *      16 CRC bits are returned as zero.
  565.  *
  566.  *      ENTRY
  567.  *          IOCTL Packet format specified by CDROM_GETQINFO structure.
  568.  *          Reserved - Reserved Zero
  569.  *          CDROM_GETQINFO contents = don't care
  570.  *
  571.  *      EXIT
  572.  *          Success
  573.  *              Returns NO_ERROR
  574.  *              CDROM_GETQINFO structure filled in for current address
  575.  *
  576.  *              The returned Q-channel information is as defined in the
  577.  *              standards for recording.  The 2 leading synchronization
  578.  *              bits are not included in the Q-channel information.
  579.  *
  580.  *              The CRC bytes (the last 2 bytes) are zero, as the CRC
  581.  *              has already been applied in the hardware.
  582.  *
  583.  *          Failure
  584.  *              Returns an extended error code.
  585.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  586.  *              Other Extended Errors may also be returned
  587.  *
  588.  */
  589.  
  590. typedef struct  CDROM_GETQINFO { /* */
  591.     ULONG       Reserved;               // Reserved - must be zero
  592.     UCHAR       QChan[12];              // Q-channel information
  593. } CDROM_GETQINFO, *PCDROM_GETQINFO;
  594.  
  595.  
  596. /***    CDROM_IOCTL_GET_AUDIO_STATE - Get Audio Pause State
  597.  *
  598.  *      CDROM_IOCTL_GET_AUDIO_STATE returns inforation about the current
  599.  *      audio state.
  600.  *
  601.  *      This function returns information about whether audio is playing
  602.  *      or paused on the drive.
  603.  *
  604.  *      If the audio is paused, the Redbook starting and ending addresses
  605.  *      for the resume audio operation are returned.
  606.  *
  607.  *      ENTRY
  608.  *          IOCTL Packet format specified by CDROM_AUDSTATE structure.
  609.  *          Reserved - Reserved Zero
  610.  *          CDROM_AUDSTATE contents = don't care
  611.  *
  612.  *      EXIT
  613.  *          Success
  614.  *              Returns NO_ERROR
  615.  *              CDROM_AUDSTATE structure filled in
  616.  *              Bits of AudioFlags set according to CDAUDSTAT definitions
  617.  *
  618.  *          Failure
  619.  *              Returns an extended error code.
  620.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  621.  *              Other Extended Errors may also be returned
  622.  *
  623.  *      AudioFlags Bit Definitions
  624.  *
  625.  *      Bit     Definition
  626.  *      0       0 - Audio is not paused
  627.  *              1 - Audio is paused
  628.  *      1       0 - Audio play request is in progress
  629.  *              1 - There are no play requests in progress
  630.  *      1-15    Reserved (must be zero)
  631.  *
  632.  */
  633.  
  634. typedef struct  CDROM_AUDSTATE { /* */
  635.     ULONG       Reserved;               // Reserved - must be zero
  636.     ULONG       AudioFlags;             // Audio Pause Flags
  637.     MSF_ADDR    StartAddress;           // Starting Address for Audio Resume
  638.     MSF_ADDR    EndAddress;             // Ending Address for Audio Resume
  639. } CDROM_AUDSTATE, *PCDROM_AUDSTATE;
  640.  
  641. #define CDAUDSTAT_PAUSED    0x0001
  642. #define CDAUDSTAT_PLAYING   0x0002
  643.  
  644.  
  645. /***    CDROM_IOCTL_GET_AUDIO_CHAN_CTRL - Get Audio Volume Controls
  646.  *
  647.  *      This function returns the current settins on audio channels.
  648.  *
  649.  *      The default settins are for each output channel to play from
  650.  *      its corresponding input channel, and the volume control to
  651.  *      be set to 0xFF for all channels.
  652.  *
  653.  *      ENTRY
  654.  *          IOCTL Packet format specified by CDROM_AUDCTRL structure.
  655.  *          CDROM_AUDCTRL contents = don't care
  656.  *
  657.  *      EXIT
  658.  *          Success
  659.  *              Returns NO_ERROR
  660.  *              CDROM_AUDCTRL structure filled in
  661.  *
  662.  *          Failure
  663.  *              Returns an extended error code.
  664.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  665.  *              Other Extended Errors may also be returned
  666.  *
  667.  */
  668.  
  669. typedef struct  CDROM_AUDCTRL  { /* */
  670.     ULONG       Reserved;               // Reserved - must be zero
  671.     UCHAR       AudioCh0Input;          // Input channel for output channel 0
  672.     UCHAR       AudioCh0Volume;         // Volume control for output channel 0
  673.     UCHAR       AudioCh1Input;          // Input channel for output channel 1
  674.     UCHAR       AudioCh1Volume;         // Volume control for output channel 1
  675.     UCHAR       AudioCh2Input;          // Input channel for output channel 2
  676.     UCHAR       AudioCh2Volume;         // Volume control for output channel 2
  677.     UCHAR       AudioCh3Input;          // Input channel for output channel 3
  678.     UCHAR       AudioCh3Volume;         // Volume control for output channel 3
  679. } CDROM_AUDCTRL, *PCDROM_AUDCTRL;
  680.  
  681.  
  682. /***    CDROM_IOCTL_SET_AUDIO_CHAN_CTRL - Set Audio Volume Controls
  683.  *
  684.  *      This function is intended to provide playback control of audio
  685.  *      information on the disk.  It allows input channels on the CD-ROM
  686.  *      drive to be assigned to specific output speaker connections.
  687.  *
  688.  *      The purpose of this function is to allow two independent
  689.  *      channels to be recorded and to manipulate an audio signal so
  690.  *      that the source appears to move.
  691.  *
  692.  *      Output channel 0 is the left channel.
  693.  *      Output channel 1 is the right channel.
  694.  *      Output channel 2 is the left prime channel.
  695.  *      Output channel 3 is the right prime channel.
  696.  *
  697.  *      The two prime channels extend stereo to quadrophonic stereo.
  698.  *
  699.  *      A volume setting of 0 means off.  Drives that do not support
  700.  *      variable audio control will treat a setting of 0 as off and
  701.  *      nonzero as on.  Drives that support less than 256 settings will
  702.  *      break up the 256 settings among settings they can support.
  703.  *
  704.  *      The channels may be cross-mapped by altering the input
  705.  *      channel (0, 1, 2, or 3) for each output channel for special
  706.  *      effects.
  707.  *
  708.  *      ENTRY
  709.  *          IOCTL Packet format specified by CDROM_AUDCTRL structure, above.
  710.  *          Reserved - Reserved Zero
  711.  *          CDROM_AUDCTRL contents set up for all 4 channels.
  712.  *
  713.  *      EXIT
  714.  *          Success
  715.  *              Returns NO_ERROR
  716.  *              CDROM_AUDCTRL structure unchanged
  717.  *
  718.  *          Failure
  719.  *              Returns an extended error code.
  720.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  721.  *              Other Extended Errors may also be returned
  722.  */
  723.  
  724.  
  725. /***    CDROM_IOCTL_DISC_INFO - Get Disk Information
  726.  *
  727.  *      This function returns the TOC (table of contents) information
  728.  *      from the Q-channel in the lead-in track of the disc, which
  729.  *      indicates the starting and ending tracks and the start of
  730.  *      the lead-out track.
  731.  *
  732.  *      The first and last track number are binary values, not BCD.
  733.  *
  734.  *      It is recommended that the information from the TOC be read
  735.  *      in and cached on drive initialization so that when this function
  736.  *      is called, there is not need to interrupt drive play to get this
  737.  *      information.  Note that the first and last track numbers do not
  738.  *      include the lead-in and lead-out tracks of the session.
  739.  *
  740.  *      The SessionIndex is used to get TOC information from disks
  741.  *      with more than one recorded session.  Sessions are the same
  742.  *      as OrangeBook Volumes.  The first session has a SessionIndex
  743.  *      of zero, and the second session has a SessionIndex of one.
  744.  * A SessionIndex of DISC_INFO_LAST_SESSION (-1) requests the disc
  745.  * info for the last session recorded on the disc.
  746.  *
  747.  *      The LogicStartAddr is the logical sector address of the first
  748.  *      data sector of the first track in this session.
  749.  *
  750.  *      For standard Redbook and Yellowbook CD-ROMs, zero (0) is the
  751.  *      only valid SessionIndex value.  In this case, LogicStartAddr
  752.  *      should be returned as zero (0).
  753.  *
  754.  *      Note: The LogicStartAddr is normally used to locate the first
  755.  *      sector of the Volume Recognition Sequence for the indicated
  756.  *      session. The Volume Recognition Sequence for the session is
  757.  *      expected to start at Sector (LogicStartAddr + 16).
  758.  *
  759.  *      ENTRY
  760.  *          IOCTL Packet format specified by CDROM_DISCINFO structure.
  761.  *          Reserved - Reserved Zero
  762.  *          SessionIndex - Set to desired session number to query.
  763.  *              SessionIndex = 0 indicates a query for the first session
  764.  *              SessionIndex = 0xFFFFFFFF indicates a query for the last
  765.  *                  session on the disk
  766.  *
  767.  *      EXIT
  768.  *          Success
  769.  *              Returns NO_ERROR
  770.  *              CDROM_DISCINFO structure filled in for indicated session
  771.  *
  772.  *              If SessionIndex was passed in as 0xFFFFFFFF, it may be
  773.  *              modified to contain the index of the last session on the
  774.  *              disk.  Because not all device drivers must scan through
  775.  *              all the sessions on the disk, this update may or may not
  776.  *              actually take place.
  777.  *
  778.  *          Failure
  779.  *              Returns an extended error code.
  780.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  781.  *              ERROR_INVALID_PARAMETER - The session number is invalid
  782.  *                ERROR_CD_NOT_PRESENT - No disc in the drive
  783.  *                ERROR_CD_NOT_READABLE - Can't read the disc in the drive
  784.  *                ERROR_CD_DOOR_OPEN - The door to the CDDRIVE is open
  785.  *              Other Extended Errors may also be returned
  786.  */
  787.  
  788. typedef struct  CDROM_DISCINFO { /* */
  789.     ULONG       Reserved;               // Reserved - must be zero
  790.     ULONG       FirstTrack;             // First Track of Session
  791.     ULONG       LastTrack;              // Last Track of Session
  792.     MSF_ADDR    LeadOutTrackAddr;       // Address of Lead-out Track of Session
  793.     UCHAR       FirstSession;
  794.     UCHAR       LastSession;
  795.     UCHAR       ReqSession;
  796.     UCHAR       RetSession;
  797.     ULONG       LogicStartAddr;         // Session Logical Start Acdress
  798. } CDROM_DISCINFO, *PCDROM_DISCINFO;
  799.  
  800. #define            ERROR_CD_NOT_PRESENT 0x8010
  801. #define            ERROR_CD_NOT_READABLE 0x8011 
  802. #define            ERROR_CD_DOOR_OPEN  0x8012
  803. #define DISC_INFO_LAST_SESSION 0xFF
  804.  
  805. /***    CDROM_IOCTL_TRACK_INFO - Get Track Parameters
  806.  *
  807.  *      This function takes a binary track number in the range
  808.  *      specified by the first and last track number for the disk
  809.  *      and returns the Redbook address for the starting point of
  810.  *      the track and control information for the track.  The control
  811.  *      information is contained in the 4 most significant bits of the
  812.  *      control information byte.  The definitions of the bit fields
  813.  *      are given below.
  814.  *
  815.  *      It is recommended that the information from the TOC be read
  816.  *      in and cached on drive initialization so that when this function
  817.  *      is called, there is not need to interrupt drive play to get this
  818.  *      information.
  819.  *
  820.  *      ENTRY
  821.  *          IOCTL Packet format specified by CDROM_TRACKINFO structure.
  822.  *          Reserved - Reserved Zero
  823.  *          TrackNumber - Set to desired track number to query.
  824.  *
  825.  *      EXIT
  826.  *          Success
  827.  *              Returns NO_ERROR
  828.  *              CDROM_TRACKINFO structure filled in for indicated track
  829.  *
  830.  *          Failure
  831.  *              Returns an extended error code.
  832.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  833.  *              ERROR_INVALID_PARAMETER - The track number is invalid
  834.  *              Other Extended Errors may also be returned
  835.  *
  836.  *      TrackControl Bit Definitions
  837.  *
  838.  *      Bit     Definition
  839.  *      0-3     ADR information
  840.  *      4       0 - No preemphasis on audio channels
  841.  *              1 - Preemphasis on audio channels
  842.  *      5       0 - Digital copy prohibited
  843.  *              1 - Digital copy allowed
  844.  *      6       0 - Audio Track
  845.  *              1 - Data Track
  846.  *      7       0 - 2 Audio channels
  847.  *              1 - 4 Audio channels
  848.  */
  849.  
  850. typedef struct  CDROM_TRACKINFO    { /* */
  851.     ULONG       Reserved;               // Reserved - must be zero
  852.     ULONG       TrackNumber;            // Desired Track Number
  853.     MSF_ADDR    TrackAddr;              // Track Starting Address
  854.     ULONG       TrackControl;           // Track Control Flags (CDTRACK_)
  855. } CDROM_TRACKINFO, *PCDROM_TRACKINFO;
  856.  
  857. #define CDTRACK_ADRMASK     0x0F        // ADR Information
  858. #define CDTRACK_PREEMPHASIS 0x10        // Audio Preemphasis Indicator
  859. #define CDTRACK_COPYOK      0x20        // Digital Copy Allowed
  860. #define CDTRACK_DATA        0x40        // Data Track
  861. #define CDTRACK_4CHANNEL    0x80        // 4 Audio Channels
  862.  
  863.  
  864. /***    CDROM_IOCTL_AUDIO_SUB_CHAN_INFO - Get P-W Subchannel Vector
  865.  *
  866.  *      CDROM_IOCTL_AUDIO_SUB_CHAN_INFO retrieves the subchannel data
  867.  *      from the indicated sectors.  If multiple sectors are requested,
  868.  *      the data is copied sequentially.
  869.  *
  870.  *      Each sector contains 96 bytes of subchannle information.  These
  871.  *      bytes do not include the two sync patterns that head a subcoding
  872.  *      block.
  873.  *
  874.  *      Each byte contains 1 bit of information from each of the eight
  875.  *      different subcoding channels.  In this byte, the two most
  876.  *      significant bits (representing channels P and Q) are undefined.
  877.  *
  878.  *      For the subchannel data to be useful, it must be provided during
  879.  *      an AUDIO PLAY operation without interrupting it.  Therefore, when
  880.  *      the requested sectors lie within the current play request, they
  881.  *      must be provided in real-time.  This requires buffering for at
  882.  *      least 1 sector of sub-channel information.  It is recommended
  883.  *      that at least 32 sectors be buffered to give an application time
  884.  *      to process the subchannel data between requests.
  885.  *
  886.  *      Implementation of this command is optional.  An UNKNOWN_COMMAND
  887.  *      error will be returned if this command is not supported by the
  888.  *      driver.
  889.  *
  890.  *      ENTRY
  891.  *          IOCTL Packet format specified by CDROM_SUBINFO structure.
  892.  *          Reserved    - Reserved Zero
  893.  *          StartAddr   - Set to desired starting starting sector number
  894.  *          FrameCount  - Set to desired number of subchannel frames to read
  895.  *          SubChanBuffer - Address of subchannel buffer to fill in
  896.  *          ValidChannels - don't care
  897.  *
  898.  *          The size of the SubChanBuffer is 96*FrameCount bytes.
  899.  *
  900.  *      EXIT
  901.  *          Success
  902.  *              Returns NO_ERROR
  903.  *              StartAddr, FrameCount, SubChanBuffer fields unchanged
  904.  *              ValidChannels - Set to indicate which subchannels are
  905.  *                  were returned as valid through the SubChanBuffer.
  906.  *
  907.  *                      ValidChannels Bit Definition
  908.  *                      0   0 - W Channel bits Invalid
  909.  *                          1 - W Channel bits Valid
  910.  *                      1   0 - V Channel bits Invalid
  911.  *                          1 - V Channel bits Valid
  912.  *                      2   0 - U Channel bits Invalid
  913.  *                          1 - U Channel bits Valid
  914.  *                      3   0 - T Channel bits Invalid
  915.  *                          1 - T Channel bits Valid
  916.  *                      4   0 - S Channel bits Invalid
  917.  *                          1 - S Channel bits Valid
  918.  *                      5   0 - R Channel bits Invalid
  919.  *                          1 - R Channel bits Valid
  920.  *                      6   0 - Q Channel bits Invalid
  921.  *                          1 - Q Channel bits Valid
  922.  *                      7   0 - P Channel bits Invalid
  923.  *                          1 - P Channel bits Valid
  924.  *
  925.  *              SubChanBuffer filled in.
  926.  *
  927.  *              Each of the returned subchannel frames in the SubChanBuffer
  928.  *              is 96 bytes in length.  This does not include the two sync
  929.  *              patterns that head a subcoding block.
  930.  *
  931.  *              Each byte in the returned SubChanBuffer contains a single
  932.  *              bit from each of the PQRSTUVW subchannels.  The most
  933.  *              significant bit (Bit 7) represents channel P, and the
  934.  *              least significant bit (Bit 0) represents channel W.
  935.  *
  936.  *          Failure
  937.  *              Returns an extended error code.
  938.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  939.  *              ERROR_INVALID_PARAMETER - The indicated sectors are not valid
  940.  *              Other Extended Errors may also be returned
  941.  *
  942.  */
  943.  
  944. typedef struct  CDROM_SUBINFO  { /* */
  945.     ULONG       Reserved;               // Reserved - must be zero
  946.     MSF_ADDR    StartAddr;              // Starting Subchannel Info Address
  947.     ULONG       FrameCount;             // Number of Subchannel Frames
  948.     PVOID       SubChanBuffer;          // Subchannel Buffer Pointer
  949.     UCHAR       ValidChannels;          // Valid Channels bit mask
  950.     UCHAR       Filler[3];              // Alignment filler
  951. } CDROM_SUBINFO, *PCDROM_SUBINFO;
  952.  
  953.  
  954. /***    CDROM_IOCTL_AUDIO_PLAY - Play Audio Selection
  955.  *
  956.  *      CDROM_IOCTL_AUDIO_PLAY will cause the driver to play the selected
  957.  *      audio tracks until the requested sectors have been exhausted or
  958.  *      until the play is interrupted by a CDROM_IOCTL_AUDIO_STOP request.
  959.  *
  960.  *      Control returns immediately to the caller after the command is
  961.  *      received.  The paused bit and the starting and ending play
  962.  *      addresses in the CDROM_IOCTL_GET_AUDIO_STATE function will also
  963.  *      be updated by this call.
  964.  *
  965.  *      The bit in the device status will also be set indicating that an
  966.  *      audio play operation is in progress on this drive.
  967.  *
  968.  *      If the drive does not support playing Audio, ERROR_UNKNOWN_COMMAND
  969.  *      will be returned.
  970.  *
  971.  *      If the starting or ending addresses are outside the range of
  972.  *      tracks that can be played, ERROR_INVALID_PARAMETER will be returned.
  973.  *
  974.  *      ENTRY
  975.  *          IOCTL Packet format specified by CDROM_AUDPLAY structure.
  976.  *          Reserved        - Reserved Zero
  977.  *          PlayRegion      - Start/stop addresses for play
  978.  *          PlayFlags       - Reserved, must be zero
  979.  *
  980.  *      EXIT
  981.  *          Success
  982.  *              Returns NO_ERROR
  983.  *              CDROM_AUDPLAY structure filled in for indicated track
  984.  *
  985.  *          Failure
  986.  *              Returns an extended error code.
  987.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  988.  *              ERROR_INVALID_PARAMETER - The selected addresses are invalid
  989.  *                  for audio play.
  990.  *              Other Extended Errors may also be returned.
  991.  *
  992.  */
  993.  
  994. typedef struct  CDROM_AUDPLAY  { /* */
  995.     ULONG       Reserved;               // Reserved - must be zero
  996.     CDROM_REGION PlayRegion;            // Start/end play addresses
  997.     ULONG       PlayFlags;              // Reserved - must be zero
  998. } CDROM_AUDPLAY, *PCDROM_AUDPLAY;
  999.  
  1000.  
  1001. /***    CDROM_IOCTL_AUDIO_STOP - Pause or Stop Audio Play
  1002.  *
  1003.  *      CDROM_IOCTL_AUDIO_STOP either pauses or stops the drive unit.
  1004.  *
  1005.  *      If the drive unit is in play mode, the function pauses the
  1006.  *      drive unit and updates starting and ending addresses for the
  1007.  *      CDROM_IOCTL_AUDIO_RESUME function.
  1008.  *
  1009.  *      If the drive unit is in paused mode, the function resets the
  1010.  *      starting and ending addresses for the CDROM_IOCTL_AUDIO_RESUME
  1011.  *      function.
  1012.  *
  1013.  *      The CDAUDSTAT_PAUSED bit returned by CDROM_IOCTL_GET_AUDIO_STATE
  1014.  *      function will be set.  The CDDEVSTAT_PLAYING_AUDIO bit returned
  1015.  *      by the CDROM_IOCTL_GET_DEVICE_STATUS function will be cleared.
  1016.  *
  1017.  *      ENTRY
  1018.  *          Request Packet Address = NULL.
  1019.  *
  1020.  *      EXIT
  1021.  *          Success
  1022.  *              Returns NO_ERROR
  1023.  *
  1024.  *          Failure
  1025.  *              Returns an extended error code.
  1026.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  1027.  *              Other Extended Errors may also be returned.
  1028.  *
  1029.  */
  1030.  
  1031.  
  1032. /***    CDROM_IOCTL_AUDIO_RESUME - Resume Audio Play
  1033.  *
  1034.  *      CDROM_IOCTL_AUDIO_RESUME causes the drive to resume play from
  1035.  *      where it was previously stopped.
  1036.  *
  1037.  *      The drive unit will resume playing from the starting address
  1038.  *      indicated by the CDROM_IOCTL_GET_AUDIO_STATE function.
  1039.  *
  1040.  *      The CDAUDSTAT_PAUSED bit returned by CDROM_IOCTL_GET_AUDIO_STATE
  1041.  *      function will be cleared.  The CDDEVSTAT_PLAYING_AUDIO bit returned
  1042.  *      by the CDROM_IOCTL_GET_DEVICE_STATUS function will be set.
  1043.  *
  1044.  *      ENTRY
  1045.  *          Request Packet Address = NULL.
  1046.  *
  1047.  *      EXIT
  1048.  *          Success
  1049.  *              Returns NO_ERROR
  1050.  *
  1051.  *          Failure
  1052.  *              Returns an extended error code.
  1053.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  1054.  *              Other Extended Errors may also be returned.
  1055.  *
  1056.  */
  1057.  
  1058.  
  1059. /***    CDROM_IOCTL_SECTOR_INFO - Get Sector Information
  1060.  *
  1061.  *      CDROM_IOCTL_SECTOR_INFO indicates recording information
  1062.  *      about the sector.
  1063.  *
  1064.  *      ENTRY
  1065.  *          IOCTL Packet format specified by CDROM_SECINFO structure.
  1066.  *          Reserved - Reserved Zero
  1067.  *          SectorAddr - Set to the address of the sector to query
  1068.  *          SectorState = don't care
  1069.  *
  1070.  *      EXIT
  1071.  *          Success
  1072.  *              Returns NO_ERROR
  1073.  *              SectorAddr unchanged
  1074.  *              Bits of SectorState set according to CDSECINFO definitions
  1075.  *
  1076.  *              Bit     Definition
  1077.  *              0       0 - Sector is recorded
  1078.  *                      1 - Sector is not recorded
  1079.  *              1-7     Reserved (must be zero)
  1080.  *
  1081.  *          Failure
  1082.  *              Returns an extended error code.
  1083.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  1084.  *              ERROR_INVALID_PARAMETER - The sector number is invalid
  1085.  *              Other Extended Errors may also be returned
  1086.  *
  1087.  */
  1088.  
  1089. typedef struct  CDROM_SECINFO  { /* */
  1090.     ULONG       Reserved;               // Reserved - must be zero
  1091.     CDROM_ADDR  SectorAddr;             // Sector Address to Query
  1092.     ULONG       SectorState;            // Sector Recording State
  1093. } CDROM_SECINFO, *PCDROM_SECINFO;
  1094.  
  1095. #define CDSECINFO_UNRECORDED    0x01
  1096.  
  1097.  
  1098. /***    CDROM_IOCTL_QUERY_SPEED - Get Current Device Speed
  1099.  *
  1100.  *      CDROM_IOCTL_QUERY_SPEED determines the current device speed
  1101.  *      for the drive.
  1102.  *
  1103.  *      This is meant to be an approximation.  For devices which do not
  1104.  *      support variable device speeds, or tend to have speeds which
  1105.  *      vary over time, a best-guess at the speed should be made.
  1106.  *      The standard data transfer rate for CD-ROMs is 150 kilobytes
  1107.  *      per second, which is a common best-guess.
  1108.  *
  1109.  *      (For the purposes of this command, devices should assume they
  1110.  *      are reading Mode 1 or Mode 2 Form 1 sectors, of 2048 bytes each.)
  1111.  *
  1112.  *      ENTRY
  1113.  *          IOCTL Packet format specified by CDROM_SPEED structure.
  1114.  *          Reserved - Reserved Zero
  1115.  *          CurrentDeviceSpeed = don't care
  1116.  *
  1117.  *      EXIT
  1118.  *          Success
  1119.  *              Returns NO_ERROR
  1120.  *              CDROM_SPEED structure filled in
  1121.  *              DevSpeed is set to the current data transfer rate for
  1122.  *                  the CD-ROM device, in kilobytes/second.
  1123.  *
  1124.  *          Failure
  1125.  *              Returns an extended error code.
  1126.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  1127.  *              ERROR_INVALID_PARAMETER - The sector number is invalid
  1128.  *              Other Extended Errors may also be returned
  1129.  *
  1130.  */
  1131.  
  1132. typedef struct  CDROM_SPEED { /* */
  1133.     ULONG       Reserved;               // Reserved - must be zero
  1134.     ULONG       DevSpeed;               // Current Device Speed
  1135. } CDROM_SPEED, *PCDROM_SPEED;
  1136.  
  1137.  
  1138. /***    CDROM_IOCTL_QUERY_SPEED_CAPS - Get Speed Capabilities
  1139.  *
  1140.  *      CDROM_IOCTL_QUERY_SPEED_CAPS determines the device speed
  1141.  *      capabilities for the drive which best fits the device speed
  1142.  *      which is desired by the application.
  1143.  *
  1144.  *      For CD-ROM devices which do not support variable device speeds,
  1145.  *      a single speed is chosen which is a best-guess approximation
  1146.  *      of the device speed.
  1147.  *
  1148.  *      For CD-ROM devices which support infinitely variable device
  1149.  *      speeds, the device should choose a reasonable subset of the
  1150.  *      supported device speeds so that applications do not waste
  1151.  *      time enumerating all the possible device speeds.
  1152.  *
  1153.  *      If the requested device speed can be supported, then
  1154.  *      SpeedLowerBound will be set to SpeedDesired upon return.
  1155.  *
  1156.  *      To change the current device speed, use CDROM_IOCTL_SET_SPEED.
  1157.  *
  1158.  *      ENTRY
  1159.  *          IOCTL Packet format specified by CDROM_SPEEDCAP structure.
  1160.  *          Reserved - Reserved Zero
  1161.  *          SpeedDesired = Desired device speed, in Kilobytes/second
  1162.  *          SpeedLowerBound = don't care
  1163.  *          SpeedUpperBound = don't care
  1164.  *
  1165.  *      EXIT
  1166.  *          Success
  1167.  *              Returns NO_ERROR
  1168.  *              CDROM_SPEEDCAP structure filled in
  1169.  *
  1170.  *              SpeedDesired unchanged
  1171.  *              SpeedLowerBound set to closest speed <= desired speed
  1172.  *                  If the SpeedDesired is at or below the minimum
  1173.  *                  device speed, then SpeedLowerBound will be set to
  1174.  *                  the minimum supported device speed.
  1175.  *
  1176.  *              SpeedUpperBound set to closest speed > desired speed
  1177.  *                  If the SpeedDesired is at or above the maximum
  1178.  *                  device speed, then SpeedUpperBound will be set
  1179.  *                  to maximum supported device speed.
  1180.  *
  1181.  *          Failure
  1182.  *              Returns an extended error code.
  1183.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  1184.  *              Other Extended Errors may also be returned
  1185.  *
  1186.  */
  1187.  
  1188. typedef struct  CDROM_SPEEDCAP  { /* */
  1189.     ULONG       Reserved;               // Reserved - must be zero
  1190.     ULONG       SpeedDesired;           // Desired Speed Setting
  1191.     ULONG       SpeedLowerBound;        // Lower Speed Boundary
  1192.     ULONG       SpeedUpperBound;        // Upper Speed Boundary
  1193. } CDROM_SPEEDCAP, *PCDROM_SPEEDCAP;
  1194.  
  1195.  
  1196. /***    CDROM_IOCTL_SET_SPEED - Set New Device Speed
  1197.  *
  1198.  *      CDROM_IOCTL_SET_SPEED sets the desired CD-ROM device speed.
  1199.  *
  1200.  *      ENTRY
  1201.  *          IOCTL Packet format specified by CDROM_SPEEDSET structure.
  1202.  *          Reserved - Reserved Zero
  1203.  *          SpeedMode set to one of the following:
  1204.  *              CDSPEED_VARY - Ignore previous speed setting requests.
  1205.  *                  The CD-ROM device may choose the speed at will.
  1206.  *
  1207.  *              CDSPEED_STANDARD - Set the device speed to the standard
  1208.  *                  speed of 150 K/second.  (Ignore SpeedDesired)
  1209.  *
  1210.  *              CDSPEED_MAXIMUM - Set the device speed to the maximum
  1211.  *                  device speed for the drive.  (Ignore SpeedDesired)
  1212.  *
  1213.  *              CDSPEED_GIVEN - Set the device speed to the speed
  1214.  *                  given by SpeedDesired.
  1215.  *
  1216.  *          SpeedDesired is set to desired device speed
  1217.  *
  1218.  *      EXIT
  1219.  *          Success
  1220.  *              Returns NO_ERROR
  1221.  *              CDROM_SPEEDSET unchanged
  1222.  *
  1223.  *          Failure
  1224.  *              Returns an extended error code.
  1225.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  1226.  *              ERROR_INVALID_PARAMETER - The desired speed is not supported
  1227.  *              Other Extended Errors may also be returned
  1228.  *
  1229.  */
  1230.  
  1231. typedef struct  CDROM_SPEEDSET { /* */
  1232.     ULONG       Reserved;               // Reserved - must be zero
  1233.     ULONG       SpeedMode;              // Speed Setting Mode
  1234.     ULONG       SpeedDesired;           // Set to desired speed
  1235. } CDROM_SPEEDSET, *PCDROM_SPEEDSET;
  1236.  
  1237. /***    CDROM_IOCTL_CHANGER_GET_NUM_SLOTS - Get the number of slots in the cd changer
  1238.  *
  1239.  *      ENTRY
  1240.  *          None  
  1241.  *
  1242.  *      EXIT
  1243.  *          Success
  1244.  *              Returns NO_ERROR
  1245.  *              Output buffer contains a DWORD value indicates the number of slots, if zero, 
  1246.  *              it indicates the CD changer is not present.
  1247.  *
  1248.  *          Failure
  1249.  *              Returns an extended error code.
  1250.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  1251.  *              ERROR_INVALID_PARAMETER - The desired speed is not supported
  1252.  *              Other Extended Errors may also be returned
  1253.  *
  1254.  */
  1255.  
  1256. /***    CDROM_IOCTL_CHANGER_SELECT_SLOT - Select a CD changer slot
  1257.  *
  1258.  *      ENTRY
  1259.  *          Input buffer contains a DWORD value for the slot number to select
  1260.  *
  1261.  *      EXIT
  1262.  *          Success
  1263.  *              Returns NO_ERROR
  1264.  *
  1265.  *          Failure
  1266.  *              Returns an extended error code.
  1267.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  1268.  *              ERROR_INVALID_PARAMETER - The desired speed is not supported
  1269.  *              Other Extended Errors may also be returned
  1270.  *
  1271.  */
  1272.  
  1273. /***    CDROM_IOCTL_CHANGER_GET_CURRENT_SLOT - Get the current a CD changer slot
  1274.  *
  1275.  *      ENTRY
  1276.  *          None
  1277.  *
  1278.  *      EXIT
  1279.  *          Success
  1280.  *              Returns NO_ERROR
  1281.  *              The Ouptput buffer contains a DWORD value of the current selected slot number
  1282.  *
  1283.  *          Failure
  1284.  *              Returns an extended error code.
  1285.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  1286.  *              ERROR_INVALID_PARAMETER - The desired speed is not supported
  1287.  *              Other Extended Errors may also be returned
  1288.  *
  1289.  */
  1290.  
  1291. /***    CDROM_IOCTL_CHANGER_GET_DISC_PRESENT_INFO     - Get a map of disc present infomation
  1292.  *
  1293.  *      ENTRY
  1294.  *          None
  1295.  *
  1296.  *      EXIT
  1297.  *          Success
  1298.  *              Returns NO_ERROR
  1299.  *              The Ouptput buffer contains a DWORD value of the current disc present map.
  1300.  *                Each bit represent if a disc is present at this slot. 
  1301.  *                e.g. a value of 0x00000005 indicates disc present at slot 1 and 3.
  1302.  *
  1303.  *          Failure
  1304.  *              Returns an extended error code.
  1305.  *              ERROR_UNKNOWN_COMMAND - The command is not supported
  1306.  *              ERROR_INVALID_PARAMETER - The desired speed is not supported
  1307.  *              Other Extended Errors may also be returned
  1308.  *
  1309.  */
  1310.  
  1311. #define CDSPEED_VARY        0           // Set to any variable speed
  1312. #define CDSPEED_STANDARD    1           // Set to standard 150K/sec
  1313. #define CDSPEED_MAXIMUM     2           // Set to maximum speed
  1314. #define CDSPEED_GIVEN       3           // Set to given speed
  1315.  
  1316. /***    CDROM_IOCTL_READ - Read Data
  1317.  */
  1318.  
  1319.  
  1320. #define IORF_AUDIO_DATA_READ                0x0001
  1321. #define IORF_CHAR_COMMAND                   0x0002
  1322. #define IORF_FILEREAD                       0x0004  
  1323. /*
  1324. #define IORF_BYPASS_A_B 
  1325. #define IORF_BYPASS_QUEUE
  1326. #define IORF_BYPASS_VOLTRK
  1327. #define IORF_CHAR_COMMAND
  1328. #define IORF_SCATTER_GATHER
  1329. #define IORF_DATA_OUT
  1330. #define IORF_DOUBLE_BUFFER 
  1331. #define IORF_HIGH_PRIORITY
  1332. #define IORF_INHIBIT_GEOM_RECOMPUTE
  1333. #define IORF_PHYS_CMD
  1334. #define IORF_SCATTER_GATHER
  1335. #define IORF_SRB_VALID
  1336. #define IORF_SYNC_COMMAND       
  1337. #define IORF_VERSION_002 
  1338. #define IORF_WIN32 
  1339. */
  1340.  
  1341. typedef struct _SGX_BUF {
  1342.         PUCHAR sb_buf;        // pointer to buffer
  1343.         DWORD  sb_len;        // length of buffer
  1344. } SGX_BUF, *PSGX_BUF; 
  1345.  
  1346. typedef DWORD (CALLBACK * PFN_CDREQDONE)(DWORD, DWORD);
  1347.  
  1348. typedef struct  CDROM_READ { /* */
  1349.     DWORD               Reserved;                   // Reserved - must be zero
  1350.     PFN_CDREQDONE   done_callback;      // request completion callback function
  1351.     DWORD           done_dwRef;         // Reference dword returned to callback
  1352.     HANDLE          hProc_BufOwner;     // Buffer owner hProc
  1353.     CDROM_ADDR      StartAddr;              // Sector number to read from
  1354.     DWORD           TransferLength;     // Number of blocks to read
  1355.     DWORD           ReadFlags;
  1356.     DWORD           sgcount;            // Count of scatter gather buffers 
  1357.     SGX_BUF         sglist[1];          // first scatter/gather buffer
  1358. } CDROM_READ, *PCDROM_READ;
  1359.  
  1360.  
  1361.