编程语言
首页 > 编程语言> > 驱动测试源码-1

驱动测试源码-1

作者:互联网

#include <ntddk.h>
#include <wdf.h>
 
 
VOID EvtDriverUnload(IN WDFDRIVER driver)
{
	KdPrint(("驱动卸载\n"));
}
 
 
NTSTATUS DriverEntry(IN PDRIVER_OBJECT driver_object, IN PUNICODE_STRING reg)
{
	NTSTATUS status = STATUS_SUCCESS;
	WDF_DRIVER_CONFIG config;
	WDF_DRIVER_CONFIG_INIT(&config,NULL);
	config.DriverInitFlags = WdfDriverInitNonPnpDriver;
	config.EvtDriverUnload = EvtDriverUnload;
 
 
	status = WdfDriverCreate(driver_object, reg, WDF_NO_OBJECT_ATTRIBUTES, &config,WDF_NO_HANDLE);
	if(!NT_SUCCESS(status)){
		KdPrint(("驱动框架创建失败\n"));
	}
	else {
		KdPrint(("驱动框架创建成功\n"));
	}
	return status;
}

 然后将release改成debug生成驱动文件,然后放到win7虚拟机中测试,测试成功。

 

 

 

标签:status,WDF,driver,EvtDriverUnload,源码,KdPrint,测试,驱动,config
来源: https://www.cnblogs.com/iGhost/p/15105241.html