一,下载WDK,WDK全称是Windows Driver Kit,如何下载WDK软件
二,编写第一个驱动,
在电脑任何位置新建一个目录命名为test,然后进入此目录新建一个test.c文件,该文件就是驱动程序。如下:
NTSTATUS
DriverEntry (
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath
)
{
DbgPrint(("Hello World!\n"));
return STATUS_SUCCESS;
}
#include <ntddk.h>
要编译这个文件,需要建一个make文件和resource文件
简单的source文件如下:
ARGETNAME=hello
TARGETPATH=obj
TARGETTYPE=DRIVER
SOURCES=hello.c
makefile文件内容如下:
#
# DO NOT EDIT THIS 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
首先进入编译环境,开始->Development Kits->DDK XXXX->build enviorenments->windows XP->Windows XP Checked Build Environment.进入这三个文件的存放目录,执行build。编译完成后,目录下产生了objchk_wxp_x86\i386,下面有个文件hello.sys,这就是我们第一步的成果了。
搜索 srvinstw.exe工具,windbg工具
net start modulename
net stop modulename