Rules for Implementing DispatchCreate, DispatchClose, and DispatchCreateClose Routines
Keep the following points in mind when implementing DispatchCreate, DispatchClose, and DispatchCreateClose routines:
- At a minimum, the routine must do the following:
- Set the Status field of the input IRP's I/O status block with an appropriate NTSTATUS, usually STATUS_SUCCESS.
- Set the Information field of the input IRP's I/O status block to zero.
- Call IoCompleteRequest with the IRP and a PriorityBoost of IO_NO_INCREMENT.
- Return the NTSTATUS that it set in the Status field of the IRP's I/O status block.
In a highest-level or intermediate driver, the routine might have to do additional work to process a create or close request, depending on the nature of its device or of the underlying device, and on the design of the driver.
For a create request to open a file object that represents a logical or physical device, a highest-level driver should check the FileObject.FileName in the I/O stack location and complete the IRP with STATUS_SUCCESS if the Unicode string at FileName has a zero length. Otherwise, it should complete the IRP with STATUS_INVALID_PARAMETER.
The routines of lowest-level drivers are called only when the next-higher-level driver calls IoAttachDeviceToDeviceStack, IoGetDeviceObjectPointer, or IoAttachDevice. The lowest-level driver in a chain of layered drivers frequently does only the minimum required processing of a create or close request.
Build date: 11/16/2013