Device Driver Access (Compact 2013)
3/26/2014
Applications and OS components access device drivers through different interfaces, depending on whether the device driver is a native driver or a stream driver. When the device driver is a native driver, the access method for the device driver is built into the native interface that the driver exposes to GWES or the file system. For example, if a device driver controls a graphics adapter, GWES uses the GPEEnableDriver function of the driver to connect the driver to GWES. Unlike stream drivers, native drivers are typically opened for exclusive access by the subsystem that controls that driver.
When the device driver is a stream driver, the OS and applications can gain access to the device driver through the file system by making a call to CreateFile to get a handle to the device. After an application obtains this handle, it can call ReadFile and WriteFile to perform read and write operations, which Device Manager translates into corresponding calls to stream interface functions on the device driver. So that Windows Embedded Compact can recognize stream device resources and redirect file operations to the appropriate stream driver, it uses special naming conventions for file names that represent device resources instead of ordinary files. A stream device driver can use one or more of these three device naming conventions: legacy, device-based, and bus-based.