win7x86下内核调试下DbgPrint 不输出调试结果
2015-08-27 01:37
176 查看
使用DebugView打印内核调试信息是开发驱动的非常重要的手段,但DebugView在VISTA/WINDOWS 7下却无法获取内核的调试日志,修改方法是:
HKLM/SYSTEM/CurrentControlSet/Control/Session Manager,打开或者创建子项Debug Print Filter,然后新建一个DWORD值DEFAULT,将其设置成0xF,重启即可。如果写成可导入的REG文件:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Session Manager/Debug Print Filter]
"DEFAULT"=dword:0000000f
The problem: Your DbgPrint or KdPrint messages don't appear in WinDbg (or KD) when you run your driver on Windows Vista.
The reason? Vista automatically maps DbgPrint and friends to DbgPrintEx. Now, you may recall that DbgPrintEx allows you to control the conditions under which messages will be sent to the kernel debugger by filtering messages via a component name and level
in the function call and an associated filter mask in either the registry or in memory.
In Vista, DbgPrint and KdPrint are mapped to component "DPFLTR_DEFAULT_ID" and level "DPFLTR_INFO_LEVEL". Of course, in Vista, xxx_INFO_LEVEL output is disabled by default. So, by default, your DbgPrint/KdPrint doesn't get sent to the kernel debugger.
How to fix it? Two choices:
Enable output of DbgPrint/KdPrint messages by default --Open the key "HKLM/SYSTEM/CCS/Control/Session Manager/Debug Print Filter". Under this key, create a value with the name "DEFAULT" Set the value of this key equal to the DWORD value 8 to enable xxx_INFO_LEVEL
output as well as xxx_ERROR_LEVEL output. Or try setting the mask to 0xF so you get all output. You must reboot for these changes to take effect.
Specifically change the component filter mast for DPFLTR. In early releases of Vista/LH you changed the default printout mask by specifying a mask value for the DWORD at Kd_DPFLTR_MASK ("ed Kd_DPFLTR_MASK"). In build 5308 (the
February CTP of Vista), it seems that the mask variable has changed and you need to set the mask value for the DWORD at Kd_DEFAULT_MASK ("ed Kd_DEFAULT_MASK). In either case, specify 8 to enable DPFLTR_INFO_LEVEL output in addition to DPFLTR_ERROR_LEVEL output,
or 0xF to get all levels of output.
See the WDK documentation for Reading and Filtering Debugging Messages (follow the path: Driver Development Tools/Tools for Debugging Drivers/Using Debugging Code in a Driver/Debugging Code Overview) for the complete details on the use of DbgPrintEx/KdPrintEx.
Or look at the Debugging Tools For Windows documentation (Appendix A) on DbgPrintEx.
If your interested in setting the registry keys to enable output, then check out the [b]SetDbgPrintFiltering utility athttp://www.osronline.com/downloads. [/b]
http://www.osronline.com/article.cfm?id=295
HKLM/SYSTEM/CurrentControlSet/Control/Session Manager,打开或者创建子项Debug Print Filter,然后新建一个DWORD值DEFAULT,将其设置成0xF,重启即可。如果写成可导入的REG文件:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Session Manager/Debug Print Filter]
"DEFAULT"=dword:0000000f
The problem: Your DbgPrint or KdPrint messages don't appear in WinDbg (or KD) when you run your driver on Windows Vista.
The reason? Vista automatically maps DbgPrint and friends to DbgPrintEx. Now, you may recall that DbgPrintEx allows you to control the conditions under which messages will be sent to the kernel debugger by filtering messages via a component name and level
in the function call and an associated filter mask in either the registry or in memory.
In Vista, DbgPrint and KdPrint are mapped to component "DPFLTR_DEFAULT_ID" and level "DPFLTR_INFO_LEVEL". Of course, in Vista, xxx_INFO_LEVEL output is disabled by default. So, by default, your DbgPrint/KdPrint doesn't get sent to the kernel debugger.
How to fix it? Two choices:
Enable output of DbgPrint/KdPrint messages by default --Open the key "HKLM/SYSTEM/CCS/Control/Session Manager/Debug Print Filter". Under this key, create a value with the name "DEFAULT" Set the value of this key equal to the DWORD value 8 to enable xxx_INFO_LEVEL
output as well as xxx_ERROR_LEVEL output. Or try setting the mask to 0xF so you get all output. You must reboot for these changes to take effect.
Specifically change the component filter mast for DPFLTR. In early releases of Vista/LH you changed the default printout mask by specifying a mask value for the DWORD at Kd_DPFLTR_MASK ("ed Kd_DPFLTR_MASK"). In build 5308 (the
February CTP of Vista), it seems that the mask variable has changed and you need to set the mask value for the DWORD at Kd_DEFAULT_MASK ("ed Kd_DEFAULT_MASK). In either case, specify 8 to enable DPFLTR_INFO_LEVEL output in addition to DPFLTR_ERROR_LEVEL output,
or 0xF to get all levels of output.
See the WDK documentation for Reading and Filtering Debugging Messages (follow the path: Driver Development Tools/Tools for Debugging Drivers/Using Debugging Code in a Driver/Debugging Code Overview) for the complete details on the use of DbgPrintEx/KdPrintEx.
Or look at the Debugging Tools For Windows documentation (Appendix A) on DbgPrintEx.
If your interested in setting the registry keys to enable output, then check out the [b]SetDbgPrintFiltering utility athttp://www.osronline.com/downloads. [/b]
http://www.osronline.com/article.cfm?id=295
相关文章推荐
- poj 2455 Secret Milking Machine 【二分 + 最大流】 【1到N不重复路径不少于T条时,求被选中路径上的最大边权值 的最小值】
- poj 1328 Radar Installation(贪心)
- 14、 三种虚拟主机
- JTree中怎么改变节点的字体颜色?
- JSF 2.0 + Ajax hello world example
- Dagger2官方CoffeeMaker案例的分解说明
- 苹果开发者账号如何多人协作进行开发和真机调试XCode
- 顺时针打印矩阵
- hdu 2546 饭卡(经典dp)
- luci工作过程,总结的更好
- PopupWindow的进入和退出的动画效果设置
- Winter is coming Just have a little faith. JSF框架简介与实例
- 面向对象学习
- Javascript面向对象编程(三):非构造函数的继承
- poj1185炮兵阵地【状压dp】
- IOS不用AutoLayout也能实现自动布局的类(4)----MyTableLayout横空出世
- Windows&Ubuntu
- linkbutton 的启用和禁用
- SPOJ 题目913QTREE2 - Query on a tree II(Link Cut Tree 查询路径第k个点)
- Javascript面向对象编程(二):构造函数的继承