Wdm driver disk




















To do this, the filtering driver would create a Device Object of its own for each Device Object to be filtered. This is typically done by calling IoAttachDevice , which takes as arguments the name of the Device Object to be filtered and a pointer to the Device Object that will be used to perform the filtering.

This driver decides to filter the SCSI port device to carry out its mission. Pretty easy, right? There are some disadvantages to this scheme, however. The most obvious disadvantage is that the filter driver has to have predefined knowledge of the names of the Device Objects it wants to filter.

The second complexity of the NT V4 scheme is that you must carefully control the load-order of the filter driver. The filter driver must only be started after the driver being filtered. Enter Win2K. Devices can arrive and leave at almost any time. Device Objects names are no longer pre-defined and static.

Lots of new port devices exist. And there are plenty of changes that affect device filter drivers. Having said that, check out Figure 1 , as you recall the arrangement of the Win2K device stack. The process continues, as the disk class driver acts as a bus driver and enumerates disk partitions for each disk, etc. And so it goes, on up the stack. Eventually, once the stack is fully set-up, somebody will issue a disk request.

The IRP that represents this request will be passed-down the device stack from driver to driver. For example, the disk class driver will be called with an IRP at one of its dispatch entry points. Back To Filtering. The good news if you can call it that is that device filter drivers in Win2K get loaded, initialized, and started almost exactly the same way as any other Win2K device driver.

When the driver is first loaded, its DriverEntry entry point is called. At this point the filter driver does the typical driver-wide initialization activities, like exporting its other entry point by filling in its Driver Object.

So, where a typical hardware driver would be passed a pointer to an underlying PDO at its AddDevice entry point, a filter driver is a passed a pointer to an underlying device to filter.

To continue our example of the filter driver that counts writes to SCSI disk devices, this filter driver would determine if any request it receives is a write operation ignoring, for the moment, whether or not the request is being sent to a disk , if the request is for a write the driver counts it, sets up the next IRP stack location and then passes the request on to the driver below it using IoCallDriver.

There is one concept about Win2K device filtering has confused more than one experienced NT driver writer, however.

In Win2K, a filter driver can be either an upper filter or a lower filter. An upper filter receives requests before the device it filters receives them. A lower filter receives requests after the device being filters receives them, assuming the filtered device passes them down.

For more information, see Named Device Objects. For additional information, see Security Descriptors. For more information, see Specifying Device Types.

Specifies one or more system-defined constants, ORed together, that provide additional information about the driver's device. For more information about how to specify device characteristics, see Specifying Device Characteristics.

Specifies if the device object represents an exclusive device. The device extension of the device object is zeroed. A partial list of the failure codes returned by this function includes:. IoCreateDevice creates a device object and returns a pointer to the object. The caller is responsible for deleting the object when it is no longer needed by calling IoDeleteDevice. IoCreateDevice can only be used to create an unnamed device object, or a named device object for which a security descriptor is set by an INF file.

Otherwise, drivers must use IoCreateDeviceSecure to create named device objects. For more information, see Creating a Device Object. The caller is responsible for setting certain members of the returned device object. For more information, see Initializing a Device Object and the device-type-specific documentation for your device. Be careful to specify the DeviceType and DeviceCharacteristics values in the correct parameters.

If a driver's call to IoCreateDevice returns an error, the driver should release any resources that it allocated for that device. Skip to main content. This browser is no longer supported.



0コメント

  • 1000 / 1000