开始学习驱动编程——Hello World

Home / Article MrLee 2016-5-11 3980

准备开始进修Windows内核开发,学习下更底层的玩意儿。下载了一本电子书《寒江独钓-Windows内核安全编程(完整版)》此书有点老,可能原先能正常编译通过,但是现在WIN7 64系统不一定能过。像我的第一个驱动就搞了半天,很简单的几句代码,就是一直报错。identifier 'DriverEntry'
后来查了下也没相关的文章,可能是驱动搞的人确实太少了,而且也不大愿意去写。所以我还是直接翻自带的源码,比较下,发现参数必须要带__in或者__out,加上就OK了!
#include 

VOID DriverUnload(__in PDRIVER_OBJECT DriverObject){
	DbgPrint("first:Our driver is unloading...\r\n");
}
NTSTATUS DriverEntry(__in PDRIVER_OBJECT DriverObject,
    __in PUNICODE_STRING RegistryPath){
	DbgPrint("first:Hello,my salary!");
	DriverObject->DriverUnload = DriverUnload;
	return STATUS_SUCCESS;
}

然后直接build,结果就成功,标记下:
D:\firstdriver>build
BUILD: Compile and Link for x86
BUILD: Loading c:\winddk\7600.16385.1\build.dat...
BUILD: Computing Include file dependencies:
BUILD: Start time: Wed May 11 16:21:33 2016
BUILD: Examining d:\firstdriver directory for files to compile.
    d:\firstdriver Invalidating OACR warning log for 'root:x86chk'
BUILD: Saving c:\winddk\7600.16385.1\build.dat...
BUILD: Compiling and Linking d:\firstdriver directory
Configuring OACR for 'root:x86chk' - 
_NT_TARGET_VERSION SET TO WINXP
Compiling - first.c
Linking Executable - objchk_wxp_x86\i386\first.sys
BUILD: Finish time: Wed May 11 16:21:34 2016
BUILD: Done
    3 files compiled
    1 executable built

QQ截图20160511162810


需要学习的朋友,我共享一下电子书:寒江独钓-Windows内核安全编程(完整版)

windriver

本文链接:https://it72.com/9355.htm

推荐阅读
最新回复 (0)
返回