home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cdrom.zip / DDK / BASE / SRC / VDEV / VCDROM / vcdromp.h < prev   
C/C++ Source or Header  |  1996-06-18  |  7KB  |  272 lines

  1. /**************************************************************************
  2.  *
  3.  * SOURCE FILE NAME = VCDROMP.H
  4.  *
  5.  * DESCRIPTIVE NAME = VCDROM private constants
  6.  *
  7.  * DESCRIPTION VCDROM private constants and external prototypes.
  8.  *
  9.  * Copyright : COPYRIGHT IBM CORPORATION, 1991, 1992
  10.  *             Copyright Microsoft Corporation, 1990
  11.  *             LICENSED MATERIAL - PROGRAM PROPERTY OF IBM
  12.  *             REFER TO COPYRIGHT INSTRUCTION FORM#G120-2083
  13.  *             RESTRICTED MATERIALS OF IBM
  14.  *             IBM CONFIDENTIAL
  15.  *
  16.  *
  17.  * ENTRY POINTS:
  18.  *
  19.  * EXTERNAL REFERENCES:
  20.  *
  21.  * CHANGE ACTIVITY =
  22.  *  DATE      FLAG        APAR   CHANGE DESCRIPTION
  23.  *  --------  ----------  -----  --------------------------------------
  24.  *  mm/dd/yy  @Vr.mpppxx  xxxxx  xxxxxxx
  25.  *  08/16/91  @V2.0dtf00         Created.
  26.  *
  27.  *  03/24/93  @V2.1fjs00         Added VCDROMPDBDestroy and CloseHandles
  28.  *                               prototypes.
  29.  *
  30.  *  04/04/95  @V113078           Allow raw Read_Longs.  These Read_Longs do use
  31.  *                               the File System as they are non-standard
  32.  *                               sector sizes (2352).  However, there is a
  33.  *                               direct IOCTL to the device manager to read
  34.  *                               this type of sector (Cat 80 Fun 72)
  35.  *
  36.  ****************************************************************************/
  37.  
  38.  
  39. #define ERROR_INVALID_2F_FUNCTION           1
  40. #define CARRY_FLAG                          0x0001
  41.  
  42. #define STANDARD_VOLUME_DESCRIPTOR          1
  43. #define VOLUME_DESCRIPTOR_TERMINATOR        0xFF
  44. #define OTHER_VOLUME_DESCRIPTOR             0
  45.  
  46. /*
  47. ** VPIC VDD IDC function
  48. */
  49. #define VPIC_SLAVE_ADDRESS                  3
  50.  
  51. /*
  52. ** DOS device driver request packet commands, with cdrom extensions
  53. */
  54. #define DOS_IOCTL_INPUT                     3
  55. #define DOS_IOCTL_OUTPUT                    12
  56. #define DOS_READ_LONG                       128
  57. #define DOS_READ_LONG_PREFETCH              130
  58. #define DOS_SEEK                            131
  59. #define DOS_PLAY_AUDIO                      132
  60. #define DOS_STOP_AUDIO                      133
  61. #define DOS_RESUME_AUDIO                    136
  62.  
  63. #define DOS_INPUT_FLUSH                     7
  64. #define DOS_DEVICE_OPEN                     13
  65. #define DOS_DEVICE_CLOSE                    14
  66.  
  67. /*
  68. ** Identifying strings
  69. */
  70. #define CD01    0x31304443L
  71. #define VCDR    0x52444356L
  72. #define OM02    0x32304D4FL
  73.  
  74. /*
  75. ** VDHOpen parameters
  76. */
  77. #define CDROM_CHAR_DRIVER_NAME      "CD-ROM2$"
  78. #define FILESIZE                    0
  79. #define FILEATTRIBUTE               0
  80. #define OPENFLAG                    1
  81. #define CHAROPENMODE                0x2040
  82. #define OPENMODE                    0x8040
  83. #define EABUF                       0
  84.  
  85. /*
  86. ** General constants
  87. */
  88. #define PARM_LENGTH_MAX             16
  89. #define DATA_LENGTH_MAX             16
  90.  
  91. #define MEDIA_CHANGED_EXCEPTION     0
  92. #define RETURN_VOLUME_SIZE          0x78
  93. #define DRIVE_PLAYING               0x1000
  94. #define MAX_NUMBER_OF_DRIVES        26
  95. #define CDROM_SECTOR_SIZE           2048
  96. #define CDROM_LONG_SECTOR_SIZE      2352                           /*@V113078*/
  97.  
  98. #define VDH_ERROR                   -1L
  99.  
  100. /*
  101. ** Category 0x80 CD-ROM IOCTL Defines
  102. */                                                                 /*@V113078*/
  103. #define IOC_CDROM      0x80           /* CD-ROM Catagory Code */   /*@V113078*/
  104. #define IOCD_READ_LONG 0x72           /* Read Long            */   /*@V113078*/
  105.  
  106. struct
  107. CategoryCode {
  108.                 UCHAR   code;
  109.                 UCHAR   category;
  110. };
  111.  
  112. /*
  113. **  Subcomponent-specific macros
  114. */
  115.  
  116. #define INT_3                       _asm { int 3 }
  117. #define GET_DRIVE_STRING(n)         ( &DriveString [n*3] )
  118. #define UNIT_TO_DRIVE_NUMBER(n)     ( n + FirstDriveNumber )
  119. #define FRAMES(l)                   ( (UCHAR) (l & 0x00FF) )
  120. #define SECONDS(l)                  ( (UCHAR) ((l >> 8) & 0x00FF) )
  121. #define MINUTES(l)                  ( (UCHAR) ((l >> 16) & 0x00FF) )
  122.  
  123. /*
  124. **  Private Function Prototypes
  125. */
  126.  
  127. /*
  128. ** File: vcdrom.c
  129. */
  130. BOOL
  131. EXPENTRY
  132. VDDInit ( PSZ );
  133.  
  134. BOOL
  135. HOOKENTRY
  136. VCDROMCreateVDM ( HVDM );
  137.  
  138. BOOL
  139. PRIVENTRY
  140. InstallStub ( VOID );
  141.  
  142. BOOL
  143. HOOKENTRY
  144. VCDROMTerminateVDM ( HVDM );
  145.  
  146. BOOL
  147. HOOKENTRY
  148. VCDROMPDBDestroy ( HVDM, USHORT );
  149.  
  150. VOID
  151. PRIVENTRY
  152. CloseHandles ( VOID );
  153.  
  154. /*
  155. **  File: vcdrom2f.c
  156. */
  157. BOOL
  158. HOOKENTRY
  159. VCDROMDosLink ( PVOID pHookData,
  160.                 register
  161.                 PCRF  pcrf);
  162.  
  163. VOID
  164. PRIVENTRY
  165. SendDeviceRequest ( register
  166.                     struct
  167.                     DosRh   *reqhdr,
  168.                     ULONG    drive_number );
  169.  
  170. VOID
  171. PRIVENTRY
  172. ResetMedia ( ULONG drive_number );
  173.  
  174. USHORT
  175. PRIVENTRY
  176. MapOS2toDosCode ( ULONG rc );
  177.  
  178. USHORT
  179. PRIVENTRY
  180. GetPlayStatus ( HFILE handle );
  181.  
  182. ULONG
  183. PRIVENTRY
  184. HsgToRedbook ( register ULONG hsg_value );
  185.  
  186. ULONG
  187. PRIVENTRY
  188. AddSectors ( ULONG start_sector,
  189.              ULONG number,
  190.              ULONG address_mode );
  191.  
  192. HFILE
  193. PRIVENTRY
  194. GetDriveHandle ( ULONG drive_number );
  195.  
  196.  
  197. /*
  198. **** Random macro support
  199. **
  200. **   If VDDSTRICT is defined, the Assert macros generate appropriate code.
  201. **
  202. **   If VDDSTRICT is not defined, the Assert macros are NO-OPs (with the
  203. **   exception of AssertRC, in which case the function is still called, but
  204. **   the return code is not checked).
  205. **
  206. **   If VDDDEBUG is defined, debug printfs (PRINTDEBUGs) are generated, and
  207. **   failed assertions (assuming VDDSTRICT is defined) break at the assertion
  208. **   rather than in the kernel's "panic" service.  VDDDEBUG requires the
  209. **   kernel debugger, in other words.
  210. **
  211. **   If VDDDEBUG is not defined, debug printfs (PRINTDEBUGs) are NOT
  212. **   generated, and failed assertions (assuming VDDSTRICT is defined) simply
  213. **   panics.
  214. */
  215.  
  216. #ifdef VDDSTRICT
  217.  
  218. /*c-begin*/
  219. extern CHAR szAssertMsg[];
  220. #define MODNAME static CHAR szFile[]
  221.  
  222. #ifdef VDDDEBUG
  223. #define Assert(t) { \
  224.                     if (!(t)) { \
  225.                       PRINTDEBUG(szAssertMsg, szFile, __LINE__); \
  226.                       INT3(); \
  227.                     } \
  228.                   }
  229. #else
  230. #define Assert(t) { \
  231.                     if (!(t)) { \
  232.                       PANIC(szAssertMsg, szFile, __LINE__); \
  233.                     } \
  234.                   }
  235. #endif
  236.  
  237. #define AssertTRUE(t)   Assert(t)
  238. #define AssertFALSE(t)  Assert(!(t))
  239. #define AssertZERO(t)   Assert(!(t))
  240. #define AssertNONZERO(t)Assert(t)
  241. #define AssertRC(t)     Assert(t)       /* verify function return code good */
  242. /*c-end*/
  243.  
  244. #else
  245.  
  246. /*c-begin*/
  247. #define Assert(t)       //
  248. #define AssertTRUE(t)   //
  249. #define AssertFALSE(t)  //
  250. #define AssertZERO(t)   //
  251. #define AssertNONZERO(t)//
  252. #define AssertRC(t)     (t)            /* perform function, but don't verify */
  253. /*c-end*/
  254.  
  255. #endif
  256.  
  257. /*
  258. **  Random debugging support
  259. */
  260.  
  261. #ifdef VDDDEBUG
  262.  
  263. /*c-begin*/
  264. extern CHAR szModule[];
  265. extern CHAR *apszPageStates[];
  266.  
  267. #undef PRINTDEBUG
  268. #define PRINTDEBUG  printf(szModule); printf
  269. /*c-end*/
  270.  
  271. #endif
  272.