Device Interfaces


The user-mode applications and system components that send I/O requests to a device must be able to identify the device so that they can open it. A device interface makes this identification possible.

A device interface is a logical grouping of I/O operations that a device supports. Every device interface class is assigned a globally unique identifier (GUID). Microsoft defines GUIDs for most device interface classes in device-specific header files, and vendors can define GUIDs for their own unique interface classes if required.

 Tip  See "Using GUIDs in Drivers" in the WDK-online at http://go.microsoft.com/fwlink/?LinkId=82109.

A driver registers its device as a member of a device interface class by creating an instance of a device interface and supplying the appropriate GUID and an optional string. The string uniquely identifies the instance, so that if the driver creates more than one instance of the same interface class, it can determine which interface a particular client is using and thus where to direct the client's I/O requests.

A driver can create the interface any time after it has created the device object, but typically does so in its add-device callback. By default, the framework enables the device's interfaces when the device enters the working state and disables them when the device leaves the working state.

The test applications that are provided with the Osrusbfx2 and Fx2_Driver samples show how a client application can use a device interface to find a device.

image from book
Device Interfaces and Symbolic Links

A client can identify and open a device by using either a symbolic link or a device interface. For applications, symbolic links are easier to use, but not for drivers.

For drivers, symbolic links can represent a security risk, and it is difficult to make a symbolic link persist across reboots and hardware reconfigurations. Device interfaces are much simpler from the driver's perspective. Device interfaces are persistent, so an application can save them in its configuration data and use them to find the device again later. In addition, the system automatically cleans up the device interfaces when the device is removed.

image from book




Developing Drivers with the Microsoft Windows Driver Foundation
Developing Drivers with the Windows Driver Foundation (Pro Developer)
ISBN: 0735623740
EAN: 2147483647
Year: 2007
Pages: 224

Similar book on Amazon
Windows Internals, Part 1: Covering Windows Server 2008 R2 and Windows 7
Windows Internals, Part 1: Covering Windows Server 2008 R2 and Windows 7
Windowsu00ae Internals: Including Windows Server 2008 and Windows Vista, Fifth Edition (Pro Developer)
Windowsu00ae Internals: Including Windows Server 2008 and Windows Vista, Fifth Edition (Pro Developer)
Advanced Windows Debugging
Advanced Windows Debugging
The Windows 2000 Device Driver Book: A Guide for Programmers (2nd Edition)
The Windows 2000 Device Driver Book: A Guide for Programmers (2nd Edition)

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net