Porting HID KMDF driver to UMDF2, Stuck at the initial state

I am trying to move an KMDF hid driver, to a UMDF2 mini port driver, following this architecture.
And referring to Microsoft’s vhidmini2 example.
My Current target is just to pass the initial state (show up correctly on device manager), and continue my KMDF->UMDF2 porting.

UMDF2 Driver Can be install, but when I go into device manager, it appears with a “!” in front of it. ("!"MyDriver)
And according to the document
https://docs.microsoft.com/en-us/windows-hardware/drivers/wdf/creating-umdf-hid-minidrivers
Seems like my UMDF2 code passed DriverEntry & PrepareHardware.

And I am currently stuck on this step.
Provide an EvtIoDeviceControl callback function that branches to IOCTL-specific method handlers.
Review the IOCTLs described in WDF HID Minidriver IOCTLs and ensure that your driver handles the relevant ones for your device.

Do I need to reply the IOCTL_GET_DEVICE_DESCRIPTOR, IOCTL_HID_GET_DEVICE_ATTRIBUTES & IOCTL_HID_GET_REPORT_DESCRIPTOR?
I try to hard-coded those descriptors, but it reports 0x80000022.
Because seems like the example code, need to reply at least 3 things, to get the device showing in device manager, without “!”.

My KMDF driver doesn’t seem that it needs to have those things.

jasonwu wrote:

And referring to Microsoft’s vhidmini2 example.

My Current target is just to pass the initial state (show up correctly on device manager), and continue my KMDF->UMDF2 porting.

UMDF2 Driver Can be install, but when I go into device manager, it appears with a “!” in front of it. ("!"MyDriver)

What is the Device Manager error code?  Why would you ever ask about an
error without including the exact error code?

Review the IOCTLs described in WDF HID Minidriver IOCTLs and ensure that your driver handles the relevant ones for your device.
Do I need to reply the IOCTL_GET_DEVICE_DESCRIPTOR, IOCTL_HID_GET_DEVICE_ATTRIBUTES & IOCTL_HID_GET_REPORT_DESCRIPTOR?
I try to hard-coded those descriptors, but it reports 0x80000022.

That’s STATUS_NO_DATA_DETECTED.  Where do you see that?  If you are
getting a bang in Device Manager, then the device cannot be opened and
the system is never going to send you any ioctls.

Because seems like the example code, need to reply at least 3 things, to get the device showing in device manager, without “!”.

Actually, you don’t.  The ioctl handlers are required to make the device
not operate correctly, but the Device Manager “bang” (!) is all about
installation and initialization.

Thanks for response

This is a KMDF based USB HID Mouse Intercept driver, trying to intercept movement and buttons input, modify and send back to Window OS.
Is that possible to move those driver to UMDF2?

  1. Here’s the bang, device cannot start with error code 10.

  2. 0x80000022 from
    C:\Windows\INF\setupapi.dev.log
    it just fails to start.

flq: Copying ‘C:\WINDOWS\System32\DriverStore\FileRepository\tbwkernum.inf_amd64_87294cf80a538a98\TbwKernUm.dll’ to ‘C:\WINDOWS\System32\drivers\UMDF\TbwKernUm.dll’.
idb: Last driver package ‘tbwkernum.inf_amd64_1f801c1ffcd9f894’ to copy ‘C:\WINDOWS\System32\drivers\UMDF\TbwKernUm.dll’ needs reconfiguration.
dvi: Existing files modified, may need to restart related services.
sto: {Configure Driver Package: exit(0x00000bc3)}
dvi: Restart required for any devices using this driver.
dvi: Install Device: Configuring device (oem217.inf:hid\vid_047d&pid_1020,TbwKernUm_Install.NT). 08:29:58.057
dvi: Install Device: Configuring device completed. 08:29:58.064
dvi: Device Status: 0x01802400, Problem: 0xa (0xc000009c)
dvi: {Restarting Devices} 08:29:58.067
dvi: Start: HID\VID_047D&PID_1020\6&2DF7F91A&0&0000
!!! dvi: Device not started: Device has problem: 0x0a (CM_PROB_FAILED_START), problem status: 0x80000022.
dvi: {Restarting Devices exit} 08:29:58.412
dvi: {Configure Device - exit(0x00000000)} 08:29:58.416
dvi: Device Status: 0x01802400, Problem: 0xa
dvi: {Install Device - exit(0x00000000)} 08:29:58.440
dvi: {Core Device Install - exit(0x00000000)} 08:29:58.441
ump: {Plug and Play Service: Device Install exit(00000000)}
ndv: {Install Related Drivers} 08:29:58.446
ndv: {Install Related Drivers: exit(0x00000000)} 08:29:58.465
dvi: {DIF_NEWDEVICEWIZARD_FINISHINSTALL} 08:29:58.480
dvi: Using exported function ‘CoDeviceInstall’ in module ‘C:\WINDOWS\system32\WUDFCoinstaller.dll’.
dvi: CoInstaller 1 == WUDFCoinstaller.dll
dvi: CoInstaller 1: Enter 08:29:58.485
dvi: CoInstaller 1: Exit
dvi: Default installer: Enter 08:29:58.489
dvi: Default installer: Exit
dvi: {DIF_NEWDEVICEWIZARD_FINISHINSTALL - exit(0xe000020e)} 08:29:58.490
ndv: {Update Driver Software Wizard exit(00000000)}
<<< Section end 2018/11/17 08:29:59.451
<<< [Exit status: SUCCESS]

  1. The KMDF code is to create a PDO child, and use WdfFdoAddStaticChild() to add this pdo device in “DeviceAdd” callback.
    but however, on UMDF2, those function are not available, is there any other approach I can do?

  2. Here’s my INX

;
; TbwKernUm.inf
;

[Version]
Signature=“$Windows NT$”
Class=Mouse
ClassGuid={4D36E96F-E325-11CE-BFC1-08002BE10318}
Provider=%ManufacturerName%
CatalogFile=TbwKernUm.cat
DriverVer=

[Manufacturer]
%ManufacturerName%=Standard,NT$ARCH$

[Standard.NT$ARCH$]

%HID\Vid_047D&Pid_1020.DeviceDesc%=TbwKernUm_Install, HID\Vid_047D&Pid_1020 ; Expert
%HID\Vid_047D&Pid_2041.DeviceDesc%=TbwKernUm_Install, HID\Vid_047D&Pid_2041 ; Slimblade
%HID\Vid_047D&Pid_1022.DeviceDesc%=TbwKernUm_Install, HID\Vid_047D&Pid_1022 ; Orbit
%HID\Vid_047D&Pid_2048.DeviceDesc%=TbwKernUm_Install, HID\Vid_047D&Pid_2048 ; Eagle
%HID\Vid_047D&Pid_8002.DeviceDesc%=TbwKernUm_Install, HID\Vid_047D&Pid_8002 ; Orbit wireless
%HID\Vid_047D&Pid_8018.DeviceDesc%=TbwKernUm_Install, HID\Vid_047D&Pid_8018&MI_00&Col01 ; Expert wireless
%HID{00001812-0000-1000-8000-00805f9b34fb}_Dev_VID&02047d_PID&8019&Col01.DeviceDesc%=TbwKernUm_Install, HID{00001812-0000-1000-8000-00805f9b34fb}_Dev_VID&02047d_PID&8019&Col01 ; Expert wireless (BLE)
%HID{00001812-0000-1000-8000-00805f9b34fb}_Dev_VID&01047d_PID&8019&Col01.DeviceDesc%=TbwKernUm_Install, HID{00001812-0000-1000-8000-00805f9b34fb}_Dev_VID&01047d_PID&8019&Col01 ; Expert wireless (BLE)

[SourceDisksFiles]
TbwKernUm.dll=1

[SourceDisksNames]
1 = %DiskName%

; =================== UMDF Device ==================================

[TbwKernUm_Install.NT]
CopyFiles=UMDriverCopy

[TbwKernUm_Install.NT.hw]
AddReg=TbwKernUm_AddReg

[TbwKernUm_Install.NT.Services]
AddService=mshidumdf, 0x000001fa, MSHIDUMDF_ServiceInstall ; flag 0x2 sets this as the service for the device
AddService=WUDFRd,0x000001f8,WUDFRD_ServiceInstall ; this service is installed because its a filter.

[TbwKernUm_Install.NT.CoInstallers]
AddReg=CoInstallers_AddReg

[TbwKernUm_Install.NT.Wdf]
UmdfDispatcher=NativeUSB
UmdfService=TbwKernUm,TbwKernUm_Install
UmdfServiceOrder=TbwKernUm
UmdfKernelModeClientPolicy=AllowKernelModeClients
UmdfFileObjectPolicy=AllowNullAndUnknownFileObjects
UmdfMethodNeitherAction=Copy
UmdfFsContextUsePolicy=CanUseFsContext2

[TbwKernUm_Install]
UmdfLibraryVersion=$UMDFVERSION$
ServiceBinary=%12%\UMDF\TbwKernUm.dll

[TbwKernUm_AddReg]
; By default, USBDevice class uses iProduct descriptor to name the device in
; Device Manager on Windows 8 and higher.
; Uncomment for this device to use %DeviceName% on Windows 8 and higher:
HKR,FriendlyName,%DeviceName%
HKR,“LowerFilters”,0x00010008,“WUDFRd” ; FLG_ADDREG_TYPE_MULTI_SZ | FLG_ADDREG_APPEND

[mshidumdf_ServiceInstall]
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\mshidumdf.sys

[WUDFRD_ServiceInstall]
DisplayName = %WudfRdDisplayName%
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\WUDFRd.sys

[CoInstallers_AddReg]
HKR,CoInstallers32,0x00010000,“WUDFCoinstaller.dll”

[DestinationDirs]
UMDriverCopy=12,UMDF ; copy to drivers\umdf

[UMDriverCopy]
TbwKernUm.dll

; =================== Generic ==================================

[Strings]
ManufacturerName=“JasonWu”
ClassName=“Universal Serial Bus devices”
DiskName = “TbwKernUm Installation Disk”
WudfRdDisplayName=“Windows Driver Foundation - User-mode Driver Framework Reflector”
DeviceName=“Kensington TrackBall Device”
ConfDeviceName=“Kensington TrackBall Settings”
REG_MULTI_SZ = 0x00010000

HID\Vid_047D&Pid_1020.DeviceDesc = “Kensington Expert Mouse”
HID\Vid_047D&Pid_2041.DeviceDesc = “Kensington Slimblade Trackball”
HID\Vid_047D&Pid_1022.DeviceDesc = “Kensington Orbit Optical Trackball”
HID\Vid_047D&Pid_2048.DeviceDesc = “Kensington Orbit Trackball with Scroll Ring”
HID\Vid_047D&Pid_8002.DeviceDesc = “Kensington Orbit Wireless Mobile Trackball”
HID\Vid_047D&Pid_8018.DeviceDesc = “Kensington Expert Wireless Trackball”
HID{00001812-0000-1000-8000-00805f9b34fb}_Dev_VID&02047d_PID&8019&Col01.DeviceDesc = “Kensington Expert Wireless Trackball (BLE)”
HID{00001812-0000-1000-8000-00805f9b34fb}_Dev_VID&01047d_PID&8019&Col01.DeviceDesc = “Kensington Expert Wireless Trackball (BLE)”

  1. My code is only “DriverEntry”, “PrepareHardware”" and “DeviceIoctl” now, I want to start with no “bang” and I can continue.

You should stick to kmdf. You can

@Doron_Holan said:
You should stick to kmdf. You can

So i can’t really do an USB HID intercept driver on UMDF2 right?