1、mini_ddk.c
#include <ntddk.h>
VOID DriverUnload(PDRIVER_OBJECT dirver)
{
DbgPrint("First:our Driver is unloading.....\n");
}
NTSTATUS DriverEntry(PDRIVER_OBJECT driver, PUNICODE_STRING reg_path)
{
//这里只输出一句话
DbgPrint("first: Hello,my salary!");
//设置一个卸载函数,便于这个函数的退出
driver->DriverUnload = DriverUnload;
return STATUS_SUCCESS;
}
2、Sources
TARGETNAME=mini_ddk
TARGETTYPE=DRIVER
TARGETPATH=OBJ
INCLUDES=$(BASEDIR)\inc;\
$(BASEDIR)\inc\ddk;\
SOURCES=mini_ddk.c\
3、makefile
#
# DO NOT EDIT THIS FILE!!! Edit .\sources. If you want to add a new source
# file to this component. This file merely indirects to the real make file
# that is shared by all the driver components of the Windows NT DDK
#
!INCLUDE $(NTMAKEENV)\makefile.def
本文展示了一个简单的Mini_DDK驱动程序示例,包括源文件mini_ddk.c的内容,定义了DriverUnload函数用于驱动卸载时输出信息,并在DriverEntry中初始化此函数。通过这个例子,读者可以了解到Mini_DDK的基本结构和如何实现一个简单的驱动。
2万+

被折叠的 条评论
为什么被折叠?



