D3hot and D3cold power states, 168
data buffers, 34–35
data members (COM), 587
data structures, 24–30
data transfer process, 35–36
USB devices, 357–358
DBH tool, 19
Dc2 (Device Path Exerciser), 671–672
DDI (device driver interface), 47
for KMDF, 71
for UMDF, 69
DDI order rules (KMDF), 847
Deadlock Detection option (Driver Verifier), 678, 680
deadlocks, 41
Driver Verifier deadlock detection, 45, 678, 680
WdfDeviceStopIdle method and, 211
debug print statements, converting to ETW, 413, 418
debugger extensions, 14
Debugging Tools for Windows package, 18–19, 699
debugging WDF drivers, 693–694, 697–730. See also testing
annotations. See PREfast for Drivers
breaking into debugger, 688
Fx2_Driver sample driver (example), 716–721
IRQL problems, testing for, 521–523
Osrusbfx2 sample driver (example), 721–725
preparing for (KMDF), 711–716
preparing for (UMDF), 706–710
reference counts, 591
system requirements for, 12
tools for, 18–19, 698–699. See also specific debugging tool by name
tracing. See tracing
using PREfast. See PREfast for Drivers
verification information for, 684–686, 689–690
versioning and, 637
WDF debugger extensions, 14, 63
WDF driver installations, 663–666
WinDbg for, 63, 698, 699–706
commands, 702
extensions, 704–706
installation error debugging, 663
KMDF debugging session, starting, 714–715
suggestions for experimenting, 729–730
viewing KMDF log, 726–729
viewing trace messages, 725–726
default child list (device property), 145
default I/O callbacks, 289–291
default I/O dispatchers, 311
default I/O queue, 145
default I/O targets, 57, 145, 308
formatting requests for, 331–334, 341–343
retrieving, 313
default queue, creating and initializing, 262–263, 265–266
default synchronization scope, 392–393
deferred interrupt processing, 546–547
deferred procedure calls (DPCs), 37, 47, 103, 114, 514–515, 546–547
deleting, 115, 120
synchronization scope, 395–396
deferred processing for interrupts, 546–547
DeferredRequestCompleted rule, 849
delay time for WUDFHost, setting, 706–707
Deleted state (I/O targets), 319, 340
DeleteWdfObject method (IWDFObject), 115, 313, 353
deleting objects, 111–112, 115–122
defined, 112
KMDF drivers, 115
memory objects, 447
UMDF drivers, 113
_deref modifier, 761, 765
dereferencing user-mode pointers, 45
[DestinationDirs] section, INF files, 644
destroy callbacks, 118
destruction of objects, defined, 112
DevCon utility, 637, 658–659, 671
uninstalling drivers, 662–663
device callback objects. See also callbacks
Skeleton sample driver, 484–486
device characteristics (device property), 145
device descriptors for USB devices, 356–357
device driver interface (DDI), 47
for KMDF, 71
for UMDF, 69
device enumeration
child devices, 143, 157–159
startup and, 180–183
device hardware resources. See hardware resources
device I/O control requests, 33, 48, 225–226, 242
control codes for, 226–227, 228
event callbacks for, 282–291
formatting for I/O targets, 331–333
internal, 228, 242, 322
synchronous, 337
device initialization roles (KMDF), 848
device instance ID (device property), 145
device interfaces, 148
names for KMDF drivers vs., 159
device IRQLs (DIRQLs), 38, 511, 516
guidelines for running at, 517
synchronized processing at, 547
synchronizing, 41
Device Manager, uninstalling drivers with, 662
Device Manager, updating drivers with, 659
device name (device property), 145
device objects, 28–29, 47, 97, 102, 114, 140–147, 152
callback objects for, 100
context areas for, 126
creating, 155
creation and initialization, 149–157
deleting, 115, 120
initializing, 146–147
in object hierarchy, 111–113
pointers to, I/O targets vs., 318
properties, 145–146
types of, 140
Device Path Exerciser (Dc2), 671–672
device power-down, 178–179
device removal and, 184–187
self-managed I/O during, 300–301
device power states, 168–169
device property stores, 99, 447–450
device registers, mapping, 530
device removal
power-down and, 184–187
self-managed I/O during, 300–301
surprise, 178
device restart, 178–179
device enumeration and, 180–183
self-managed I/O during, 300
device scope (synchronization), 387, 393
device shutdown. See device power-down
device stack, 28–29, 47
I/O request flow through, 234–236, 308. See also default I/O targets
IRP management, 33–34
power states, 176–177
UMDF infrastructure, 77–78
device startup, 178–179
device enumeration and, 180–183
self-managed I/O during, 300
device state (device property), 145
device support, 85–89
device tree, 29–30
device uninstallation, 660–661
Device.cpp and Device.h files, 477
DeviceInitAllocate rule, 848
DeviceInitAPI rule, 848
DeviceIoControl function, 33, 225
devnode, defined, 47
diagnosing with software tracing. See tracing
DIFxApp (Driver Install Frameworks for Applications), 636, 657–658
uninstalling drivers, 662
digital certificates, 654
digitally signing driver packages, 653–655
direct I/O, 34–35, 228, 230
retrieving buffers in KMDF drivers, 249
direct memory access (DMA), 549–581
basics and terminology, 550–552
best practices, 581
device information, 552–555
implementing DMA drivers, 564–577
testing drivers, 577–581, 668–669
Windows DMA abstraction, 555–563
direction of transfer, 355
directives in INF files, 643–644
DIRQLs (device IQLs), 38, 511, 516
guidelines for running at, 517
synchronized processing at, 547
synchronizing, 41
Dirs file, 621
Disable_Enable_With_IO.wsf script, 676
disconnecting interrupts, 540
disk I/O path, 43
Disk Integrity Checking option (Driver Verifier), 678
DISPATCH_LEVEL IRQLs, 38, 392, 396, 511–512, 514–515
guidelines for running at, 517
object cleanup, 121
synchronizing, 41
dispatch types for I/O queues, 56, 259, 385–386
device scope and (synchronization), 388–389
disposal of objects, 112
distributing driver packages, 655
.dll files, 623
DLL infrastructure for UMDF drivers, 478–480, 600–606
DLLDEF macro, 628
DLLENTRY macro, 628
DllGetClassObject function, 130–132, 479–480, 585, 600, 602–603
DllMain function, 130–132, 478–479, 585, 600–601
debugging, 708
Dllsup.cpp file, 476
DMA (direct memory access), 549–581
basics and terminology, 550–552
best practices, 581
device information, 552–555
implementing DMA drivers, 564–577
testing drivers, 577–581, 668–669
Windows DMA abstraction, 555–563
DMA chaining. See scatter/gather technique
DMA common buffer objects, 102, 114, 147
deleting, 115, 121
!dma debugger extension, 579
DMA design type, 553
DMA enabler objects, 103, 114, 147, 566–567
deleting, 115
DMA transaction objects, 103, 114, 147, 550, 567–569
deleting, 115
DMA transfers, 550
flushing caches for, 557
maximum transfer length, 554
DMA Verification option (Driver Verifier), 678, 680
DO_DEVICE_INITIALIZING annotation, 809
DO_POWER_PAGEABLE flag, 175
documentation, debugging tools, 19
documentation, WDK, 14–15
DoTraceMessage macro, 417–418
DoubleCompletion rule, 849
DoubleCompletionLocal rule, 849
Down device object (UMDF device stack), 79, 81
downloading. See obtaining (downloading)
DPCs (deferred procedure calls), 37, 47, 103, 114, 514–515, 546–547
deleting, 115, 120
synchronization scope, 395–396
DPInst application, 636, 657–658
Drain method (IWDFIoQueue), 260
DrainSynchronously, 260
driver annotations, 774–778
for __try statement functions, 790
conditional, 779–783
constant and non-constant parameter, 788
diagnostic, 789
DO_DEVICE_INITIALIZING, 809
for error messages, 790
examples, 810–812
floating-point, 801–802
format string, 788–789
for function results, 784–785
function type class, 799–801
for interlocked operands, 809–810
IRQL, 802–809
memory, 790–792
nonmemory, 792–799
Osrusbfx2 sample driver (example), 818–822
pointing, 787–788
type-matching, 785–787
driver architecture, 27–28
driver binary files, 623, 642, 661
driver callback objects. See also callbacks
Skeleton sample driver, 481–484
driver code. See source code
driver crash, debugging, 710
driver-created objects, 70
context areas for, 124, 126
deleting, 116
file objects, 98
I/O requests
deleting, 118
memory objects and buffers for, 323–330
parents of, 113
driver-created subrequests, 408–410
driver development vocabulary, 47–49
Driver Hand Verification option (Driver Verifier), 678
Driver Install Frameworks for Applications (DIFxApp), 636, 657–658
driver load, debugging, 706–708, 715
driver manager, 78
driver objects, 97, 135–140
callback objects for, 100
deleting, 116
as root objects in hierarchy, 110, 112–113, 114
Driver Package Installer (DPInst), 636, 657–658
driver packages, defined, 47. See also installing WDF drivers
driver projects, how to build, 622–624
driver-specific coding practice errors, detecting, 733
driver stack, 28
driver store, deleting packages from, 661
driver structure
device interfaces, 148
names for KMDF drivers vs., 159
objects. See device objects; driver objects
required components, 129–135
driver testing. See testing WDF drivers
driver threads and work items, 523–527
driver tracing, 411–439, 699
basics of, 412–417
best practices, 439
how to support, 420–432
message functions and macros, 417–419
running a trace session, 433–439
tools for, 63, 432–433
viewing messages with WinDbg, 725–726
driver verification. See testing WDF drivers; verifying drivers
Driver Verifier, 46, 677–686. See also testing WDF drivers
deadlock detection, 45, 678, 680
examples, 679–684
Force IRQL Checking option, 45, 678, 680, 683–684
IRQL problems, testing for, 523
testing DMA drivers, 578–579
driver versioning, 63–64, 637
DriverCLSID directive, 648
Driver.cpp and Driver.h files, 477
DriverCreate rule, 847
DriverEntry function, 133–134, 137–140
thread context, 510
drivers, defined, 24–30
/drivers parameter (Driver Verifier), 680
__drv annotations, 774–778
for __try statement functions, 790
basic, 777–779
conditional, 779–783
constant and non-constant parameter, 788
diagnostic, 789
DO_DEVICE_INITIALIZING, 809
for error messages, 790
examples, 810–812
floating-point, 801–802
format string, 788–789
for function results, 784–785
function type class, 799–801
for interlocked operands, 809–810
IRQL, 802–809
memory, 790–792
nonmemory, 792–799
Osrusbfx2 sample driver (example), 818–822
pointing, 787–788
type-matching, 785–787
!dumpobjects debugger extension, 710
dynamic enumeration of child devices, 143
in bus drivers, 157–158
dynamic verification tools, 669. See also Driver Verifier
Application Verifier, 693–694
KMDF Verifier, 45, 687–690
UMDF Verifier, 690–693