最小的驱动代码

/**********************驱动程序学习例程************************
*  平台:windows10
*  功能:驱动程序代码最小代码测试
*  编写:ZGL
*  日期:2021-01-14
*  
*	 更改记录:未更改
******************************************************************/

//#include <ntddk.h>
#include <ntifs.h>
#include <windef.h>


VOID nothing(HANDLE ppid, HANDLE mypid, BOOLEAN bcreate)
{
    
    
	//回调函数,有程序打开或关闭显示提示信息
	DbgPrint("ProcessNotify\n");



}

VOID DrvUnload(PDRIVER_OBJECT pdriver)
{
    
    
	DbgPrint("Unload\n");
	//卸载回调函数,不加卸载驱动会蓝屏
	PsSetCreateProcessNotifyRoutine(nothing, TRUE);
}



NTSTATUS DriverEntry(PDRIVER_OBJECT driver, PUNICODE_STRING reg_path)
{
    
    
	driver->DriverUnload=DrvUnload;

	DbgPrint("1--%wZ--\n", reg_path);
	PsSetCreateProcessNotifyRoutine(nothing, FALSE);

	return 0;
}

猜你喜欢

转载自blog.csdn.net/lygl35/article/details/112619918