驱动程序开发学习(五)安装
来源:互联网 发布:配置windows功能失败 编辑:程序博客网 时间:2024/06/06 00:12
原帖地址:http://borland.mblogger.cn/doublefisher/posts/24516.aspx
作为一个完整的例子,你开发出来驱动还必须要能安装。所以下面我讲一下安装。
如果前面的编译过程没有错误的话,现在我们应该已经得到了一个HelloWDM.sys文件,假设它是放在D:\HelloWDM\objfre\i386中。
安装WDM驱动程序可以用两种方法,一种是利用注册表,还有一种是利用INF文件。我们一般是采用INF文件(这是微软推荐的)。INF文件可以在 WINNT\INF 目录中找到很多。为了顺利安装,我在这里先给出 HelloWDM 所需要的 HelloWDM.INF 文件:
;--------- Version Section ---------------------------------------------------
[Version]
Signature="$CHICAGO$"
Provider=LC_Device
DriverVer=8/21/2002,3.0.0.3
; If device fits one of the standard classes, use the name and GUID here,
; otherwise create your own device class and GUID as this example shows.
Class=Unknown
ClassGUID={ff646f80-8def-11d2-9449-00105a075f6b}
;--------- SourceDiskNames and SourceDiskFiles Section -----------------------
; These sections identify source disks and files for installation. They are
; shown here as an example, but commented out.
[SourceDisksNames]
1 = "HelloWDM",Disk1,,
[SourceDisksFiles]
HelloWDM.sys = 1,objfre\i386,
;--------- ClassInstall/ClassInstall32 Section -------------------------------
; Not necessary if using a standard class
; 9X Style
[ClassInstall]
Addreg=Class_AddReg
; NT Style
[ClassInstall32]
Addreg=Class_AddReg
[Class_AddReg]
HKR,,,,%DeviceClassName%
HKR,,Icon,,"-5"
;--------- DestinationDirs Section -------------------------------------------
[DestinationDirs]
YouMark_Files_Driver = 10,System32\Drivers
;--------- Manufacturer and Models Sections ----------------------------------
[Manufacturer]
%MfgName%=Mfg0
[Mfg0]
; PCI hardware Ids use the form
; PCI\VEN_aaaa&DEV_bbbb&SUBSYS_cccccccc&REV_dd
;改成你自己的ID
%DeviceDesc%=YouMark_DDI, PCI\VEN_9999&DEV_9999
;---------- DDInstall Sections -----------------------------------------------
; --------- Windows 9X -----------------
; Experimentation has shown that DDInstall root names greater than 19 characters
; cause problems in Windows 98
[YouMark_DDI]
CopyFiles=YouMark_Files_Driver
AddReg=YouMark_9X_AddReg
[YouMark_9X_AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,HelloWDM.sys
HKR, "Parameters", "BreakOnEntry", 0x00010001, 0
; --------- Windows NT -----------------
[YouMark_DDI.NT]
CopyFiles=YouMark_Files_Driver
AddReg=YouMark_NT_AddReg
[YouMark_DDI.NT.Services]
Addservice = HelloWDM, 0x00000002, YouMark_AddService
[YouMark_AddService]
DisplayName = %SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%\System32\Drivers\HelloWDM.sys
[YouMark_NT_AddReg]
HKLM, "System\CurrentControlSet\Services\HelloWDM\Parameters",\
"BreakOnEntry", 0x00010001, 0
; --------- Files (common) -------------
[YouMark_Files_Driver]
HelloWDM.sys
;--------- Strings Section ---------------------------------------------------
[Strings]
ProviderName="Flying L Co.,Ltd."
MfgName="LC Soft"
DeviceDesc="Hello World WDM!"
DeviceClassName="LC_Device"
SvcDesc="???"
注意它可以同时在Win98或者Win2000中使用(系统会通过这个INF文件里面的字段名称,自动选择适合当前系统的安装方法的)。关于INF文件的各个字段含义现在我也不知道,所以也没有办法说清楚,如果谁看到这篇文章,而又知道的话,不妨为我一份。
准备好这个 HelloWDM.INF 文件后,让我们打开控制面板,双击“添加/删除硬件”,选择“添加/排除设备故障”->“添加新设备”->“否,我想从列表选择硬件”->“其它设备”->“从磁盘安装”,选择 HelloWDM.INF 所在的路径,然后安装。
当安装完成后,系统就会添加上你写好的驱动程序了。(可以在“设备管理器”中查看到)。然后重启电脑,这个驱动程序就投入使用啦。
- 驱动程序开发学习(五)安装
- 驱动程序开发学习(五)安装
- 驱动程序开发技术详解读书笔记(五)
- 驱动程序学习(五)select and poll
- 驱动程序开发学习(二)开发工具
- 驱动程序开发学习(二)开发工具
- Windows驱动开发基础(五)驱动程序的数据结构
- 驱动程序开发学习(一)概述
- 驱动程序开发学习(三)hello world
- 驱动程序开发学习(四)编译
- 驱动程序开发学习(一)概述
- 驱动程序开发学习(三)hello world
- 驱动程序开发学习(四)编译
- 驱动程序开发学习-----20120414
- 驱动程序开发学习
- Windows驱动程序开发学习笔记(一) - 下载并安装WDK
- Linux USB 驱动开发(五)—— USB驱动程序开发过程简单总结
- Linux USB 驱动开发(五)—— USB驱动程序开发过程简单总结
- log4j的使用(转载)
- 利用JavaAPI访问HDFS的文件
- SoundWave:基于声波的手势识别 笔记本一秒变Kinect
- C#:Win32 Hooks(一)让下一个弹出子窗体自动显示在父窗体中心
- Oralce 报“无效数字”错误
- 驱动程序开发学习(五)安装
- 拾人牙慧
- 实在不能忍受公司的破烂网络了,本来有些日志啥的都是写在qq上的,新的就写这里了
- 浮点数的存储方法—使用分数
- 计划采购订单
- CentOS6.0虚拟机上安装nginx启动的错误---缺少libpcre.so.1共享库
- 单点登录和社会化登录的区别
- linux设置IP
- C#:Win32 Hooks(二)让MessageBox自动显示在父窗体中心