1、WDK下载地址:windows driver kit
https://connect.microsoft.com/default.aspx
2、第一个列子:first.c
#include <ntddk.h>
//卸载函数
VOID DriverUnload(PDRIVER_OBJECT driver)
{
DbgPrint("first: Our driver is unloading...\r\n");
}
//DriverEntry是入口函数
NTSTATUS DriverEntry(PDRIVER_OBJECT driver, PUNICODE_STRING reg_path)
{
#if DBG
_asm int 3
#endif
DbgPrint("first: Hello World!\r\n");
//设置卸载函数
driver->DriverUnload = DriverUnload;
return STATUS_SUCCESS;
}
3、编译工程:
不只需要first.c这样的源码文件,还需要makefile和sources两个文件。
makefile 此文件不需要改变,内容:
!IF 0
Copyright (C) Microsoft Corporation, 1999 - 2002
Module Name:
makefile.
Notes:
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 components of Windows NT (