Книга: Microsoft Windows Embedded CE 6.0 Exam Preparation Kit

Driver Naming Conventions

Driver Naming Conventions

For an application to use a stream driver through the file system, the stream driver must be presented as a file resource so that the application can specify the device file in a CreateFile call to get a handle to the device. Having obtained the handle, the application can then use ReadFile or WriteFile to perform I/O operations, which Device Manager translates into corresponding calls to stream interface functions to perform the desired read and write actions. For Windows Embedded CE 6.0 to recognize stream device resources and redirect file I/O operations to the appropriate stream drive, stream drivers must follow a special naming convention that distinguishes these resources from ordinary files.

Windows Embedded CE 6.0 supports the following naming conventions for stream drivers:

? Legacy names The classical naming convention for stream drivers consists of three upper case letters, a digit, and a colon. The format is XXX[0-9]:, where XXX stands for the three-letter driver name and [0-9] is the index of the driver as specified in the driver's registry settings (see Lesson 3, "Configuring and Loading a Driver"). Because the driver index has only one digit, legacy names only support up to ten instances of a stream driver. The first instance corresponds to index 1, the ninth instance uses index 9, and the tenth instance refers to index 0. For example, CreateFile(L"COM1:"...) accesses the stream driver for the first serial port by using the legacy name COM1:.

NOTE

Legacy name limitation

The legacy naming convention does not support more than ten instances per stream driver.

? Device names To access a stream driver with an index of ten or higher, you can use the device name instead of the legacy name. The device name conforms to the format $deviceXXX[index], where $device is a namespace that indicates that this is a device name, XXX stands for the three-letter driver name and [index] is the index of the driver. The index can have multiple digits. For example, CreateFile(L"$deviceCOM11"...) would access the stream driver for the eleventh serial port. Stream drivers with a legacy name can also be accessed, such as CreateFile(L"$deviceCOM1"...).

NOTE

Legacy and device name access

Although legacy names and device names differ in format and supported range of driver instances, CreateFile returns the same handle with access to the same stream driver in both cases.

? Bus name Stream drivers for devices on a bus, such as Personal Computer Memory Card International Association (PCMCIA) or Universal Serial Bus (USB), correspond to bus names that the relevant bus driver passes to Device Manager when enumerating the drivers available on the bus. Bus names relate to the underlying bus structure. The general format is $busBUSNAME_[bus number]_[device number]_[function number], where $bus is a namespace that indicates that this is a bus name, BUSNAME refers to the name or type of the bus, and [bus number], [device number], and [function number] are bus-specific identifiers. For example, CreateFile(L"$ busPCMCIA_0_0_0"…) accesses device 0, function 0, on PCMCIA bus 0, which might correspond to a serial port.

NOTE

Bus name access

Bus names are primarily used to obtain handles for unloading and reloading bus drivers and for power management, but not for data read and write operations.

Оглавление книги


Генерация: 1.245. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз