Windows内核--DbgPrint/KdPrint Kernel log(3.1)

Kernel和Driver可以通过DbgPrint或DbgPrintEx打log.

KdPrint和KdPrintEx也是可行的,不过用法有差异。

MSDN: KdPrint is identical to the DbgPrint routine in code that is compiled for a debug configuration. This routine has no effect if compiled for a release configuration. Only kernel-mode drivers can call the KdPrint routine.

DbgPrint输出log

  Windows内核并不会把Kernel log用UART输出,而是通过系统服务(int 2dh)的方式输出。

DbgPrint --> vDbgPrintExWithPrefixInternal 
               --> DebugPrint
                 --> DebugService
                    

 注意,此处Service参数传入BREAKPOINT_PRINT, 表示输出log.

    int 2dh 进入_KiDebugService例程.

        

 之后在汇编代码里面周转了很久,最终根据BREAKPOINT_PRINT决定输出log.

DbgPrint的实现确实不走寻常路!

DbgView工具查看Kernel log

        DebugView - Windows Sysinternals | Microsoft Learn

        按官方的说法,DbgView不仅可以抓Userspace log, 也可以抓Kernel log.

        

DbgView抓Kernel log原理

  •  Load Dbgv.sys Driver
  • Dbgv.sys hook DebugPrint函数,截获字符串
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值