Chris Cant - Writing Windows WDM Device Drivers

Здесь есть возможность читать онлайн «Chris Cant - Writing Windows WDM Device Drivers» весь текст электронной книги совершенно бесплатно (целиком полную версию без сокращений). В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Город: Lawrence, Kansas 66046, ISBN: , Издательство: R & D Books, Жанр: Программирование, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.

Writing Windows WDM Device Drivers: краткое содержание, описание и аннотация

Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Writing Windows WDM Device Drivers»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.

Writing Windows WDM Device Drivers — читать онлайн бесплатно полную книгу (весь текст) целиком

Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Writing Windows WDM Device Drivers», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.

Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

The StartType entry specifies when the driver must be started, as shown in the list in Table 11.4. WDM device drivers should specify %SERVICE_DEMAND_START% (3).

Table 11.4 Service StartType values

Value Constant Description
0 SERVICE_BOOT_START Start when W2000 is loaded.
1 SERVICE_SYSTEM_START Start when W2000 is initializing itself.
2 SERVICE_AUTO_START Start when W2000 is up and running.
3 SERVICE_DEMAND_START Start manually or when an associated device is added.
4 SERVICE_DISABLED Never start.

The ErrorControl entry specifies how the system should respond if the driver cannot load, as shown in the list in Table 11.5. The Wdm1 installation opts for normal error logging.

Table 11.5 Service ErrorControl values

Value Constant Description
0 SERVICE_ERROR_IGNORE Log error but do not display a message to the user.
1 SERVICE_ERROR_NORMAL Log error and display a warning message.
2 SERVICE_ERROR_SEVERE Log error and restart with last known good configuration.
3 SERVICE_ERROR_CRITICAL Log error. Try last known good configuration. If this fails, force a bugcheck.

The AddService directive may also contain a further field, which specifies a section that is used to install NT event logging registries. I found that this did not work in the Beta 2 version of Windows 2000.

Several other entries may appear in a Services section that let you insert further registry entries. Some of these are used to determine the load order of drivers that are auto-started, as described in the following text.

Locating Drivers

The Windows New Device Wizard is called into action whenever a new device is found: on power up, when a hot-pluggable device is installed, or when a device is installed from the Control Panel. It scans through all the available INF files trying to find an appropriate driver.

Windows uses the device Hardware ID or device Compatible ID to select which driver to load. The bus driver that found the device provides the Hardware ID and optionally one or more Compatible IDs. Some bus drivers provide fixed IDs. Otherwise, the bus driver must interrogate the device to find its IDs.

The Hardware and Compatible IDs that an INF file supports are listed for each product in a manufacturer's Models section. Each product is defined in a line in this section, as follows.

device_description= install ,hardware_id[,compatible_id…]

The device_description is displayed to the user. install is the name of the section with the installation instructions. One hardware_id and zero or more compatible_ids can then be given.

In the Wdm1 INF file, only one Hardware ID is given, *wdmBook\Wdm1. For Unknown devices installed from the Control Panel, only a Hardware ID is needed because the device is always installed.

%Wdm1%=Wdm1.Install, *wdmBook\Wdm1

The rules for selecting a device are quite complicated. By preference, Windows selects a driver for a device whose Hardware IDs match. Otherwise, it selects the driver whose Compatible ID best matches the device's Compatible ID, or prompts the user for an alternative driver INF file.

In Windows 2000, if more than one INF file has identical Hardware IDs or Compatible IDs, the Dri verVer directive is used to work out the most recent driver. The INF file with the most recent date (in USAn format) is used. The version number is only used for display purposes. A DriverVer directive in the Version section provides the default for the whole file. A DriverVer directive in an Install section overrides this default. The wustamp tool can be used to insert DriverVer directives into INF files.

Hardware IDs

Hardware IDs come in almost any form. They can be *DeviceID, where DeviceID is a three-letter company ID followed by a 4 hex digit device ID. Many Windows Hardware IDs use pnp as the company ID (e.g., *pnp0700 is a standard floppy disk controller).

Other Hardware IDs are in a form specific to the enumerator and often start with an enumerator code and a backslash. Here are typical Hardware IDs.

PCI\VEN_1011&DEV_0021 ; DEC 21052 PCI to PCI bridge

USB\VID_045E&PID_000B ; Microsoft USB Keyboard

USB\VID_046A&PID_0001 ; Cherry USB Keyboard

HID\VID_046A&PID_0001 ; Cherry USB Keyboard

Gameport\SideWinder3dPro ; Microsoft Sidewinder 3D Pro

PCMCIA\ACCT0N-EN2212-C817 ; Accton EN2212 Ethernet PCMCIA Adapter

ISAPNP\ICI1995 ; CoreLogic NetViper-100 ISDN Adapter

These Hardware IDs often include the vendor code and a device or product ID. These Hardware IDs can come in versions that are more specific. For example, USB devices can have REV_ revision numbers, MC_ multi-configuration IDs or MI_ multi-interface numbers added to the basic Hardware ID. Complicated rules apply if a USB device has more than one configuration or interface [27] See the article on the Microsoft web site entitled "USB Plug and Play IDs and Selecting Device Drivers to Load", http://www.microsoft.com/hwdev/busbios/usbpnp.htm. . In a simple case, if you produce a new driver for your version two USB device, use REV_ in the Hardware ID to specify the latest driver. Make sure that the most desirable Hardware ID appears first in the Models list.

[models]

%USBDevice_V2%=V2Install,USB\VID_ABCD&PID_EF01&REV_0002

%USBDevice_V1%=V1Install,USB\VID_ABCD&PID_EF01

Compatible IDs

Compatible IDs are used if a matching Hardware ID is not found. If a suitable driver is not found for a device's Hardware ID, its Compatible ID is used in the lookup process. A standard driver might be able to control this device. If the Compatible IDs match, the standard driver is used.

Compatible IDs are primarily used by USB devices. A USB device has a vendor ID and product ID that are used to form its Hardware ID. However, a USB device should also have class, subclass, and protocol information for each interface it supports. For example, a USB HID device has an interface class code of 03 (constant USB_DEVICE_CLASS_HUMAN_INTERFACE). This forms a Compatible ID of USB\Class_03.

In Windows 2000, the INPUT.INF file has a line that matches this HID Compatible ID.

%HID.DeviceDesc% = HID_Inst,GENERIC_HID_DEVICE, USB\Class_03&SubClass_01,USB\Class_03

In Windows 98, this case is caught in HIDDEV.INF.

%USB\Class_03%=USBHIDDevice,USB\Class_03

When a new USB HID keyboard (with standard capabilities) is attached to the computer, the default installer might not match the keyboard's Hardware ID, but it should match the Compatible ID. The standard HID keyboard driver is used, as described in the two previous cases. The HID USB keyboard should, therefore, install satisfactorily.

When locating a driver for a HID device where the Hardware ID is not recognized, Compatible IDs are not used. Instead, KEYBOARD. INF uses the HID_DEVICE_SYSTEM_KEYBOARD Hardware ID to locate the default driver.

Repeated Enumeration

A new device may require several driver-loading steps before it becomes fully operational.

Consider what happens when a Cherry HID USB keyboard is inserted for the first time. The USB class drivers should already be up and running. They will detect the new device and interrogate it to obtain its vendor ID and product ID, along with various class values. The following basic device Hardware ID is formed.

Читать дальше
Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

Похожие книги на «Writing Windows WDM Device Drivers»

Представляем Вашему вниманию похожие книги на «Writing Windows WDM Device Drivers» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.


Отзывы о книге «Writing Windows WDM Device Drivers»

Обсуждение, отзывы о книге «Writing Windows WDM Device Drivers» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.

x