:      : 
switch(irpSp->Parameters.DeviceIoControl.IoControlCode) { 
    case IOCTL_DeviceType_XXX: 
    case IOCTL_DeviceType_YYY: 
        if (irpSp->Parameters.DeviceIoControl.InputBufferLength < 
           (sizeof(IOCTL_XXXYYY_STRUCTURE))) { 
             status = STATUS_BUFFER_TOO_SMALL; 
             break; 
        } else { 
             IoMarkIrpPending(Irp); 
      :       : // pass IRP on for further processing 
    case ... 
      :      : 
 
As this code fragment shows, a DispatchDeviceControl routine also checks parameters, sometimes on each I/O control code that the driver must support, sometimes on groups of these IOCTL_XXX.
 Consider these
implementation guidelines for device drivers’ DispatchDeviceControl routines:
    Consider these
implementation guidelines for device drivers’ DispatchDeviceControl routines:
For better performance, every NT device driver should satisfy any device control request that it can, without queueing the IRP to other driver routines, in its DispatchDeviceControl routine.
For those IRPs that the DispatchDeviceControl routine can complete, it should call IoCompleteRequest with a PriorityBoost of IO_NO_INCREMENT. The DispatchDeviceControl routine must call IoMarkIrpPending with each request that it queues for further processing on the device and it must return STATUS_PENDING.