## Storage Device Driver Reference

[prev][next][parent][TOC]

### Editing an Adapter Device Driver Device Table

If the filter device driver does not need to hide the downstream units, it can initiate filtering operations by the following steps.

1.Change the value of the FilterADDHandle field in the target unit's UNITINFO structure so that the field selects the filter device driver.

When no filter device drivers are installed, the FilterADDHandle value will be 0. So, when a device manager (or other upstream adapter device driver) finds a 0 value in this field, the referenced adapter device driver is directly managing the device interface.

2.Change the UnitHandle field of the target unit's UNITINFO structure to a value assigned by the filter device driver.

Notice that the filter device driver is daisy-chaining itself into the call -down path for a given unit. As a result, the filter device driver must save the existing values in FilterADDHandle (if nonzero) and UnitHandle for the downstream driver. After the filter device driver processes a service request, it must pass the request to the downstream filter device driver or device-interface adapter driver.

The following protocol must be adhered to when editing a UNITINFO structure of another adapter device driver.

The filter device driver alters the information provided in the target UNITINFO structure by using the (IOCC_UNIT_CONTROL) IOCM_CHANGE_UNITINFO command. To issue IOCM_CHANGE_UNITINFO, the filter device driver first must allocate the unit, change the UNITINFO information, and then deallocate the unit.

Changing the UNITINFO information does not affect the operation of the downstream adapter device driver. For example, if a filter device driver changes the UF_HW_SCATGAT bit, the downstream device driver's treatment of the unit is not affected. However, the downstream adapter device driver must present the changed UNITINFO structure when its DEVICETABLE is requested. It is the responsibility of the filter device driver to convert the changed unit definition it sets to the actual unit definition of the adapter device driver owning the unit.

A filter device driver can modify a unit's flags without actually hooking the unit. For example a filter device driver could UF_set the A_DRIVE flag without actually receiving requests by leaving the original UnitHandle and FilterADDHandle fields intact.