YLLEN

要去看埃菲尔铁塔的顶

欢迎关注本人微博:t.cn/RGSLVUk

windows驱动

    着手搞windows驱动,要学习内核编程了,每次想想去分析木马病毒,遇到内核级的就懵逼了,好吧。

    系统环境 (虚拟机 ):  xp sp3

    安装包:    DDK xp用到  GRMWDK_EN_7600_1

    调试工具 : WinDbg,

    辅助工具 : DbgView ,srvinstw

   

第一个驱动程序的源文件 (first.c)


#include "ntddk.h"

VOID DriverUnload(PDRIVER_OBJECT driver)

{

DbgPrint("first:  Let Us Go!!");

}


//DriverEntry 入口函数 main...

NTSTATUS DriverEntry(PDRIVER_OBJECT driver,PUNICODE_STRING reg_path)

{

DbgPrint("first: Hello, my salary!");

driver->DriverUnload = DriverUnload;

return STATUS_SUCCESS;

}


对应的MAKEFILE  基本不变

!IF 0

Copyright (C) Microsoft Corporation, 1999 - 1999

Module Name:

    makefile.

!ENDIF

!if "$(DDK_TARGET_OS)"=="Win2K"

!message This sample is not intended to target the Windows 2000 platform.

!else

!INCLUDE $(NTMAKEENV)\makefile.def

!endif


对应的sources文件


TARGETNAME=first

TARGETTYPE=DRIVER

SOURCES=first.c



然后进入DDK安装目录下,打开 Build工具,cd 到源文件目录

然后执行 build 命令就 能生成 sys 文件了 ,当然这个不能直接去双击运行,需要以服务形式加载到内核里面运行 ,这里用到 srvinstw 工具来加载服务。

 


评论

© YLLEN | Powered by LOFTER