Chapter 3 I/O Requests for Beep Device Drivers
Any replacement for the system beep driver must handle the following requests:
IRP_MJ_CREATE
Operation
Returns STATUS_SUCCESS, indicating that the device exists.
When Called
An application or higher-level driver has opened the file object representing the beep device.
I/O Status Block
Always sets Status to STATUS_SUCCESS and Information to zero.
IRP_MJ_CLEANUP
Operation
Cancels every IRP currently in the device queue for the target device object, setting STATUS_CANCELLED in each IRP’s I/O status block and completing each queued IRP before completing the cleanup request. (The next request will be a close request.)
When Called
An application, subsystem, or higher-level driver with a handle for the file object representing the beep device has relinquished the handle or has been canceled.
I/O Status Block
Sets Status to STATUS_SUCCESS and Information to zero for the cleanup request.
IRP_MJ_CLOSE
Operation
Returns STATUS_SUCCESS.
When Called
Following a cleanup request.
I/O Status Block
Always sets Status to STATUS_SUCCESS and Information to zero.
IRP_MJ_DEVICE_CONTROL
Operation
Causes the device to emit a beep.
When Called
Any time after the successful completion of a create request. A Win32 application, VDM, Console Manager, or the Windows NT subsystem has called DeviceIoControl to request a beep.
Input
The I/O control code in the I/O stack location at Parameters.DeviceIoControl.IoControlCode is IOCTL_BEEP_SET, the buffer at Irp->AssociatedIrp.SystemBuffer contains BEEP_SET_PARAMETERS data (frequency and duration), and the I/O stack location contains the size in bytes of the input buffer at Parameters.DeviceIoControl.InputBufferLength.
Output
None
I/O Status Block
Always sets Information to zero, whether Status is set to STATUS_SUCCESS, to STATUS_CANCELLED, or to STATUS_INVALID_PARAMETER if the input frequency or duration is invalid or missing.