Hello World驱动
来源:互联网 发布:c语言参考手册 pdf 编辑:程序博客网 时间:2024/05/22 16:51
编写第一个UWD KMDF 驱动:利用Visual Studio 开发驱动程序,然后 部署到目标 计算机上。
1. 新建一个空KMDF工程
2. 在解决方案管理器中,查看工程属性:Driver Settings > General > Target Platform 确认为Universal
3. 添加一个“C++文件”:Driver.C
4. 插入以下代码:
#include <ntddk.h>#include <wdf.h>DRIVER_INITIALIZE DriverEntry;EVT_WDF_DRIVER_DEVICE_ADD KmdfHelloWorldEvtDeviceAdd;NTSTATUS DriverEntry(_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath){ NTSTATUS status; WDF_DRIVER_CONFIG config; KdPrintEx(( DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "KmdfHelloWorld: DriverEntry\n" )); WDF_DRIVER_CONFIG_INIT(&config, KmdfHelloWorldEvtDeviceAdd); status = WdfDriverCreate(DriverObject, RegistryPath, WDF_NO_OBJECT_ATTRIBUTES, &config, WDF_NO_HANDLE); return status;}NTSTATUS KmdfHelloWorldEvtDeviceAdd(_In_ WDFDRIVER Driver, _Inout_ PWDFDEVICE_INIT DeviceInit){ NTSTATUS status; WDFDEVICE hDevice; UNREFERENCED_PARAMETER(Driver); KdPrintEx(( DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "KmdfHelloWorld: KmdfHelloWorldEvtDeviceAdd\n" )); status = WdfDeviceCreate(&DeviceInit, WDF_NO_OBJECT_ATTRIBUTES, &hDevice); return status;}5. 解决方案管理器 > 解决方案 > 配置管理器 (两个地方都改为x64)
6. 解决方案管理器 > 项目工程 > 属性 > Wpp Tracing >All Options > Run Wpp Tracing 设置为NO
7. 生成解决方案
0 0
- 驱动版Hello World
- 驱动版Hello world
- 驱动版Hello World
- 驱动版Hello World
- Hello,world驱动编程
- hello world驱动
- 驱动之hello world
- hello world驱动
- Linux hello world 驱动
- linux 驱动 hello world
- hello world 驱动
- 驱动学习-hello world
- Hello World驱动
- 驱动-Hello,World
- hello world!(驱动模块)
- openwrt 驱动 hello world
- 驱动入门hello world
- 驱动第一章:hello world
- iOS应用程序的生命周期
- TEXT CLASSIFICATION FOR SENTIMENT ANALYSIS – NAIVE BAYES CLASSIFIER
- Eclipse引入jar包的三种方式
- [MFC学习笔记]--MSG结构体
- 数据库多表连接查询
- Hello World驱动
- Oracle中删除用户下所有对象
- 代理模式
- gradle批量签名打包
- 玩转Xcode之修改系统生成的注释模板
- Android 学习之Fragment的创建
- 驱动程序如何手动卸载与更新
- 数据结构实验之队列一:排队买饭
- Automatic Preferred Max Layout Width is not available on iOS versions prior to