使用VsCode开发Windows驱动
使用VsCode开发Windows驱动
xmake.lua
add_rules("mode.debug", "mode.release")
target("xmake_wdm_test")
do
add_rules("wdk.driver", "wdk.env.wdm")
add_values("wdk.tracewpp.flags", "-func:TracePrint((LEVEL,FLAGS,MSG,...))")
add_files("/src/*.cpp", { rule = "wdk.tracewpp" })
add_files("*.rc", "*.inf")
add_files("*.mof|msdsm.mof")
add_files("msdsm.mof", { values = { wdk_mof_header = "msdsmwmi.h" } })
end
c_cpp_properties.json
{
"compileCommands": "${workspaceFolder}/.vscode/compile_commands.json"
} main.cpp
#include <ntddk.h>
VOID DriverUnload(PDRIVER_OBJECT pDriverObject)
{
KdPrint(("Driver Unload\n"));
}
extern "C" NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING pRegistryPath)
{
pDriverObject->DriverUnload = DriverUnload;
KdPrint(("Driver Entry\n"));
return STATUS_SUCCESS;
} demo.inf
;
; WdmDemo.inf
;
[Version]
Signature="$WINDOWS NT$"
Class=System
ClassGuid={4d36e97d-e325-11ce-bfc1-08002be10318}
Provider=%ManufacturerName%
DriverVer=
CatalogFile=WdmDemo.cat
PnpLockdown=1
[DestinationDirs]
DefaultDestDir = 13
[SourceDisksNames]
1 = %DiskName%,,,""
[SourceDisksFiles]
[Manufacturer]
%ManufacturerName%=Standard,NT$ARCH$.10.0...16299 ; %13% support introduced in build 16299
[Standard.NT$ARCH$.10.0...16299]
[Strings]
ManufacturerName="<Your manufacturer name>" ;TODO: Replace with your manufacturer name
DiskName="WdmDemo Source Disk"
使用VsCode开发Windows驱动
https://simonkimi.github.io/posts/20240812100613/