【驱动】Visual Studio 2022 驱动开发环境准备

概述:驱动开发环境准备

[toc]

步骤一 安装sdk与wdk

安装windows相关的sdk

参考微软文档:下载 Windows 驱动程序工具包 (WDK) - Windows drivers | Microsoft Learn

步骤二 调试与安装工具

步骤三 驱动框架

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <ntddk.h>

// #include <ntifs.h>

NTSTATUS UnloadDriver(PDRIVER_OBJECT pDriver)
{
DbgPrint("Bye, Driver");
}

NTSTATUS DriverEntry(PDRIVER_OBJECT pDriver, PUNICODE_STRING pReg)
{
DbgPrint("Hello World, Driver");
DbgPrint("DRIVER ADDress, [%]");
DbgPrint("Hello World, Driver");

pDriver->DriverUnload = UnloadDriver;

return STATUS_SUCCESS;
}

步骤三 Visual Studio配置

  1. C/C++ -> 常规 -> 将警告视为错误 -> 否
  2. C/C++ -> 常规 -> 警告等级 -> 等级3(也可忽略)
  3. 驱动运行环境
  4. inf2cat -> 否
  5. 编译运行,会生成sys文件

其他补充

禁用界面输出无用信息

1
2
ed nt!Kd_SXS_Mask
ed nt!Kd_FUSION_Mask

【驱动】Visual Studio 2022 驱动开发环境准备
https://hodlyounger.github.io/A_OS/Windows/驱动/windows驱动开发教程/驱动开发准备(VS2022)/
作者
mingming
发布于
2023年10月27日
许可协议