Книга: Writing Windows WDM Device Drivers
Сноски из книги
· #1There are several other IRPs which are only generated by the kernel in response to kernel related events. For example, when the system decides to powers down, a Power IRP is sent all drivers.
· #2In NT and W2000 you can use the QueryDosDevice Win32 function to obtain a list of all symbolic links. I am not sure how useful this list is.
· #3You are also supposed to queue IRPs that arrive while your device is sleeping. The simple solution to this problem is to wake up your device when an IRP arrives.
· #4I used this approach when writing this book. My initial contents were completely different from the end result, and I rewrote these initial chapters after the rest of the book was complete.
· #5If a file system driver is fetching a page back into memory then the IRQL may be APC_LEVEL.
· #6NT 3.51 drivers should use zone buffers, which are now obsolete.
· #7Actually, the kernel stack may be paged if a driver issues a user-mode wait (e.g. in KeWaitForSingleObject).
· #8You will probably need to ensure that the Windows 98 environment space size is at least 2048 for device driver development.
· #9The PHDIo and Wdm3 drivers are not included in the compilation list as they do not compile in Windows 98.
· #10Be careful if initializing strings in paged code segments or code segments that are discarded after initialization. The Buffer data has the attributes of the underlying code segment and so may not be available when you want to access it. Chapter 14 gives an example in which I initially got this wrong.
· #11If you call IoAttachDeviceToDeviceStack at a higher IRQL, your driver may crash.
· #12If you are only compiling in W2000, you can include initguid.h instead.
· #13CancelIo first became available in NT 4 and W98.
· #14Blocking in dispatch routines is not recommended as it defeats the purpose of overlapped operations.
If the driver processes IRPs one by one, it could store this information in its device extension.
· #16The first driver must disable its device interrupts, reprogram its hardware, and then enable interrupts again.
· #17Both FDOs and PDOs use exactly the same DEVICE_OBJECT structure.
· #18I don't know for sure because I don't know how they work. And I don't care!
· #19For ACPI systems, the ACPI bus driver implements the root device.
· #20However, note that the USB OpenHCI driver accesses hardware directly, once it has its configuration information from the PCI bus driver.
· #21Non-WDM NT style drivers may use more than one full resource descriptor.
· #22Obviously, this may well change in 64-bit systems.
· #23BROADCAST_QUERY_DENY has a value of 0x424D5144, ASCII "BMQD", which I presume stands for Broadcast Message Query Deny!
· #24I think PDOs must be created with FILE_AUTOGENERATED_DEVICE_NAME as the DeviceCharacteristics parameter to IoCreateDevice.
· #25Note that there are various optional elements to the ACPI, but the PC99 specification makes several of these mandatory.
· #26I think that this is because you are already processing a Power IRP and only one such IRP can be active at a time.
· #27See 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.
· #28NT style drivers may well work in Windows 98, as well. See the next section for details.
· #29NT 4 driver writers can write an OEMSETUP.INF or TXTSETUP.OEM script to install their drivers. See the NT 4 DDK for details.
· #30In Windows 98, select the Control Panel "Add/Remove Programs" applet. Click the Windows Setup tab. Highlight the Internet Tools options. Click on Details. Check the "Web-based Enterprise Mgmt" box. Click OK to proceed with the installation. You will need the WBEM core kit and possibly other components for NT 4 and Windows 95.
· #31Since writing this chapter, the test driver DebugPrint code has changed from C++ to C. The code on the book software disk is slightly different from the code printed in this chapter, though they are functionally identical.
· #32I.e., soon after the Gregorian calendar was introduced in 1582.
· #33The NT 4 DDK wrongly states that RemoveHeadList and RemoveTailList return NULL if the list is empty.
· #34See Chapter 19 for the best way to talk to a parallel port in NT and W2000.
· #35You might want to add another IOCTL that tells you which resources a device is using, so applications know which WdmIo device to use.
· #36Or for that matter, an application must not fire off several overlapped requests at the same time.
· #37If there is more than one WdmIo device, each device has a device queue that can be processed simultaneously by WdmIoStartIo.
· #38Note that the IoStartNextPacket implementation will, in fact, call WdmIoStartIo recursively (if there is another IRP in the queue). In the worst case, this recursive technique could overflow the kernel stack. One of the DDK examples shows a way of avoiding this problem by not queuing an IRP if the queue is "full".
· #39At the last moment, I have moved this code back into WdmIoStartIo. RunCmds may not run at DIRQL and it is incorrect to allocate nonpaged memory above DISPATCH_LEVEL.
· #40In fact, the I/O Manager could work out if an IRP is in the device queue.
· #41You may also decide to queue IRPs while a device is asleep. The example drivers in this book opt to wake up the device when an I/O request arrives.
· #42Note that the interrupt level is not the same as the IRQ number. IRQ7 has interrupt level 20.
· #43Actually, the commands could take a long time to run if the Win32 application includes large delay commands. However, moving the command processing to the DPC would not help, as a Critical section routine would have to be run, bringing the IRQL back up the DIRQL.
The LockDevice and UnlockDevice routines are still used and so have been moved from Pnp.cpp into Init.cpp.
· #45I do not know where they go in Windows 98.
· #46You can also access the HID class driver in a user-mode client application.
· #47The only alternative is to remove the parport, parallel, and parvdm drivers, which would stop any existing parallel port access.
· #48See Chapter 23 for details of IoGetDeviceObjectPointer.
· #49Note that there are two uses of the word "class". Device drivers use the Windows USB class drivers to get access to the USB system. Each USB device can be categorized as a basic USB device, or as belonging to a class of USB devices such as HID, printer, etc.
· #50The Windows 2000 DDK defines the Interface power descriptor structure. However, it is not apparent whether this information is used by the system USB class drivers.
· #51Presumably to avoid unnecessary copying of large buffers.
· #52Unlike a processor execution stack, there is nothing wrong with altering the next item down the stack.
· #53The UsbGetIdleRate routine shows how to read the idle rate.
· #54Note that the call to UsbBuildInterruptOrBulkTransferRequest must be in the loop for it to work in W2000.
· #55Using KeQuerySystemTime is less efficient.
· #56In Windows 98, I found that I could not type on my HID keyboard after a reboot.
· #57This is called Draft#4 compliance. An older Draft#3-compliant device returns the HID descriptor after the endpoint descriptors.
· #58Kernel mode HID clients can get and set the ring buffer size using two IOCTLs.
· #59The device to which you are connecting must accept a Create IRP call with an empty filename.
· #60So far, we have not considered how the kernel calls our driver. However, to be most efficient, we should not block while processing an IRP for very long. Blocking in a Power or PnP IRP handler or a system thread is fine.
- Preface
- Chapter 1 Introduction
- Chapter 2 The Big Picture
- Chapter 3 Device Driver Design
- Chapter 4 WDM Driver Environment
- Chapter 5 Device Interfaces
- Chapter 6 Testing and Debugging
- Chapter 7 Dispatch Routines
- Chapter 8 Plug and Play and Device Stacks
- Chapter 9 Plug and Play Implementation
- Chapter 10 Power Management
- Chapter 11 Installation
- Chapter 12 Windows Management Instrumentation
- Chapter 13 Event Reporting
- Chapter 14 DebugPrint
- Chapter 15 WdmIo and PHDIo Drivers
- Chapter 16 Hardware I/O IRP Queuing
- Chapter 17 Interrupt-Driven I/O
- Chapter 18 NT Hardware
- Chapter 19 WDM System Drivers
- Chapter 20 The Universal Serial Bus
- Chapter 21 USB Driver Interface
- Chapter 22 The Human Input Device Model
- Chapter 23 HID Clients
- Appendix A Information Resources
- Appendix B PC 99
- Appendix C Direct Memory Access
- Glossary Acronyms and Tools
- Сноски из книги
- Содержание книги
- Популярные страницы