首页
社区
课程
招聘
[原创]浅述 KdPrint 在checked 和free版本的不同
发表于: 2013-8-26 11:53 5348

[原创]浅述 KdPrint 在checked 和free版本的不同

2013-8-26 11:53
5348
在checked版本中,Kdprint,会被DbgPrint所代替
我们编个简单的程序:

NTSTATUS DriverEntry( PDRIVER_OBJECT pObj , PUNICODE_STRING path)
{
pObj->DriverUnload = DriverUnload;

KdPrint(("123"));
return STATUS_SUCCESS;
}

可以用IDA简单的看一下:

显然Kdprint,被DbgPrint所代替了。

在free版本中,Kdprint无效,不做任何事情。
可看IDA分析结果:可见不做任何事情


[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

上传的附件:
收藏
免费 5
支持
分享
最新回复 (5)
雪    币: 242
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
这...

-----------------------------
From WDM.H

//
// Define kernel debugger print prototypes and macros.
//
// N.B. The following function cannot be directly imported because there are
//      a few places in the source tree where this function is redefined.
//


#if DBG

#define KdPrint(_x_) DbgPrint _x_
#define KdPrintEx(_x_) DbgPrintEx _x_

#else

#define KdPrint(_x_)
#define KdPrintEx(_x_)

#endif // DBG

#ifndef _DBGNT_

ULONG
__cdecl
DbgPrint (
    __in_z __drv_formatString(printf) PCSTR Format,
    ...
    );

#if (NTDDI_VERSION >= NTDDI_WINXP)
NTSYSAPI
ULONG
__cdecl
DbgPrintEx (
    __in ULONG ComponentId,
    __in ULONG Level,
    __in_z __drv_formatString(printf) PCSTR Format,
    ...
    );
#endif


#endif // _DBGNT_
2013-8-26 12:12
0
雪    币: 1042
活跃值: (470)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
Kdprint是宏吧~在
2013-8-26 13:52
0
雪    币: 100
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
请不要放弃治疗。。。。
2013-8-26 14:26
0
雪    币: 220
活跃值: (117)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
5
注意定义
Kdprint是个宏

#if DBG

#define KdPrint(_x_) DbgPrint _x_
#define KdPrintEx(_x_) DbgPrintEx _x_

#else

#define KdPrint(_x_)
#define KdPrintEx(_x_)

#endif // DBG

中的
当DBG时候 是有效的
不是DBG时候则是空宏

楼上言辞略过了点..
2013-8-26 16:38
0
雪    币: 1233
活跃值: (907)
能力值: ( LV12,RANK:750 )
在线值:
发帖
回帖
粉丝
6
这个 怎么说呢? 我是路过打酱油的
2013-8-26 17:09
0
游客
登录 | 注册 方可回帖
返回
//