300分高手速来!

Un1 2000-06-16 05:03:00
谁编写过windows下虚拟光驱软件,要求被共享后行为完全和普通光驱一致。提供建设性意见也有奖!
...全文
191 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
lu0 2000-06-17
  • 打赏
  • 举报
回复

SEE MSDN description for NT/9x CDROM interface.
9x:
For implementation, write a SCSI MPD.
Too many thing for 9x. Ignored.

NT:
For implementation, write a LEGACY KMD.
7.1 CD-ROM I/O Requests

Any driver that sets up device objects of type FILE_DEVICE_CD_ROM is required to handle three types of requests:

IRP_MJ_CREATE
IRP_MJ_READ
IRP_MJ_DEVICE_CONTROL

IRP_MJ_CREATE

Operation

Returns STATUS_SUCCESS, indicating that the device exists. For the caller, this request opens the device for I/O.

When Called

A higher-level driver is attempting to connect one of its device objects to the target device object, or a user-mode process has attempted to open a file stored on the physical device, thereby causing a file system to carry out a mount operation.

I/O Status Block

Returns STATUS_SUCCESS in the Status field and zero in the Information field.

IRP_MJ_READ

Operation

Transfers data from the underlying device to system memory.

Output

Drivers of CD-ROM devices generally use direct I/O, so the lowest-level driver transfers data using DMA or PIO into the buffer described by the MDL at Irp->MdlAddress.

When Called

A Win32? application with a handle for the opened file object that represents the CD-ROM device has requested a data transfer.

I/O Status Block

The Information field is set to the number of bytes transferred, whatever the Status field’s value. In addition to STATUS_SUCCESS, possible values are any of the following:

STATUS_INSUFFICIENT_RESOURCES

STATUS_DEVICE_DATA_ERROR

STATUS_INVALID_DEVICE_REQUEST

STATUS_NO_SUCH_DEVICE

STATUS_IO_TIMEOUT

STATUS_IO_DEVICE_ERROR

STATUS_DEVICE_NOT_READY

STATUS_DEVICE_BUSY

STATUS_NO_MEDIA_IN_DEVICE

STATUS_VERIFY_REQUIRED

IRP_MJ_DEVICE_CONTROL

Operation

Determined by the I/O control code set at Parameters.DeviceIoControl.IoControlCode in the driver’s I/O stack location of the IRP.

When Called

A Win32 application with a handle for the opened file object that represents the CD-ROM device has called DeviceIoControl or a higher-level driver has set up the request.

I/O Status Block

Also determined by the operation, either STATUS_SUCCESS or an appropriate STATUS_XXX value. For most operations, the set of possible STATUS_XXX values includes those propagated from a call to a support routine or lower-level driver and/or those chosen by the driver designer. In general, the Information field of the I/O status block is set to the number of bytes returned or transferred when the device driver completes the IRP.


--------------------------------------------------------------------------------
7.2 CD-ROM I/O Control Codes

All public I/O control codes for drivers of CD-ROM devices use buffered I/O. Consequently, the input or output data for these requests is at Irp->AssociatedIrp.SystemBuffer.

Class drivers for SCSI CD-ROM devices handle additional public I/O control codes, along with those described in this section. See also Chapter 9 for more information about requirements for SCSI class drivers of mass-storage devices.

IOCTL_CDROM_GET_DRIVE_GEOMETRY

Operation

IOCTL_CDROM_GET_DRIVE_GEOMETRY returns information about the CDROM’s geometry (media type, number of cylinders, tracks per cylinder, sectors per track, and bytes per sector).

Input

Parameters.DeviceIoControl.OutputBufferLength in the I/O stack location of the IRP indicates the size in bytes of the buffer, which must be >= sizeof(DISK_GEOMETRY).

Output

The driver returns the DISK_GEOMETRY-type information in the buffer at Irp->AssociatedIrp.SystemBuffer.

I/O Status Block

The Information field is set to the size in bytes of the returned data. The Status field is set to STATUS_SUCCESS or possibly to STATUS_UNRECOGNIZED_MEDIA, STATUS_INVALID_PARAMETER, STATUS_INFO_LENGTH_MISMATCH, or STATUS_BUFFER_TOO_SMALL.

IOCTL_CDROM_READ_TOC

Operation

Returns the table of contents of the media.

Input

Parameters.DeviceIoControl.OutputBufferLength in the I/O stack location indicates the size in bytes of the buffer, which must be >= sizeof(CDROM_TOC).

Output

The driver returns the CDROM_TOC data in the buffer at Irp->AssociatedIrp.SystemBuffer.

I/O Status Block

The Information field is set to the number of bytes returned. The Status field is set to STATUS_SUCCESS or possibly to STATUS_BUFFER_TOO_SMALL, STATUS_NO_MEDIA_IN_DEVICE, STATUS_DEVICE_NOT_READY, STATUS_IO_TIMEOUT, STATUS_IO_DEVICE_ERROR, STATUS_DEVICE_BUSY, or STATUS_VERIFY_REQUIRED.

IOCTL_CDROM_GET_LAST_SESSION

Operation

The driver determines whether a disc is multisession. It compares the first and last session and the starting track of the last session. If the first session is the same as the last, the disc is not multisession. If the disc is multisession, the driver stores session block addresses in the table of contents.

Input

None

Output

None

I/O Status Block

The Information field is set to zero. The Status field is set to STATUS_SUCCESS or possibly to STATUS_INVALID_DEVICE_REQUEST, STATUS_DEVICE_BUSY, STATUS_DEVICE_NOT_READY, STATUS_IO_TIME_OUT, or STATUS_VERIFY_REQUIRED.

IOCTL_CDROM_CHECK_VERIFY

Operation

This IOCTL is replaced by IOCTL_STORAGE_CHECK_VERIFY. The only difference between the two IOCTLs is the base code.

IOCTL_STORAGE_CHECK_VERIFY

Operation

Determines whether the media has changed on a CD-ROM drive. (For more information about handling removable media, see the Kernel-Mode Driver Design Guide.)

Input

Optionally, Parameters.DeviceIoControl.OutputBufferLength in the I/O stack location of the IRP indicates the size in bytes of a buffer, which must be >= sizeof(ULONG). This field is zero if the optional buffer is not specified.

Output

Optionally, Irp->AssociatedIrp.SystemBuffer points to a buffer to receive the media change count. The driver fills this buffer only if Parameters.DeviceIoControl.OutputBufferLength was nonzero and the return value is STATUS_SUCCESS. The media change count is a ULONG indicating how many times the media has changed since the driver started.

I/O Status Block

If the driver has no indication that the media has changed, the driver sets the Status field to STATUS_SUCCESS. In addition, if the optional media change buffer was specified, the driver returns the media change count in the buffer at Irp->AssociatedIrp.SystemBuffer and sets the Information field to sizeof(ULONG). If the optional media change buffer was not specified, the driver sets Information to zero.

If the driver detects that the media has changed and the volume is mounted (VPD_MOUNTED is set in the VPB), it must: set Information to zero, set Status to STATUS_VERIFY_REQUIRED, set the DO_VERIFY_VOLUME flag in the DeviceObject, and call IoCompleteRequest with the input IRP.

If the driver detects that the media has changed, but the volume is not mounted, the driver must not set the DO_VERIFY_VOLUME bit. The driver should set Status to STATUS_IO_DEVICE_ERROR, set Information to zero, and call IoCompleteRequest with the IRP.

If the driver detects an error such as STATUS_BUFFER_TOO_SMALL, STATUS_INSUFFICIENT_RESOURCES, or a device error, it sets Information to zero and sets the appropriate error value in the Status field.

IOCTL_CDROM_GET_CONTROL

Operation

The driver determines the current audio playback mode.

Input

Parameters.DeviceIoControl.OutputBufferLength in the I/O stack location indicates the size in bytes of the buffer, which must be >= sizeof(CDROM_AUDIO_CONTROL).

Output

The driver returns the CDROM_AUDIO_CONTROL data in the buffer at Irp->AssociatedIrp.SystemBuffer.

I/O Status Block

The Information field is set to the number of bytes returned. The Status field is set to STATUS_SUCCESS or possibly to STATUS_BUFFER_TOO_SMALL, STATUS_DEVICE_NOT_READY, STATUS_IO_DEVICE_ERROR, STATUS_IO_TIMEOUT, STATUS_INSUFFICIENT_RESOURCES, STATUS_VERIFY_REQUIRED, or STATUS_INVALID_DEVICE_REQUEST.

IOCTL_CDROM_GET_VOLUME

Operation

The driver determines the current volume for each of its device’s audio ports.

Input

Parameters.DeviceIoControl.OutputBufferLength in the I/O stack location indicates the size in bytes of the buffer, which must be >= sizeof(CDROM_VOLUME_CONTROL).

Output

The driver returns the CDROM_VOLUME_CONTROL data in the buffer at Irp->AssociatedIrp.SystemBuffer.

I/O Status Block

The Information field is set to sizeof(CDROM_VOLUME_CONTROL) when the Status field is set to STATUS_SUCCESS. Otherwise, the Information field is set to zero, and the Status field possibly can be set to STATUS_BUFFER_TOO_SMALL, STATUS_DEVICE_NOT_READY, STATUS_IO_DEVICE_ERROR, STATUS_VERIFY_REQUIRED, or STATUS_IO_TIMEOUT.

IOCTL_CDROM_SET_VOLUME

Operation

The driver resets the volume for its device’s audio ports.

Input

The buffer at Irp->AssociatedIrp.SystemBuffer contains the CDROM_VOLUME_CONTROL value(s) to be set. Parameters.DeviceIoControl.InputBufferLength in the I/O stack location indicates the size in bytes of the buffer, which must be >= sizeof(CDROM_VOLUME_CONTROL).

Output

None

I/O Status Block

The Information field is set to zero. The Status field is set to STATUS_SUCCESS or possibly to STATUS_BUFFER_TOO_SMALL, STATUS_DEVICE_NOT_READY, STATUS_IO_TIMEOUT, STATUS_IO_DEVICE_ERROR, STATUS_VERIFY_REQUIRED, or STATUS_INVALID_DEVICE_REQUEST.

IOCTL_CDROM_PLAY_AUDIO_MSF

Operation

Plays the specified range of the media.

Input

The buffer at Irp->AssociatedIrp.System buffer contains the starting and ending MSF values. Parameters.DeviceIoControl.InputBufferLength in the I/O stack location indicates the size in bytes of the buffer, which must be >= sizeof(CDROM_PLAY_AUDIO_MSF).

Output

None

I/O Status Block

The Information field is set to zero. The Status field is set to STATUS_SUCCESS or possibly to STATUS_INVALID_DEVICE_REQUEST, STATUS_BUFFER_TOO_SMALL, STATUS_DEVICE_NOT_READY, STATUS_IO_DEVICE_ERROR, STATUS_IO_TIME_OUT, or STATUS_VERIFY_REQUIRED.

IOCTL_CDROM_SEEK_AUDIO_MSF

Operation

Moves the heads to the specified MSF on the media.

Input

The buffer at Irp->AssociatedIrp.SystemBuffer contains the CDROM_SEEK_AUDIO_MSF specification. Parameters.DeviceIoControl.InputBufferLength indicates the size in bytes of the buffer.

Output

None

I/O Status Block

The Information field is set to zero. The Status field is set to STATUS_SUCCESS or possibly to STATUS_BUFFER_TOO_SMALL, STATUS_INVALID_DEVICE_REQUEST, STATUS_IO_DEVICE_ERROR, STATUS_NO_MEDIA_IN_DEVICE, STATUS_DEVICE_NOT_READY, STATUS_IO_TIME_OUT, or STATUS_VERIFY_REQUIRED.

IOCTL_CDROM_STOP_AUDIO

Operation

Ends audio play.

Input

None

Output

None

I/O Status Block

The Information field is set to zero. The Status field is set to STATUS_SUCCESS or possibly to STATUS_INVALID_DEVICE_REQUEST if audio is not currently playing, STATUS_IO_DEVICE_ERROR, STATUS_NO_MEDIA_IN_DEVICE, STATUS_DEVICE_NOT_READY, STATUS_IO_TIME_OUT, or STATUS_VERIFY_REQUIRED.

IOCTL_CDROM_PAUSE_AUDIO

Operation

Suspends audio play.

Input

None

Output

None

I/O Status Block

The Information field is set to zero. The Status field is set to STATUS_SUCCESS or possibly to STATUS_INVALID_DEVICE_REQUEST if audio is not currently playing, STATUS_IO_DEVICE_ERROR, STATUS_NO_MEDIA_IN_DEVICE, STATUS_DEVICE_NOT_READY, STATUS_IO_TIME_OUT, or STATUS_VERIFY_REQUIRED.

IOCTL_CDROM_RESUME_AUDIO

Operation

Resumes a suspended audio operation.

Input

None

Output

None

I/O Status Block

The Information field is set to zero. The Status field is set to STATUS_SUCCESS or possibly to STATUS_INVALID_DEVICE_REQUEST if audio is not currently suspended, STATUS_IO_DEVICE_ERROR, STATUS_NO_MEDIA_IN_DEVICE, STATUS_DEVICE_NOT_READY, STATUS_IO_TIME_OUT, or STATUS_VERIFY_REQUIRED.

IOCTL_CDROM_READ_Q_CHANNEL

Operation

Returns the current position, media catalog, and ISRC track data.

Input

Parameters.DeviceIoControl.OutputBufferLength in the I/O stack location indicates the size in bytes of the buffer, which must be >= sizeof(SUB_Q_CHANNEL_DATA).

Output

The driver returns the SUB_Q_CHANNEL_DATA information in the buffer at Irp->AssociatedIrp.SystemBuffer.

I/O Status Block

The Information field is set to the number of bytes returned. The Status field is set to STATUS_SUCCESS or possibly to STATUS_BUFFER_TOO_SMALL, STATUS_IO_DEVICE_ERROR, STATUS_INSUFFICIENT_RESOURCES, STATUS_INVALID_DEVICE_REQUEST, STATUS_NO_MEDIA_IN_DEVICE, STATUS_DEVICE_NOT_READY, STATUS_IO_TIME_OUT, or STATUS_VERIFY_REQUIRED.

IOCTL_CDROM_FIND_NEW_DEVICES

Operation

This IOCTL is replaced by IOCTL_STORAGE_FIND_NEW_DEVICES. The only difference between the two IOCTLs is the base code.

IOCTL_STORAGE_FIND_NEW_DEVICES

Operation

Determines whether another device that the driver supports has just been connected to the I/O bus. If such a device is found, the driver sets up any necessary system objects and resources to handle I/O requests for its new device. It also initializes the device on receipt of this request dynamically: that is, without requiring the machine to be rebooted. Such a driver is assumed to support devices connected on a dynamically configurable I/O bus.

Input

None

Output

None

I/O Status Block

The Information field is set to zero. The Status field can be set to STATUS_SUCCESS or to any value returned by the driver’s (re)initialization code.

IOCTL_CDROM_RAW_READ

Operation

Reads data from the CD-ROM in raw mode.

Input

If the IOCTL is from user mode, Irp->AssociatedIrp.SystemBuffer contains a structure that specifies the starting disk offset, the sector count, and the track mode (XA or CDDA) for the read. Parameters.DeviceIoControl.InputBufferLength specifies the size in bytes of the structure, which must be >= sizeof(RAW_READ_INFO). Parameters.DeviceIoControl.OutputBufferLength specifies the size of the buffer to be read, which must be >= sizeof(SectorCount * RAW_SECTOR_SIZE).

If the IOCTL is from kernel mode, Parameters.DeviceIoControl.Type3InputBuffer contains a structure that specifies the starting disk offset, the sector count, and the track mode (XA or CDDA) for the read. Parameters.DeviceIoControl.OutputBufferLength specifies the size of the buffer to be read, which must be >= sizeof(SectorCount * RAW_SECTOR_SIZE).

Output

The driver writes the requested bytes directly (using DMA or PIO) to the buffer described by the MDL at Irp->MdlAddress.

I/O Status Block

If the read is successful, the driver sets Status to STATUS_SUCCESS and Information to the number of bytes transferred. If the read is not successful, the driver sets Information to zero and Status to possibly STATUS_INVALID_PARAMETER, STATUS_INSUFFICIENT_RESOURCES, or STATUS_INVALID_DEVICE_REQUEST.

IOCTL_CDROM_CLOSE_DOOR

Operation

None. This I/O control code has been replaced by IOCTL_DeviceType_LOAD_MEDIA, described in Chapter 9.
kathywp 2000-06-16
  • 打赏
  • 举报
回复
写VXD

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧