在Windows 7上安装内核模式驱动程序

时间:2014-02-23 03:03:24

标签: windows kernel driver kmdf

我一直在Microsoft阅读教程。我已经在Windows 7 64位上编译了KMDFSmall内核设备驱动程序。我已完成本教程的编程部分,我的代码编译成功,我有KmdfSmall.inf文件,KmdfSmall.sys文件,KmdfSmall.cer文件,WdfCoinstaller01011.dll文件,kmdfsmall.cat文件。

但是,我没有测试机器来运行它。我只想将这个玩具驱动程序安装到我自己的机器上。我阅读here如何使用添加硬件向导安装它。我经历了这些步骤,但我遇到了问题。

因此,我单击“开始”并键入hdwwiz并运行“添加Harware向导”。我做手动安装,选择INF文件,其中显示有磁盘,KmdfSmall设备出现,我点击下一步,但我收到以下错误信息。

  

未安装以下硬件。   KmdfSmall设备

     

安装设备时出错。

     

系统找不到指定的文件。

我不知道找不到什么文件?

这是我的INF文件:

;
; KmdfSmall.inf
;

[Version]
Signature="$WINDOWS NT$"
Class=Sample ; TODO: edit Class
ClassGuid={78A1C341-4539-11d3-B88D-00C04FAD5171} ; TODO: edit ClassGuid
Provider=%ManufacturerName%
CatalogFile=KmdfSmall.cat
DriverVer=02/22/2014,19.58.50.950

[DestinationDirs]
DefaultDestDir = 12

; ================= Class section =====================

[ClassInstall32]
Addreg=SampleClassReg

[SampleClassReg]
HKR,,,0,%ClassName%
HKR,,Icon,,-5

[SourceDisksNames]
1 = %DiskName%,,,""

[SourceDisksFiles]
KmdfSmall.sys  = 1,,

;*****************************************
; Install Section
;*****************************************

[Manufacturer]
%ManufacturerName%=Standard,NTamd64

[Standard.NTamd64]
%KmdfSmall.DeviceDesc%=KmdfSmall_Device, Root\KmdfSmall ; TODO: edit hw-id

[KmdfSmall_Device.NT]
CopyFiles=Drivers_Dir

[Drivers_Dir]
KmdfSmall.sys

;-------------- Service installation
[KmdfSmall_Device.NT.Services]
AddService = KmdfSmall,%SPSVCINST_ASSOCSERVICE%, KmdfSmall_Service_Inst

; -------------- KmdfSmall driver install sections
[KmdfSmall_Service_Inst]
DisplayName    = %KmdfSmall.SVCDESC%
ServiceType    = 1               ; SERVICE_KERNEL_DRIVER
StartType      = 3               ; SERVICE_DEMAND_START
ErrorControl   = 1               ; SERVICE_ERROR_NORMAL
ServiceBinary  = %12%\KmdfSmall.sys
LoadOrderGroup = Extended Base

;
;--- KmdfSmall_Device Coinstaller installation ------
;

[DestinationDirs]
KmdfSmall_Device_CoInstaller_CopyFiles = 11

[KmdfSmall_Device.NT.CoInstallers]
AddReg=KmdfSmall_Device_CoInstaller_AddReg
CopyFiles=KmdfSmall_Device_CoInstaller_CopyFiles

[KmdfSmall_Device_CoInstaller_AddReg]
HKR,,CoInstallers32,0x00010000, "WdfCoInstaller01011.dll,WdfCoInstaller"

[KmdfSmall_Device_CoInstaller_CopyFiles]
WdfCoInstaller01011.dll

[SourceDisksFiles]
WdfCoInstaller01011.dll=1 ; make sure the number matches with SourceDisksNames

[KmdfSmall_Device.NT.Wdf]
KmdfService =  KmdfSmall, KmdfSmall_wdfsect
[KmdfSmall_wdfsect]
KmdfLibraryVersion = 1.11

[Strings]
SPSVCINST_ASSOCSERVICE= 0x00000002
ManufacturerName="" ; TODO: add ManufacturerName
ClassName="Samples" ; TODO: edit ClassName
DiskName = "KmdfSmall Installation Disk"
KmdfSmall.DeviceDesc = "KmdfSmall Device"
KmdfSmall.SVCDESC = "KmdfSmall Service"

0 个答案:

没有答案