⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usb开发步骤之软件篇 - 应用程序 - c++-vc教程.htm

📁 USB驱动设计的步骤和主要程序框架
💻 HTM
📖 第 1 页 / 共 3 页
字号:
               
&nbsp;&nbsp; &nbsp;&nbsp; 写输出缓冲区或丢弃输入缓冲区 <BR>FlushFileBuffers 
<BR>FlushConsoleInputBuffer <BR>PurgeComm <BR>IRP_MJ_SHUTDOWN 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp; 系统关闭InitialSystemShutdown 
<BR><BR>和上面的驱动程序支持的功能代码相对应,一般的驱动程序看起来就象下面的样子。 <BR>DriverEntry(…) // 驱动程序入口 <BR>{ 
<BR>… <BR>DeviceObject-&gt;MajorFunction[IRP_MJ_CREATE] = XXDriverCreateClose; 
//XX对应的是你自己给你的驱动程序的命名<BR>DeviceObject-&gt;MajorFunction[IRP_MJ_CLOSE] = 
XXDriverCreateClose; <BR>DeviceObject-&gt;MajorFunction[IRP_MJ_READ] = 
XXDriverReadWrite; <BR>DeviceObject-&gt;MajorFunction[IRP_MJ_WRITE] = 
XXDriverReadWrite; <BR>… <BR>} <BR>XXDriverCreateClose(…) // 
对应IRP_MJ_CREATE和IRP_MJ_CLOSE的例程 <BR>{ <BR>//………. <BR>} 
<BR>XXDriverDeviceControl(…)// 对应IRP_MJ_DEVICE_CONTROL的例程 <BR>{ <BR>//………. <BR>} 
<BR>XXDriverReadWrite(…) // 对应IRP_MJ_READ和IRP_MJ_WRITE的例程 <BR>{ <BR>//………. <BR>} 
<BR><BR>一个驱动程序并不需要支持所有的功能代码,比如如果一个驱动程序根本就不必要与用户模式客户程序交互,那么就不用支持IRP_MJ_CREATE和IRP_MJ_CLOSE。又如设备不支持设备读写,就不用支持IRP_MJ_READ和IRP_MJ_WRITE。 
驱动程序对象是在操作系统启动驱动程序、在调用驱动程序 入口DriverEntry之前就已经创建好了的,并且作为DriverEntry 
函数的参数传递给驱动程序。如果驱动程序启动失败,操作 
系统将删除该对象。该对象的数据结构如下。注意下表并不是完整地列出了ntddk.h中的DEVICE_OBJECT结构体的所有数 
据项,这里仅列出了一般驱动程序可能使用到的数据项。 <BR>
<TABLE width="100%" border=1>
  <TBODY>
  <TR>
    <TD width="50%">Driver对象数据项 &nbsp;</TD>
    <TD width="50%">说明 </TD></TR>
  <TR>
    <TD width="50%">PDEVICE_OBJECT&nbsp; DeviceObject </TD>
    <TD width="50%">&nbsp; 由本驱动程序创建的Device对象的链表</TD></TR>
  <TR>
    <TD width="50%">ULONG Flags&nbsp;&nbsp;&nbsp;&nbsp; PDRIVER_INITIALIZE 
      DriverInit &nbsp;&nbsp;&nbsp;</TD>
    <TD width="50%">驱动程序初始化例程(一般较少用) </TD></TR>
  <TR>
    <TD width="50%">PDRIVER_STARTIO DriverStartIo &nbsp;&nbsp;&nbsp;&nbsp;</TD>
    <TD width="50%">&nbsp; StartIo例程入口,一般该例程对低层设备驱动程序用得较多, 
高层驱动程序较少使用本例程。</TD></TR>
  <TR>
    <TD width="50%">PDRIVER_UNLOAD&nbsp; DriverUnload &nbsp;</TD>
    <TD width="50%">卸载驱动程序例程,如果想在控制面版的设备里停止该设备,应该提供本例程。</TD></TR>
  <TR>
    <TD width="50%">PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 
      1] </TD>
    <TD width="50%">&nbsp;&nbsp;&nbsp; 驱动程序的Dispatch例程表 </TD></TR></TBODY>
  <DIV></DIV>
  <SCRIPT language=javascript>
	<!--
	var fontzoom = getCookie("zhdo_Netjc_fontZoom");
	if(fontzoom!=null){
	var obj=$('a_content');
	obj.style.fontSize=fontzoom+'px';
	obj.style.lineHeight=(parseInt(fontzoom)+8)+'px';
	}
	//-->
	</SCRIPT>

  <DIV id=a_dy>【<SPAN title=复制文章网址,推荐给好友 style="CURSOR: pointer" 
  onclick="javascript:window.clipboardData.setData('text','USB开发步骤之软件篇:\nhttp://www.netjc.com.cn/html/200707/91036.html');alert('本文标题和网址已复制到您的剪贴板\n\n你可以通过QQ或MSN直接发送给好友\n\n^_^');">推荐给好友</SPAN>】 
  【<SPAN title=打印当前文章 style="CURSOR: pointer" 
  onclick=javascript:window.print();>打印本页</SPAN>】 【<SPAN title=回到页面顶部 
  style="CURSOR: pointer" onclick=javascript:window.scroll(0,0);>回到顶部</SPAN>】 
  </DIV>
  <DIV class=jg></DIV>
  <DIV></DIV>
  <DIV></DIV>
  <DIV id=right>
  <DIV class=right_head>教程分类</DIV>
  <DIV class=right_content>
  <UL id=right_class>
    <LI><A title=应用程序 
    href="http://www.netjc.com.cn/chtml/b13/index.html">应用程序</A>(17612) 
    <UL>
      <LI><A title=C++/VC教程 
      href="http://www.netjc.com.cn/chtml/s60/index.html">C++/VC教程</A>(3110) 
      <LI><A title=Delphi教程 
      href="http://www.netjc.com.cn/chtml/s61/index.html">Delphi教程</A>(2859) 
      <LI><A title=Java教程 
      href="http://www.netjc.com.cn/chtml/s62/index.html">Java教程</A>(10619) 
      <LI><A title=VB教程 
      href="http://www.netjc.com.cn/chtml/s63/index.html">VB教程</A>(1024) 
    </LI></UL></LI></UL></DIV>
  <DIV class=right_bottom></DIV>
  <DIV class=jg></DIV>
  <DIV class=right_head>相关教程</DIV>
  <DIV class=right_content>
  <UL id=hotarticle>
    <LI><A title=微软.NET平台中类型使用的基本原理 
    href="http://www.netjc.com.cn/html/200707/91254.html">微软.NET平台中类型使用的基本原理</A> 

    <LI><A title="用C++ Builder编写发送电子邮件软件" 
    href="http://www.netjc.com.cn/html/200711/151580.html">用C++ 
    Builder编写发送电子邮件软件...</A> 
    <LI><A title=防止信号处理失灵 
    href="http://www.netjc.com.cn/html/200707/90248.html">防止信号处理失灵</A> 
    <LI><A title=事件编程(二) 
    href="http://www.netjc.com.cn/html/200707/90035.html">事件编程(二)</A> 
    <LI><A title=C程序开发经典实例之1 
    href="http://www.netjc.com.cn/html/200711/150108.html">C程序开发经典实例之1</A> 
    <LI><A title=获取本机通讯薄的内容 
    href="http://www.netjc.com.cn/html/200707/91132.html">获取本机通讯薄的内容</A> 
    <LI><A title="用C++ Builder实现图像的特技显示" 
    href="http://www.netjc.com.cn/html/200711/151417.html">用C++ 
    Builder实现图像的特技显示...</A> 
    <LI><A title=如何在BCB中配置和使用GDI+技术?(附动画实例) 
    href="http://www.netjc.com.cn/html/200706/54980.html">如何在BCB中配置和使用GDI+技术?(附...</A> 

    <LI><A title=关于对于VC/MFC/ATL的评论问题 
    href="http://www.netjc.com.cn/html/200706/53436.html">关于对于VC/MFC/ATL的评论问题...</A> 

    <LI><A title=消息钩子函数入门篇 
    href="http://www.netjc.com.cn/html/200706/54924.html">消息钩子函数入门篇</A> 
    <LI><A title="C++ STL简介" 
    href="http://www.netjc.com.cn/html/200707/90154.html">C++ STL简介</A> 
    <LI><A title=在C++Builder中取得命令行参数 
    href="http://www.netjc.com.cn/html/200711/151556.html">在C++Builder中取得命令行参数...</A> 

    <LI><A title=树视控件在多文档中的使用 
    href="http://www.netjc.com.cn/html/200707/90396.html">树视控件在多文档中的使用</A> 
    <LI><A title=关于托盘的一点总结 
    href="http://www.netjc.com.cn/html/200707/90925.html">关于托盘的一点总结</A> 
    <LI><A title=KVIP考勤系统 
    href="http://www.netjc.com.cn/html/200707/90542.html">KVIP考勤系统</A> 
    <LI><A title="Win32 环境下的堆栈(二)" 
    href="http://www.netjc.com.cn/html/200706/54998.html">Win32 环境下的堆栈(二)</A> 
    <LI><A title=消息值,托管字符串,扰乱代码及其它 
    href="http://www.netjc.com.cn/html/200707/90969.html">消息值,托管字符串,扰乱代码及其它</A> 
    <LI><A title=用VC++进行MapX二次开发::之一------地理信息系统概述 
    href="http://www.netjc.com.cn/html/200706/54970.html">用VC++进行MapX二次开发::之一------地...</A> 

    <LI><A title=内联函数 
    href="http://www.netjc.com.cn/html/200711/150156.html">内联函数</A> 
    <LI><A title="在VC++ 6.0下利用消息实现内部进程通讯" 
    href="http://www.netjc.com.cn/html/200706/53248.html">在VC++ 
    6.0下利用消息实现内部进程通讯...</A> </LI></UL></DIV>
  <DIV class=right_bottom></DIV>
  <DIV class=jg></DIV>
  <DIV class=right_head>Google广告</DIV>
  <DIV class=right_content>
  <DIV class=jg></DIV>
  <CENTER>
  <SCRIPT type=text/javascript><!--
	google_ad_client = "pub-6112697235031941";
	google_ad_width = 250;
	google_ad_height = 250;
	google_ad_format = "250x250_as";
	google_ad_type = "text";
	google_ad_channel = "";
	google_color_border = "C8DEFF";
	google_color_bg = "FFFFFF";
	google_color_link = "0000FF";
	google_color_text = "000000";
	google_color_url = "008000";
	google_ui_features = "rc:6";
	//-->
	</SCRIPT>

  <SCRIPT src="USB开发步骤之软件篇 - 应用程序 - C++-VC教程.files/show_ads.js" 
  type=text/javascript>
	</SCRIPT>
  </CENTER>
  <DIV class=jg></DIV></DIV>
  <DIV class=right_bottom></DIV></DIV>
  <DIV id=bottom>
  <DIV><A href="http://www.netjc.com.cn/about.html">关于我们</A> | <A 
  href="http://www.netjc.com.cn/sm.html">免责声明</A> | <A 
  href="http://www.netjc.com.cn/map.html">网站导航</A> | <A 
  href="http://www.netjc.com.cn/contact.html">联系我们</A></DIV>
  <P>Copyright @ 2007-2008 www.netjc.com.cn Allrights Reserved <A 
  href="http://www.miibeian.gov.cn/" target=_blank>豫ICP备07011483号</A></P>
  <P>
  <SCRIPT language=javascript 
  src="USB开发步骤之软件篇 - 应用程序 - C++-VC教程.files/1077027.js" 
  type=text/javascript></SCRIPT>
  <NOSCRIPT><A href="http://www.51.la/?1077027" target=_blank><IMG 
  style="BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none" 
  alt=我要啦免费统计 src=""></A></NOSCRIPT>
  <SCRIPT language=JavaScript src="USB开发步骤之软件篇 - 应用程序 - C++-VC教程.files/stat.htm" 
  charset=gb2312></SCRIPT>
   </P></DIV></TABLE></DIV></DIV></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -