﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-qeilf</title><link>http://www.cppblog.com/qeilf/</link><description /><language>zh-cn</language><lastBuildDate>Tue, 14 Apr 2026 23:06:42 GMT</lastBuildDate><pubDate>Tue, 14 Apr 2026 23:06:42 GMT</pubDate><ttl>60</ttl><item><title>VS2008 + WinDDK 7600.16385.1</title><link>http://www.cppblog.com/qeilf/archive/2010/07/13/120277.html</link><dc:creator>QEILF</dc:creator><author>QEILF</author><pubDate>Tue, 13 Jul 2010 15:33:00 GMT</pubDate><guid>http://www.cppblog.com/qeilf/archive/2010/07/13/120277.html</guid><wfw:comment>http://www.cppblog.com/qeilf/comments/120277.html</wfw:comment><comments>http://www.cppblog.com/qeilf/archive/2010/07/13/120277.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/qeilf/comments/commentRss/120277.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/qeilf/services/trackbacks/120277.html</trackback:ping><description><![CDATA[<p>开发过程中遇到问题的解决方案：</p> <p>1、链接KeGetCurrentIrql函数出现错误</p> <p>缺少wdm.lib，具体操作如下：</p> <p><a href="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2008WinDDK7600.16385.1_14951/image_2.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="484" alt="image" src="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2008WinDDK7600.16385.1_14951/image_thumb.png" width="613" border="0"></a> </p> <p>2、unresolved external symbol __except_handler4</p> <p>在程序中，使用了 __try ,__except的工程，出现下面的错误：<br>unresolved external symbol __except_handler4<br>解决办法是：<br><a href="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2008WinDDK7600.16385.1_14951/image_4.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="484" alt="image" src="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2008WinDDK7600.16385.1_14951/image_thumb_1.png" width="622" border="0"></a>&nbsp; <p>3、注意一下DriverUnload函数的格式</p> <p>返回值是VOID，参数是IN，而不是in，这里注意大小写</p> <p>VOID DriverUnload(IN PDRIVER_OBJECT pDrvObj) <br>{ <br>&nbsp;&nbsp;&nbsp; DbgPrint("DriverUnload\n"); <br>&nbsp;&nbsp;&nbsp; //return STATUS_SUCCESS; <br>}  <p>4、经常出现warn的也会阻碍编译，我们可以改变警告的等级  <p>解决方案是：  <p>修改Warning Level的值。从W3变为W1  <p><a href="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2008WinDDK7600.16385.1_14951/image_8.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="484" alt="image" src="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2008WinDDK7600.16385.1_14951/image_thumb_3.png" width="622" border="0"></a>  <p><a href="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2008WinDDK7600.16385.1_14951/image_6.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="89" alt="image" src="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2008WinDDK7600.16385.1_14951/image_thumb_2.png" width="244" border="0"></a>  <p>5、有关添加额外的头文件和lib文件问题 <p>在C/C++必须设置下面的这个内容，否则会报错 <p>D:\WinDDK\7600.16385.1\inc\ddk;D:\WinDDK\7600.16385.1\inc\crt;D:\WinDDK\7600.16385.1\inc\api <p><a href="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2008WinDDK7600.16385.1_14951/image_10.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="425" alt="image" src="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2008WinDDK7600.16385.1_14951/image_thumb_4.png" width="644" border="0"></a>  <p>如有新的东西，我会继续添加进去  <img src ="http://www.cppblog.com/qeilf/aggbug/120277.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/qeilf/" target="_blank">QEILF</a> 2010-07-13 23:33 <a href="http://www.cppblog.com/qeilf/archive/2010/07/13/120277.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用eclipse开发python</title><link>http://www.cppblog.com/qeilf/archive/2010/06/30/119005.html</link><dc:creator>QEILF</dc:creator><author>QEILF</author><pubDate>Wed, 30 Jun 2010 12:02:00 GMT</pubDate><guid>http://www.cppblog.com/qeilf/archive/2010/06/30/119005.html</guid><wfw:comment>http://www.cppblog.com/qeilf/comments/119005.html</wfw:comment><comments>http://www.cppblog.com/qeilf/archive/2010/06/30/119005.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/qeilf/comments/commentRss/119005.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/qeilf/services/trackbacks/119005.html</trackback:ping><description><![CDATA[<span class="Apple-style-span" style="word-spacing: 0px; font: medium simsun; text-transform: none; color: rgb(0,0,0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span class="Apple-style-span" style="font-size: 12px; line-height: 18px; font-family: verdana, sans-serif; text-align: left"> <h1 class="title_txt" style="padding-right: 0px; padding-left: 1.5em; font-size: 15px; padding-bottom: 0.5em; margin: 0px; padding-top: 0px; font-family: 'Microsoft yahei', verdana, sans-serif">&nbsp;</h1> <div class="blogstory" style="font-size: 14px; float: left; width: 1065px; line-height: 21px"> <p style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 1em 0px 0.5em; padding-top: 0px">一.配置。</p> <p style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 1em 0px 0.5em; padding-top: 0px">&nbsp;&nbsp; 1. 下载eclipse&nbsp;&nbsp;&nbsp;&nbsp; 版本：我用的是：3.1.2</p> <p style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 1em 0px 0.5em; padding-top: 0px">&nbsp; <a style="color: rgb(0,107,173); text-decoration: none"> 2. 安装 PyDev&nbsp;&nbsp; 插件地址：</a><span class="Apple-converted-space">&nbsp;</span><a style="color: rgb(0,107,173); text-decoration: none" href="http://pydev.sf.net/updates/" target="_blank">http://pydev.org/updates/</a><span class="Apple-converted-space">&nbsp;</span><a style="color: rgb(0,107,173); text-decoration: none"> 插件安 装方式就不啰嗦了。</a></p> <p style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 1em 0px 0.5em; padding-top: 0px"><a style="color: rgb(0,107,173); text-decoration: none">&nbsp;&nbsp; 3. 安装成功之后打开参数设置面板，如图：</a></p> <p style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 1em 0px 0.5em; padding-top: 0px"><a style="color: rgb(0,107,173); text-decoration: none">&nbsp;</a></p> <p style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 1em 0px 0.5em; padding-top: 0px"><a style="color: rgb(0,107,173); text-decoration: none">安装成功后会看到pydev选项. 选择 interpreter -Python, 最上面一栏选择 新建(W)&nbsp; 找到python31的安装目录，选择python.exe。点击<strong>应用，</strong><span class="Apple-converted-space">&nbsp;</span>一切配置成功后的截图如下：</a></p> <p style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 1em 0px 0.5em; padding-top: 0px" align="left"><a style="color: rgb(0,107,173); text-decoration: none"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" alt="" src="http://blogimg.chinaunix.net/blog/upfile2/090304223946.jpg" border="0"></a></p> <p style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 1em 0px 0.5em; padding-top: 0px"><a style="color: rgb(0,107,173); text-decoration: none">ok~~~~完成到这一步就可以新建python工程，开始写python啦~~~~~^_^~~~~~第一次写这样的教程，讲解得应该还 算清晰吧~~~~~~~~</a></p> <p style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 1em 0px 0.5em; padding-top: 0px"><a style="color: rgb(0,107,173); text-decoration: none">python是个好东西，还在学习中...............哈哈~~~~~~~好好学 习，天天向上</a></p> <div>写hello world<br>首先是建一个项目,选文件---&gt;新建项目---&gt;pydev下 的pydev project</div> <div>&nbsp;</div> <div>&nbsp;</div> <div> <p style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 1em 0px 0.5em; padding-top: 0px" align="left"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" alt="" src="http://blogimg.chinaunix.net/blog/upfile2/090304224009.jpg" border="0"></p></div> <div>&nbsp;</div> <div>&nbsp;</div> <div> <p style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 1em 0px 0.5em; padding-top: 0px" align="left"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="442" alt="" src="http://blogimg.chinaunix.net/blog/upfile2/090225165617.gif" width="500" border="0"></p></div> <div>&nbsp;</div> <div>&nbsp;</div> <div>&nbsp;</div> <div> <p style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 1em 0px 0.5em; padding-top: 0px" align="left"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="444" alt="" src="http://blogimg.chinaunix.net/blog/upfile2/090225165702.gif" width="500" border="0"></p></div> <div>&nbsp;</div> <div>包名先不用写</div> <div>&nbsp;</div> <div> <p style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 1em 0px 0.5em; padding-top: 0px" align="left"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="436" alt="" src="http://blogimg.chinaunix.net/blog/upfile2/090225165812.gif" width="500" border="0"></p></div> <div>&nbsp;</div> <div> <p style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 1em 0px 0.5em; padding-top: 0px" align="left"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="471" alt="" src="http://blogimg.chinaunix.net/blog/upfile2/090225165954.gif" width="500" border="0"></p></div> <div> <p style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 1em 0px 0.5em; padding-top: 0px">python3.0以后去除print语句，加入 print()函数实现相同的功能。同样的还有exec语句，已经改为exec()函数。去除了&lt;&gt;，全部改用!=。所以下面的语句语法错 误。</p> <p style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 1em 0px 0.5em; padding-top: 0px" align="left"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="461" alt="" src="http://blogimg.chinaunix.net/blog/upfile2/090225170034.gif" width="500" border="0"></p> <p style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 1em 0px 0.5em; padding-top: 0px">编译执行</p> <p style="padding-right: 0px; padding-left: 0px; padding-bottom: 0px; margin: 1em 0px 0.5em; padding-top: 0px" align="left"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; width: 596px; height: 456px; border-right-width: 0px" height="462" alt="" src="http://blogimg.chinaunix.net/blog/upfile2/090225170115.gif" width="500" border="0"></p></div></div></span></span><img src ="http://www.cppblog.com/qeilf/aggbug/119005.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/qeilf/" target="_blank">QEILF</a> 2010-06-30 20:02 <a href="http://www.cppblog.com/qeilf/archive/2010/06/30/119005.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>搭建环境驱动开发的环境（VS2005+WDK）</title><link>http://www.cppblog.com/qeilf/archive/2010/06/30/118977.html</link><dc:creator>QEILF</dc:creator><author>QEILF</author><pubDate>Wed, 30 Jun 2010 05:04:00 GMT</pubDate><guid>http://www.cppblog.com/qeilf/archive/2010/06/30/118977.html</guid><wfw:comment>http://www.cppblog.com/qeilf/comments/118977.html</wfw:comment><comments>http://www.cppblog.com/qeilf/archive/2010/06/30/118977.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/qeilf/comments/commentRss/118977.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/qeilf/services/trackbacks/118977.html</trackback:ping><description><![CDATA[<h1 style="text-align: center" align="center"><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"></span>&nbsp;</h1> <p class="MsoNormal"><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">新建一个</span><span lang="EN-US">MFC DLL</span><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">项目，设置项目属性如下：</span></p> <p class="MsoNormal"><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">新建一个配置管理项，</span><span lang="EN-US">my_driver_dev</span><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，编辑这个配置管理项！</span></p> <p class="MsoNormal"><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">需要事先说明的是，下图中加粗的地方就是需要修改的部分！！！</span></p> <p class="MsoNormal"><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">配置流程如下：</span></p> <h2><span lang="EN-US">1</span><span style="font-family: 黑体; mso-ascii-font-family: arial">、</span><span lang="EN-US">C/C++</span></h2> <h3><span style="font-family: 仿宋_gb2312; mso-ascii-font-family: 'Times New Roman'">（</span><span lang="EN-US">1</span><span style="font-family: 仿宋_gb2312; mso-ascii-font-family: 'Times New Roman'">）“常规”</span></h3> <p class="MsoNormal"><span lang="EN-US"><a href="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image007_4.jpg"><img title="clip_image007" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="218" alt="clip_image007" src="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image007_thumb_1.jpg" width="244" border="0" v:shapes="_x0000_i1025"></a></span></p> <h3><span style="font-family: 仿宋_gb2312; mso-ascii-font-family: 'Times New Roman'">（</span><span lang="EN-US">2</span><span style="font-family: 仿宋_gb2312; mso-ascii-font-family: 'Times New Roman'">）“优化”</span></h3> <p class="MsoNormal"><span lang="EN-US"><a href="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image010_4.jpg"><img title="clip_image010" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="166" alt="clip_image010" src="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image010_thumb_1.jpg" width="244" border="0" v:shapes="_x0000_i1026"></a></span></p> <h3><span style="font-family: 仿宋_gb2312; mso-ascii-font-family: 'Times New Roman'">（</span><span lang="EN-US">3</span><span style="font-family: 仿宋_gb2312; mso-ascii-font-family: 'Times New Roman'">）“预处理”</span></h3> <p class="MsoNormal"><span lang="EN-US"><a href="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image014_4.jpg"><img title="clip_image014" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="186" alt="clip_image014" src="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image014_thumb_1.jpg" width="244" border="0" v:shapes="_x0000_i1027"></a></span></p> <h3><span style="font-family: 仿宋_gb2312; mso-ascii-font-family: 'Times New Roman'">（</span><span lang="EN-US">4</span><span style="font-family: 仿宋_gb2312; mso-ascii-font-family: 'Times New Roman'">）“高级”</span></h3> <p class="MsoNormal"><span lang="EN-US"><a href="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image017_4.jpg"><img title="clip_image017" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="166" alt="clip_image017" src="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image017_thumb_1.jpg" width="244" border="0" v:shapes="_x0000_i1028"></a></span></p> <h2><span lang="EN-US">2</span><span style="font-family: 黑体; mso-ascii-font-family: arial">、链接器</span></h2> <h3><span style="font-family: 仿宋_gb2312; mso-ascii-font-family: 'Times New Roman'">（</span><span lang="EN-US">1</span><span style="font-family: 仿宋_gb2312; mso-ascii-font-family: 'Times New Roman'">）“常规”</span></h3> <p class="MsoNormal"><span lang="EN-US"><a href="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image023_4.jpg"><img title="clip_image023" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="182" alt="clip_image023" src="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image023_thumb_1.jpg" width="244" border="0" v:shapes="_x0000_i1029"></a></span></p> <h3><span style="font-family: 仿宋_gb2312; mso-ascii-font-family: 'Times New Roman'">（</span><span lang="EN-US">2</span><span style="font-family: 仿宋_gb2312; mso-ascii-font-family: 'Times New Roman'">）“输入”</span></h3> <p class="MsoNormal"><span lang="EN-US"><a href="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image028_4.jpg"><img title="clip_image028" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="169" alt="clip_image028" src="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image028_thumb_1.jpg" width="244" border="0" v:shapes="_x0000_i1030"></a></span></p> <h3><span style="font-family: 仿宋_gb2312; mso-ascii-font-family: 'Times New Roman'">（</span><span lang="EN-US">3</span><span style="font-family: 仿宋_gb2312; mso-ascii-font-family: 'Times New Roman'">）“清单文件”</span></h3> <p class="MsoNormal"><span lang="EN-US"><a href="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image031_4.jpg"><img title="clip_image031" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="166" alt="clip_image031" src="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image031_thumb_1.jpg" width="244" border="0" v:shapes="_x0000_i1031"></a></span></p> <h3><span style="font-family: 仿宋_gb2312; mso-ascii-font-family: 'Times New Roman'">（</span><span lang="EN-US">4</span><span style="font-family: 仿宋_gb2312; mso-ascii-font-family: 'Times New Roman'">）“调试”</span></h3> <p class="MsoNormal"><span lang="EN-US"><a href="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image034_4.jpg"><img title="clip_image034" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="166" alt="clip_image034" src="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image034_thumb_1.jpg" width="244" border="0" v:shapes="_x0000_i1032"></a></span></p> <h3><span style="font-family: 仿宋_gb2312; mso-ascii-font-family: 'Times New Roman'">（</span><span lang="EN-US">5</span><span style="font-family: 仿宋_gb2312; mso-ascii-font-family: 'Times New Roman'">）“系统”</span></h3> <p class="MsoNormal"><span lang="EN-US"><a href="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image038_4.jpg"><img title="clip_image038" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="166" alt="clip_image038" src="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image038_thumb_1.jpg" width="244" border="0" v:shapes="_x0000_i1033"></a></span></p> <p class="MsoNormal"><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（</span><span lang="EN-US">6</span><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）“高级”</span></p> <p class="MsoNormal"><span lang="EN-US"><?xml:namespace prefix = o /><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal"><span lang="EN-US"><a href="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image042_4.jpg"><img title="clip_image042" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="166" alt="clip_image042" src="http://www.cppblog.com/images/cppblog_com/qeilf/WindowsLiveWriter/VS2005WDK_B793/clip_image042_thumb_1.jpg" width="244" border="0" v:shapes="_x0000_i1034"></a></span></p> <h2><span lang="EN-US">3</span><span style="font-family: 黑体; mso-ascii-font-family: arial">、示例程序</span></h2> <p class="MsoNormal"><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">新建一个</span><span lang="EN-US">cpp</span><span style="font-family: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件，然后编译！</span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; color: blue; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">#include</span><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes"> <span style="color: #a31515">&lt;ntddk.h&gt;<o:p></o:p></span></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; color: green; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">//</span><span style="font-size: 9pt; color: green; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">提供一个<span lang="EN-US">Unload</span>函数只是为了<span lang="EN-US"><o:p></o:p></span></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; color: #010001; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">VOID</span><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes"> <span style="color: #010001">DriverUnload</span>(<span style="color: #010001">PDRIVER_OBJECT</span> <span style="color: #010001">driver</span>)<o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">{<o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green">// </span></span><span style="font-size: 9pt; color: green; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">但是实际上我们什么都不做，只打印一句话<span lang="EN-US">:<o:p></o:p></span></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #010001">DbgPrint</span>(<span style="color: #a31515">"first: Our driver is unloading</span></span><span style="font-size: 9pt; color: #a31515; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">…<span lang="EN-US">\r\n"</span></span><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">);<o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">}<o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; color: green; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">// DriverEntry</span><span style="font-size: 9pt; color: green; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">，入口函数。相当于<span lang="EN-US">main</span>。<span lang="EN-US"><o:p></o:p></span></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; color: #010001; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">NTSTATUS</span><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes"> <span style="color: #010001">DriverEntry</span>(<span style="color: #010001">PDRIVER_OBJECT</span> <span style="color: #010001">driver</span>, <span style="color: #010001">PUNICODE_STRING</span> <span style="color: #010001">reg_path</span>)<o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">{<o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; color: blue; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">#if</span><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes"> <span style="color: #010001">DBG<o:p></o:p></span></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green">// _asm int 3<o:p></o:p></span></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; color: blue; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">#endif<o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green">// </span></span><span style="font-size: 9pt; color: green; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">这是我们的内核模块的入口，可以在这里写入我们想写的东西。<span lang="EN-US"><o:p></o:p></span></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green">// </span></span><span style="font-size: 9pt; color: green; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">我在这里打印一句话。因为”<span lang="EN-US">Hello,world</span>”常常被高手耻笑，所以<span lang="EN-US"><o:p></o:p></span></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green">// </span></span><span style="font-size: 9pt; color: green; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">我们打印一点别的。<span lang="EN-US"><o:p></o:p></span></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #010001">DbgPrint</span>(<span style="color: #a31515">"first: Hello, my wdk dirver!"</span>);<o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green">// </span></span><span style="font-size: 9pt; color: green; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">设置一个卸载函数便于这个函数能退出。<span lang="EN-US"><o:p></o:p></span></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #010001">driver</span>-&gt;<span style="color: #010001">DriverUnload</span> = <span style="color: #010001">DriverUnload</span>;<o:p></o:p></span></p> <p class="MsoNormal" style="text-align: left; mso-layout-grid-align: none" align="left"><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes"><span style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: blue">return</span> <span style="color: #010001">STATUS_SUCCESS</span>;<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" style="font-size: 9pt; font-family: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">}</span></p><img src ="http://www.cppblog.com/qeilf/aggbug/118977.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/qeilf/" target="_blank">QEILF</a> 2010-06-30 13:04 <a href="http://www.cppblog.com/qeilf/archive/2010/06/30/118977.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>