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
- Автор:
- Издательство:R & D Books
- Жанр:
- Год:неизвестен
- Город:Lawrence, Kansas 66046
- ISBN:0-87930-565-7
- Рейтинг книги:5 / 5. Голосов: 1
-
Избранное:Добавить в избранное
- Отзывы:
-
Ваша оценка:
- 100
- 1
- 2
- 3
- 4
- 5
Writing Windows WDM Device Drivers: краткое содержание, описание и аннотация
Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Writing Windows WDM Device Drivers»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.
Writing Windows WDM Device Drivers — читать онлайн бесплатно полную книгу (весь текст) целиком
Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Writing Windows WDM Device Drivers», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.
Интервал:
Закладка:
The book software includes a small tool called Servicer in the Servicer subdirectory. Run this to see the display shown in Figure 11.4. "Parallel" has been typed into the Driver name box and the Lookup button has been pressed. The Parallel driver is found to be running. You can stop and start the Parallel driver using the appropriate buttons.
Servicer could be enhanced. With a bit of ingenuity, it could list all the available drivers in a list box. It could also be enhanced to change the Startup attributes in the same way as the NT 4 Devices Control Panel applet.
Do not try to stop a WDM driver that has a device attached. It will not work.
Figure 11.4 Servicer program
The familiar Device Manager display is used to manage WDM devices in Windows 98. Start the System applet in the Control Panel. The Device Manager tab shows a display very similar to the right-hand pane of the Computer Management Console Devices windows shown in Figure 11.3.
The Control Panel Add New Hardware wizard is used to add some types of new device. The Add New Hardware wizard is run automatically if a new device is detected by a bus driver.
A quick and dirty way of installing a series of registry settings is to use .REG files. Use RegEdit to export a branch of the registry. Run RegEdit on another computer to import the . REG file to create the same registry structure, entries, and values.
Two other Windows 2000 command line tools also do the same job. regdmp writes registry information to a REG file, regini imports a REG file.
REG files help when you only have to do one or two driver installations and you do not want to write a complete installation program. Another possible use is in product support; ask a customer to use RegEdit to export a portion of their registry to send to you.
Installing NT Style Drivers in Windows 98
It is often possible to use an NT style driver in Windows 98. The NT style PHDIo driver described in Chapters 1.5-19 can be run in Windows 98 as well as the NT and Windows 2000 x86 platforms. PHDIo is a generic driver for handling simple devices and it is useful to be able to install it in Windows 98.
The DebugPrint driver described in Chapter 14 is currently installed as a WDM Plug and Play device. However, it would be perfectly sensible for it to be installed as an NT style driver. Quite a bit of its infrastructure would change. It would not have an AddDevice routine and it would not receive Plug and Play IRPs. This would actually make the driver quite a bit easier!
Contrary to my expectations, an NT style driver can use various kernel calls that are not supposed to be available to it (e.g., HalTranslateBusAddress for bus address translation, HalGetInterruptVector to get an interrupt vector, and IoReportResourceUsage to grab resource assignments). With these routines, an NT style driver such as PHDIo can use I/O ports and interrupts. You will have to experiment to see if DMA resources can also be used.
An NT style driver can use other techniques to talk to hardware. It could attach itself to another driver device and interact with hardware that way. Alternatively, I assume that it could use the available VxDs to interact with hardware.
You have to install an NT style driver "by hand" in Windows 98. In other words, the Add New Hardware wizard will not process an INF file nicely for you. Instead, a relatively straightforward program will be needed to copy the driver executable, set some registry values, and reboot the computer. For example, if you were trying to install a driver called AbcXyz, you would use the following steps.
• Copy the driver executable, AbcXyz.sys, to the Windows System32\Drivers directory.
• Make a new registry key HKLM\System\CurrentControl Set\Services\AbcXyz\, replacing AbcXyz with your driver name.
• In this registry key, set the values according to Table 11.6.
• Restart Windows 98.
Table 11.6 Windows 98 registry values
Value | Type | Contents |
---|---|---|
Type | DWORD | 1 |
Start | DWORD | 2 as per Table 11.4 |
DisplayName | REG_SZ | AbcXyz" driver name |
ErrorControl | DWORD | 1 as per Table 11.5 |
Conclusion
This chapter first looked at how to install WDM device drivers using INF files. It then described the installation process for NT style kernel mode drivers. The device driver management tools were discussed. The Servicer program can start and stop NT style drivers.
Our tour of the core device driver functionality continues in the next chapter by looking at how to interact with the Windows Management Instrumentation system.
Listing 11.2 NTMnstall.Cpp
// install.Inf – NT driver install program
// Copyright © 1998 Chris Cant, PHD Computer Consultants Ltd
// This is not a complete program
void InstallDriver(CString DriverName, CString DriverFromPath) {
//////////////////////////////////////////////////////////////////
// Get System32 directory
_TCHAR System32Directory[_MAX_PATH];
if (0==GetSystemDirectory(System32Directory,_MAX_PATH)) {
AfxMessageBox("Could not find Windows system directory");
return;
}
///////////////////////////////////////////////////////////////////
// Copy driver.sys file across
CString DriverFullPath = System32Directory+"\\Drivers\\"+DriverName+".sys";
if (0==CopyFile( DriverFromPath, DriverFullPath, FALSE)) // Overwrite OK
{
CString Msg;
Msg.Format("Could not copy %s to %s", DriverFullPath, Drivers);
AfxMessageBox(Msg);
return;
}
///////////////////////////////////////////////////////////////////
// Create driver (or stop existing driver)
if (!CreateDriver(DriverName, DriverFullPath)) return;
///////////////////////////////////////////////////////////////////
// Create/Open driver registry key and set its values
//Overwrite registry values written in driver creation
HKEY mru;
DWORD disposition;
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\"+DriverName,
0, "", 0, KEY_ALL_ACCESS, NULL, &mru, &disposition) != ERROR_SUCCESS) {
AfxMessageBox("Could not create driver registry key");
return;
}
// Delete ImagePath
RegDeleteValue(mru,"ImagePath");
// Delete DisplayName
RegDeleteValue(mru, "DisplayName");
// ErrorControl
DWORD dwRegValue = SERVICE_ERROR_NORMAL;
if (RegSetValueEx(mru, "ErrorControl", 0, REG_DWORD, (CONST BYTE*)&dwRegValue, sizeof(DWORD)) != ERROR_SUCCESS) {
AfxMessageBox("Could not create driver registry value ErrorControl");
return;
}
// Start
dwRegValue = SERVICE_AUTO_START;
if (RegSetValueEx(mru, "Start" , 0, REG_DWORD, (CONST BYTE*)&dwRegValue, sizeof(DWORD)) != ERROR_SUCCESS) {
AfxMessageBox("Could not create driver registry value Start");
Интервал:
Закладка:
Похожие книги на «Writing Windows WDM Device Drivers»
Представляем Вашему вниманию похожие книги на «Writing Windows WDM Device Drivers» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.
Обсуждение, отзывы о книге «Writing Windows WDM Device Drivers» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.