Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

Need help with usb Kernel-Mode Driver.

Alexey_GunkevichAlexey_Gunkevich Member - All Emails Posts: 9
I'm new to working with drivers. I use the USB Kernel-Mode Driver template provided with Microsoft Visual Studio Professional 2013 to write a simple kernel-mode driver framework (KMDF)-based client driver to work with usb mass storage device. After building and installing the client driver, I view the unknown device in Device Manager, and my driver don't see usb device. What's wrong? Probably incorrectly installed the driver or the wrong inf file? I use devcon.exe for install driver. inf file:
[Version]
Signature="$WINDOWS NT$"
Class=USBDevice
ClassGuid={88BAE032-5A81-49f0-BC3D-A4FF138216D6}
Provider=%ManufacturerName%
CatalogFile=USBDriver1.cat
DriverVer=09/05/2017,16.33.16.24

[DestinationDirs]
DefaultDestDir = 12

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

[SourceDisksFiles]
USBDriver1.sys = 1,,

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

[Manufacturer]
%ManufacturerName%=Standard,NTamd64

[Standard.NTamd64]
%USBDriver1.DeviceDesc%=USBDriver1_Device, USB\VID_1005&PID_B113

[USBDriver1_Device.NT]
CopyFiles=Drivers_Dir

[Drivers_Dir]
USBDriver1.sys

[USBDriver1_Device.NT.HW]
AddReg=USBDriver1_AddReg

;-------------- Class definition

[ClassInstall32]
AddReg = ClassInstall_AddReg

[ClassInstall_AddReg]
HKR,,,,%ClassName%
HKR,,NoInstallClass,,1
HKR,,IconPath,%REG_MULTI_SZ%,"%systemroot%\system32\setupapi.dll,-20"
HKR,,LowerLogoVersion,,5.2

;-------------- Service installation
[USBDriver1_Device.NT.Services]
AddService = USBDriver1,%SPSVCINST_ASSOCSERVICE%, USBDriver1_Service_Inst

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

;
;--- USBDriver1_Device Coinstaller installation ------
;

[DestinationDirs]
USBDriver1_Device_CoInstaller_CopyFiles = 11

[USBDriver1_Device.NT.CoInstallers]
AddReg=USBDriver1_Device_CoInstaller_AddReg
CopyFiles=USBDriver1_Device_CoInstaller_CopyFiles

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

[USBDriver1_Device_CoInstaller_CopyFiles]
WdfCoInstaller01011.dll

[SourceDisksFiles]
WdfCoInstaller01011.dll=1 ;

[USBDriver1_Device.NT.Wdf]
KmdfService = USBDriver1, USBDriver1_wdfsect
[USBDriver1_wdfsect]
KmdfLibraryVersion = 1.11

[Strings]
SPSVCINST_ASSOCSERVICE= 0x00000002
ManufacturerName=""
ClassName="Universal Serial Bus devices"
DiskName = "USBDriver1 Installation Disk"
USBDriver1.DeviceDesc = "USBDriver1 Device"
USBDriver1.SVCDESC = "USBDriver1 Service"
REG_MULTI_SZ = 0x00010000

Comments

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 6,833
    <quote>
    I view the
    unknown device in Device Manager, and my driver don't see usb device
    </quote>

    Have you unplugged and replugged your device?

    Very confusing. The VID and PID of the "unknown device" is VID_1005&PID_B113... This is apparently a USB Flash Drive made by Apacer, so I don't know why it would be unknown??

    Go into Device Manager, find the "unknown" device, right click on it, select properties, go to the Details tab and tell us what it says for the Hardware ID, please.

    Confused,

    Peter
    OSR
    @OSRDrivers

    Peter Viscarola
    OSR
    @OSRDrivers

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 12,714
    xxxxx@mail.ru wrote:
    > I'm new to working with drivers. I use the USB Kernel-Mode Driver template provided with Microsoft Visual Studio Professional 2013 to write a simple kernel-mode driver framework (KMDF)-based client driver to work with usb mass storage device. After building and installing the client driver, I view the unknown device in Device Manager, and my driver don't see usb device.

    How, exactly, did you install the driver?  One of the most common newbie
    mistakes is to use the enticingly named "devcon install" tool, but that
    is the wrong answer for a Plug-n-Play driver package.  What that will do
    is create a brand-new FAKE device called USB\VID_1005&PID_8113, and then
    load your driver to handle that fake device.  There won't be any USB
    hardware underneath it.

    The easy way to test your driver is to find your USB stick in Device
    Manager under Storage Controllers, then right-click and Update Driver.

    --
    Tim Roberts, xxxxx@probo.com
    Providenza & Boekelheide, Inc.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • Alexey_GunkevichAlexey_Gunkevich Member - All Emails Posts: 9
    Hi, Tim.
    <quote>
    The easy way to test your driver is to find your USB stick in Device Manager under Storage Controllers, then right-click and Update Driver.
    </quote>

    I tried to do as you advised, but I constantly receive this message:The most suitable software for this device is already installed.
    Is it possible to somehow force the driver?
  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 6,833
    <quote>
    Is it possible to somehow force the driver?
    </quote>

    Yes, it is. Do ?Update Driver? but don?t let it search. Use ?allow me to pick the driver? or whatever... and also ?have disk?... point the installer to your install directory that has your driver package.

    Peter
    OSR
    @OSRDrivers

    Peter Viscarola
    OSR
    @OSRDrivers

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 12,714
    xxxxx@mail.ru wrote:
    > I tried to do as you advised, but I constantly receive this message:The most suitable software for this device is already installed.
    > Is it possible to somehow force the driver?

    So, how did you install the driver originally?  Did you use "devcon
    install"?  If so, then you are going to need to remove the fake device
    you accidentally created.

    --
    Tim Roberts, xxxxx@probo.com
    Providenza & Boekelheide, Inc.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • matt_sykesmatt_sykes Member - All Emails Posts: 233
    Did you test sign your driver and put the target PC in test mode?

    Devcon works for installing, but it is simpler to copy your cat, sys and inf to the target and do an update driver as Peter says, and do the 'let me specify the driver', and point at the inf.
  • Alexey_GunkevichAlexey_Gunkevich Member - All Emails Posts: 9
    Thank you all for your responding. I managed to install the driver for the flash drive. I would like to consult with you. I would like to try to create a cryptographically protected device, namely, that the data on the flash drives were encrypted and when trying to enter the device, a password was requested, which is the key to decryption. I would like to receive advice: which driver to use umdf, kmdf or filter. I will be grateful for any advice and help.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!