Building Drivers for Different Versions of Windows
https://docs.microsoft.com/en-us/windows-hardware/drivers/develop/building-drivers-for-different-versions-of-windows
Client OS Server OS
Windows 10 Windows Server 2019, Windows Server 2016
Windows 8.1 Windows Server 2012 R2
Windows 8 Windows Server 2012
Windows 7 Windows Server 2008 R2 SP1
Operating system Version number
Windows 10 10.0*
Windows Server 2019 10.0*
Windows Server 2016 10.0*
Windows 8.1 6.3*
Windows Server 2012 R2 6.3*
Windows 8 6.2
Windows Server 2012 6.2
Windows 7 6.1
Windows Server 2008 R2 6.1
Windows Server 2008 6.0
Windows Vista 6.0
Windows Server 2003 R2 5.2
Windows Server 2003 5.2
Windows XP 64-Bit Edition 5.2
Windows XP 5.1
Windows 2000 5.0
wdk download
https://docs.microsoft.com/en-us/windows-hardware/drivers/other-wdk-downloads
install
devcon install esvf.inf root\esvf
remove
devcon.exe remove Root\esvf
AddDevice routine
Any driver that supports PnP must have an AddDevice routine. The AddDevice routine creates one or more device objects representing the physical,
logical, or virtual devices for which the driver carries out I/O requests. It also attaches the device object to the device stack, so the device
stack will contain a device object for each driver associated with the device.
The PnP manager calls a driver's AddDevice routine for each device controlled by the driver. AddDevice routines are called during system initialization
(when devices are first enumerated), and any time a new device is enumerated while the system is running.
1.start driver
2.stop driver
3.begin to capture
4.stop captueing
1.tracewpp : error wpp: Unable to open file 'Trace.h', error code 2
解决方案:
右键项目名-属性-WPP Tracing--->【Run Wpp Tracing】选择 <否> 即可。
https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/wpp-software-tracing
Differences Between WDM and WDF
https://docs.microsoft.com/en-us/windows-hardware/drivers/wdf/differences-between-wdm-and-kmdf
The WDM model is closely tied to the operating system. Drivers interact directly with the operating system by calling system service routines and manipulating operating system structures.
Because WDM drivers are trusted kernel-mode components, the system provides limited checks on driver input.
In comparison, the Windows Driver Frameworks (WDF) model focuses on the driver’s requirements, and the framework library handles the majority of the interactions with the system.
The framework intercepts I/O requests, takes default actions where appropriate, and invokes the driver’s callbacks as required. The WDF model is object based and event driven.
Objects represent common driver constructs, such as a device, a lock, or a queue. A Kernel-Mode Driver Framework (KMDF) or User-Mode Driver Framework (UMDF) driver contains an
entry point (DriverEntry), the event-related callback functions that are required to service the device and support I/O, and any additional internal utility functions on which
the implementation depends.
Redistributable Framework Components
https://docs.microsoft.com/en-us/windows-hardware/drivers/wdf/installation-components-for-kmdf-drivers
Building and Loading a WDF Driver
KMDF Version History
https://docs.microsoft.com/en-us/windows-hardware/drivers/wdf/kmdf-version-history
KMDF version Release method Included in this version of Windows Drivers using it run on
1.29 Not released in WDK Windows 10, version 1903 (March 2019 Update, 19H1) Windows 10, version 1903 and later
1.27 Windows 10, version 1809 WDK Windows 10, version 1809 (October 2018 Update, Redstone 5) Windows 10, version 1809 and later
1.25 Windows 10, version 1803 WDK Windows 10, version 1803 (April 2018 Update, Redstone 4) Windows 10, version 1803 and later
1.23 Windows 10, version 1709 WDK Windows 10, version 1709 (Fall Creators Update, Redstone 3) Windows 10, version 1709 and later
1.21 Windows 10, version 1703 WDK Windows 10, version 1703 (Creators Update, Redstone 2) Windows 10, version 1703 and later
1.19 Windows 10, version 1607 WDK Windows 10, version 1607 (Anniversary Update, Redstone 1) Windows 10 version 1607, Windows Server 2016 and later
1.17 Windows 10, version 1511 WDK Windows 10, version 1511 (November Update, Threshold 2) Windows 10 version 1511, Windows Server 2016 and later
1.15 Windows 10 WDK Windows 10, version 1507 (Threshold 1) Windows 10, version 1507, Windows Server 2016 and later
1.13 Windows 8.1 WDK Windows 8.1 Windows 8.1 and later
1.11 Windows 8 WDK Windows 8 Windows Vista and later
1.9 Windows 7 WDK Windows 7 Windows XP and later
1.7 Windows Server 2008 WDK Windows Vista with Service Pack 1 (SP1), Windows Server 2008 Windows 2000 and later
1.5 Windows Vista WDK Windows Vista Windows 2000 and later
1.1 Download only None Windows 2000 and later
1.0 Download only None Windows XP and later
vgremove -f `vgdisplay | grep "VG Name" | awk {'print $3'}`
Provision a computer for driver deployment and testing (WDK 10)
https://docs.microsoft.com/en-us/windows-hardware/drivers/gettingstarted/provision-a-target-computer-wdk-8-1
System-Defined Device Setup Classes Available to Vendors
https://docs.microsoft.com/en-us/windows-hardware/drivers/install/system-defined-device-setup-classes-available-to-vendors
Storage Volumes
Class = Volume
ClassGuid = {71a27cdd-812a-11d0-bec7-08002be2092f}
This class includes storage volumes as defined by the system-supplied logical volume manager and class drivers that create device objects to represent storage volumes,
such as the system disk class driver.
METHOD_IN_DIRECT is specified if the driver that handles the IRP receives data in the buffer when it is called. The MDL describes an input buffer, and specifying METHOD_IN_DIRECT ensures that the executing thread has read-access to the buffer.
METHOD_OUT_DIRECT is specified if the driver that handles the IRP will write data into the buffer before completing the IRP. The MDL describes an output buffer, and specifying METHOD_OUT_DIRECT ensures that the executing thread has write-access to the buffer.
For both of these transfer types, Parameters.DeviceIoControl.OutputBufferLength specifies the size of the buffer that is described by the MDL.