Windows Driver Kit (WDK) 包含各种驱动程序的示例源代码。这些示例可在您编写自己的驱动程序时提供有用指导。在安装 WDK 时,示例将安装到 src 目录的子目录中。
下表列出了一些 示例子目录及其内容。
示例子目录 | 内容 |
---|---|
srcaudio | 音频驱动程序的各种示例。 |
srcfilesys | 文件系统驱动程序的各种示例。 |
srcgeneral | 用户模式驱动程序和内核模式驱动程序的各种示例,其中包括全面的“toaster”示例。包括使用用户模式驱动程序框架 (UMDF)、内核模式驱动程序框架 (KMDF) 和 Windows 驱动模型 (WDM) 接口的驱动程序。 |
srcinput | 键盘和鼠标类筛选器驱动程序。 |
srcmmedia | 音频压缩管理器 (ACM) 软件编解码器。 |
srcnetwork | 各种类型的网络驱动程序的示例。 |
srcprint | 打印机和绘图仪的示例驱动程序以及其他 DLL 和工具。 |
srcsetup | 示例 INF 文件和安装应用程序。 |
srcsmartcard | 串行和 PCMCIA 智能卡读卡器的驱动程序。 |
srcstorage | 各种类型的存储设备的示例驱动程序。 |
srcusb | USB 设备的示例驱动程序。包括基于 UMDF 的驱动程序和基于 KMDF 的驱动程序。 |
srcvideo | 示例显示驱动程序和镜像驱动程序。 |
有关 WDK 示例的更多信息,请参见 Windows Driver Kit 示例。此外,请参见此 WDK 中设备类型特定的文档。
如果选择将代码基于一个或多个示例,请记住以下几点:
- 一些示例不是完整的驱动程序,但提供了有关如何编写此类驱动程序的指南。例如,为了简洁明确起见,示例可能忽略错误处理代码。
- 确保使用针对正在编写的驱动程序的类型编写的驱动程序示例。例如,如果正在编写 WDM 函数驱动程序,则使用示例 WDM 函数驱动程序。如果正在编写存储筛选器驱动程序,则使用示例存储筛选器驱动程序。
- 确保更新驱动程序的示例 INF 文件。特别是,确保硬件的设备 ID 与 INF 文件中指定的设备 ID 匹配。
https://msdn.microsoft.com/zh-cn/library/ff554845(v=VS.85).aspx
Windows 10 driver development
Get the Windows 10 Driver Kit (WDK) and other tools you need to build, test, and deploy your drivers and Windows Store apps. With Windows 10, the driver development environment and the Windows debuggers are integrated into Visual Studio.
Download kits and tools
Windows 10 Driver Kit (WDK)
Take a look at the compilation of the new and changed driver-related content for Windows 10. Areas of improvement include camera, print, display, Near Field Communication (NFC), WLAN, Bluetooth, and more.
Find out what’s new in the WDK
Universal Windows drivers
Write one driver that runs on both Windows 10 for desktop editions and Windows 10 for mobile devices, as well as other Windows 10 editions that share a common set of interfaces.
Build your Universal Windows drivers
Build your first driver
If you're writing your first driver, use these exercises to get started. Each exercise is independent of the others, so you can do them in any order.
Write a UMDF driver based on a template
Write a KMDF Hello World driver
Write a KMDF driver based on a template
Samples
Use samples to guide your Windows driver development. Whether you’re just getting started or porting an older driver to the newest version of Windows, code samples are valuable guides on how to write drivers.
Get the WDK sample pack
Windows Driver Frameworks
Windows Driver Frameworks (WDF) is a set of libraries that you can use to develop device drivers that are interoperable with Windows. WDF is comprised of Kernel-Mode Driver Framework (KMDF) and User-Mode Driver Framework (UMDF).
WDF driver development guide
Hardware development boards
Windows compatible hardware development boards offer an affordable, yet powerful development system targeted towards the hardware developer, IHV, OEM or any other developer that loves to incorporate hardware in their projects and needs the power of a full PC.
Learn about Windows compatible hardware development boards
Partner app development
Make your apps available to customers at first boot. With Windows 10, OEMs can create preinstalled apps for immediate brand differentiation and functionality, create system settings apps that let users control hardware properties, and configure mobile broadband on PCs.
Learn about partner app development