Writing WDF Drivers: Advanced Implementation Techniques for Microsoft Students
This fast-paced 4-day lab seminar is designed for students with experience writing WDF drivers or who have previously taken OSR’s Writing WDF Drivers: Core Concepts seminar. Through a mixture of lectures and lab assignments, students expand their knowledge into new areas of WDF and learn practical methods for dealing with design challenges that are common in more complex WDF drivers
Picking up from where our Writing WDF Drivers I: Core Concepts seminar leaves off, this seminar takes you beyond the simple use of Queues, Requests, I/O Event Processing Callbacks, and I/O Targets. The class does not limit itself to WDF-based solutions, but also demonstrates how specific WDM concepts can be used within WDF drivers to build optimal solutions. The class describes architectural concepts while stressing practical techniques and solutions applicable to WDF drivers. For example, different methods of driver to driver communication are described, compared, the advantages and disadvantages discussed, and suggestion for when using each might be most appropriate are presented. The class follows this same approach for user-mode to kernel-mode communications: alternative methods are described, the strengths and challenges inherent in each are reviewed, and recommendations on when each might be the best choice are discussed.
The class also takes the time to delve into more complex areas that are not covered our Writing WDF Drivers I: Core Concepts seminar. These includes Bus Drivers, DMA (including both the Windows DMA abstraction), and the latest in terms of best practices for driver testing and validation.
Length: 4 days
Format: Lecture and Lab
Cost and Date: Please see Learning Central for the latest information.
For More Info
Please email OSR’s Seminar Team or call 603-595-6500
This seminar is designed for engineers who design, develop or test WDF drivers and already know basic WDF concepts. Engineers who want to understand multiple techniques (and current best practices) for solving a variety of common driver problems using WDF will maximally benefit from this seminar. Please carefully review the required prerequisites, below, as this seminar is not suitable for beginners.
Previous attendance at OSR’s Writing WDF Drivers: Core Concepts seminar is explicitly assumed. Because this is a hands-on class, a working knowledge of C/C++, Visual Studio, and Windows are required.
Please note that due to the intensive nature of this seminar, the instructor will not be able to slow-down the pace of this seminar to accommodate students who have not taken the prerequisite OSR seminar.
As an alternative to having taken OSR’s Writing WDF Drivers: Core Concepts, attendees may substitute actual hands-on experience implementing WDF drivers with the approval of the OSR seminar staff. This experience includes a solid understanding of Windows OS and I/O subsystem architecture, as well as working knowledge of basic WDF concepts (the object model, the use of Queues, Requests, and I/O Event Processing Callbacks). Also assumed is a solid understanding of IRQLs, DPCs, multi-threaded operation, and locking in WDF drivers. A basic understanding of driver installation procedures and INF files are also assumed.
If you have not taken OSR’s Writing WDF Drivers: Core Concepts, please talk with or email the OSR seminar staff before registering to ensure you’ll be comfortable with the starting level of this seminar.
Laptop Setup Requirements
Each student will need to bring a pre-configured and tested laptop with them to the seminar. This laptop will be used for doing lab assignments.
The hardware and software requirements for this seminar are described on our OSR Seminar Laptop Setup Requirements page.
You’ll note that the class requires VMware for your laptop. And you’re probably wondering if you can substitute Hyper-V in place of VMWare Player or VMWare Workstation in class. The answer to this is “probably not, we don’t recommend it.” We want to be able to properly support you during your seminar experience, with answers to your questions and assistance with any problems you may discover. Because we use VMWare for development internally at OSR, it’s the virtualization platform that we fully understand and that we’re confident we can help you with. If you *really* want to use Hyper-V, you can… but only if all of the following three conditions are true:
- You have significant, hands-on, experience configuring and using Hyper-V as a kernel debugging target for driver testing. This includes configuring the Hyper-V guest system as a debug target for WinDbg running on the host system.
- You will not require any help using, installing, configuring, or managing Hyper-V from the OSR seminar staff during your seminar.
- You do not want to do be able to try any of the USB-related labs. Doing these labs requires “assigning” the OSR USB FX2 device we provide you for exclusive use of the VM Guest. While VMWare supports this feature, Hyper-V does not (at least as far as we can determine).
If you have any questions, don’t hesitate to contact OSR’s Seminar Team.
Welcome remarks, seminar goals and objectives.
- Review of WDF and I/O Subsystem Basics
All the basics of WDF and the Windows I/O Subsystem in about two hours, with some explicit descriptions of how WDF concepts relate to WDM added to keep things interesting. This fast-paced module reviews how device stacks are built, how Requests are passed from driver to driver, the WDF object model, common Event Processing Callbacks, I/O Targets and Completion Callbacks are all discussed. In addition, some details about the WDM PnP and Power Management events that stimulate specific WDF events are presented.
- Driver to Driver Communication – Going Beyond I/O Targets
A discussion of different methods driver can use to communicate, the advantages and disadvantages of each, and when each might be most appropriate. PnP notification, bus interfaces, and driver-defined through-call structures are all discussed. This module ends with a code walk-through of a chosen solution.
- WDF Bus Drivers
In this module, we discuss the WDF bus driver model including static and dynamic enumeration of child devices. Providing resources to child devices, and raw PDO usage are discussed. When it makes sense to implement a software-only bus driver. The module ends with a code walk-though of a KMDF bus driver that does static child enumeration.
- Best Practices for WDF Driver Quality, Debugging and Serviceability
A brief discussion of how best to use the myriad tools availability to WDF driver developers. Practical advice on and current best practices for the use of KMDF Verifier, Windows Driver Verifier, Static Driver Verifier, Code Analysis, and even the checked build of Windows are provided.
LAB: Driver to Driver Communications
- Kernel-Mode to User-Mode Communication – Going Beyond Simple Requests
A discussion of how to safely use Neither I/O (validating user buffers and the use of structured exception handling), Fast I/O for Device Control, and optimizations in the inverted call model. How to safely share memory and certain specific objects between user-mode and kernel-mode is also discussed. The module ends with the review of a case study of a low-latency process control device and its WDF driver.
- Debugging Invalid Memory Access Problems
No crash is more common in a Windows driver than one due to dereferencing a bad pointer, or referencing a good pointer at the wrong IRQL. In this module, we’ll discuss how Windows traps invalid memory references, and the specific differences between the bug check codes IRQL_NOT_LESS_OR_EQUAL, PAGE_FAULT_IN_NONPAGED_AREA, and KERNEL_DATA_INPAGE_ERROR, with the goal of making it easier and faster to debug commonly encountered driver problems.
[space size=”10″]LAB: User to Kernel Communications[space size=”10″]
- Busmaster DMA
This module starts with a discussion of the Windows DMA abstraction including map registers, system scatter/gather support, and more. We then review the WDF DMA model (Enabler and Transaction Objects). A few brief words on System DMA (yes, it still exists!) are also presented. The module concludes with a code walk-through demonstrating typical KMDF DMA data handling.
- Practical Problems, Practical Solutions
This module comprises a discussion of some common problems and good solutions to these problems. Included among the topics discussed: Why relying on WDF object parenting for child object destruction isn’t always as simple as it seems. The cause of bugcheck code 0x9F and the when you need to implement EvtIoStop. Work Queues and the High Priority Worker Effect. Using reader/writer spinlocks to efficiently read and update shared data. How to protect state teardown using Rundown references.
- Introducing: UMDF V2.0
UMDF is new with Windows 8.1, and most engineers haven’t yet had a chance to experiment with it. In this module, we briefly discuss this new user-mode driver model. Specifically, we discuss what’s supported and when UMDF 2 is most applicable. We also provide hints for moving from KMDF to UMDF 2.[space size=”10″]LAB: UMDF V2.