我一直在学习微软的教程。我已经在 Windows 7 64 位上编译了 KMDFSmall 内核设备驱动程序。我已经完成了教程的编程部分,我的代码编译成功,我还有 KmdfSmall.inf 文件、KmdfSmall.sys 文件、KmdfSmall.cer 文件、WdfCoinstaller01011.dll 文件、kmdfsmall.cat 文件。
但是,我没有测试机器来运行它。我只想把这个玩具驱动安装到我自己的机器上。我在这里阅读了如何使用添加硬件向导安装它。我完成了这些步骤,但我遇到了问题。
因此,我单击开始并键入 hdwwiz 并运行添加硬件向导。我进行手动安装,选择显示有磁盘的 INF 文件,出现 KmdfSmall 设备,我单击下一步,但我收到以下错误消息。
未安装以下硬件。Kmdf小型设备
安装设备时发生错误。
该系统找不到指定的文件。
不知道找不到什么文件?
这是我的 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"