Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results
The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.
Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/
Hi OSR Community!
I want to install a PnP mouse driver and as far as I know it needs to create an special .inf file, but I can't find an example of such a file (for PnP). Can anyone show how the corresponding .inf file should look like and what in general needs to be done to register the PnP driver and call the AddDevice function when USB mouse plugged in?
Upcoming OSR Seminars | ||
---|---|---|
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead! | ||
Kernel Debugging | 16-20 October 2023 | Live, Online |
Developing Minifilters | 13-17 November 2023 | Live, Online |
Internals & Software Drivers | 4-8 Dec 2023 | Live, Online |
Writing WDF Drivers | 10-14 July 2023 | Live, Online |
Comments
The firefly sample has an inf file. Here: https://github.com/microsoft/Windows-driver-samples/blob/main/hid/firefly/README.md
Note that it's actually an 'inx'.
I'd like to explore that simple statement. In the world today, there are (to two decimal places) no mouse devices that are not USB. USB mouse devices are always detected automatically and require neither a driver nor an INF.
So, what are you actually doing here?
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
Thank you so much! I successfully installed the driver through this inf file, just changing the name of the driver to my own. However, after installing the driver, I insert a USB mouse into the computer, but this action does not load the driver into memory. With what it can be connected?
I just try to learn how PnP works in practice on USB mouse example
PnP is all just a matching game. When given a PnP device, the device manager goes through its database of every INF that has been installed looking for a match for the device attributes (hardware ID, device class, etc). Windows ships with an INF file that matches all USB devices that are identified as mice in their descriptors (device class HID, subclass Mouse). That's going to match every device that says it is a mouse.
It is possible to install a driver for your specific device, but your match has to be more specific. With USB, that means matching your Vendor ID and Product ID, with an identifier that looks like "USB\VID_1234&PID_5678". That's what you put in your INF file to "claim" your specific device.
It's not clear that mice are the right devices to begin with. If you claim your mouse, then the operating system will no longer use it as a mouse. For you to communicate with the mouse, you would need to understand the USB HID protocols, to know what commands to send. If you want to play around, there are a large number of inexpensive USB experimenter's kits that include buttons, switches, LEDs, and other things that you can play with to your heart's content.
Remember that, unless you have a kernel debugger connected, your driver package will need to be signed by Microsoft in order to be used.
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
Thank you very much.
I got the ID of my mouse on the main OS and registered it in the inf file, however, there is no device with the same ID on the virtual machine (test machine), but the USB mouse works correctly. Instead, I have three mouse devices in a virtual machine
1) HID-compliant mouse
2) VMWare Pointing Device
3) VMWare USB Pointing Device
This list does not change when I insert a USB mouse. However, on the main OS, the list changes when I insert or remove the mouse. Can you tell me please which device ID to use? Also, these identifiers look different than they do on the main OS. They look different. For example HID\VID_0E0F&UP:0001_U:0002
I got the ID of my mouse on the main OS and registered it in the inf file, however, there is no device with the same ID on the virtual machine, but the USB mouse works correctly. Instead, I have three mouse devices in a virtual machine
1) HID-compliant mouse
2) VMWare Pointing Device
3) VMWare USB Pointing Device
This list does not change when I insert a USB mouse. However, on the main OS, the list changes when I insert or remove the mouse. Can you tell me please which device ID i should use? Also, these identifiers look different than they do on the main OS. They look different. For example HID\VID_0E0F&UP:0001_U:0002
The VM does not own any mice. VMWare creates a fake mouse device inside the VM (VID 0E0F belongs to VMWare) . The VMWare application then tracks the host system's mouse within its window, and routes inputs to the fake device.
"HID\VID_0E0F&UP:0001_U:0002" is the HID class device, which lives a layer above USB. The USB mouse driver creates a HID device. In this case, usage page (UP) 1, usage (U) 2.
Again, I think you would be much happier using a USB experimenter's kit, where you would have complete control and you won't be battling VM overhead.
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
Unfortunately I have no experience with USB experimenter's kit (never heard about)...
It turns out that we can't test pnp mouse drivers on virtual machines? Or is there still a way?
You don't have any experience with USB mice, either, but that's not stopping you.
I don't know what you're expecting to DO with your mouse. You should be able to use the VMWare menus to assign that mouse to your VM. I know how to do it with VirtualBox, but not VMWare. That gives your VM exclusive control of the mouse, and it should show up as a native device.
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
Thank you so much. VMWare also has the ability to work with a USB device as if it were a physical device. Now I have another problem. I can't install the driver via the .inf file. The .inf file itself is fine (checked by infverif and inf2cat). After I click the "Install" button, I get the message "The operation completed successfully" and I expect my driver to be installed.
But when I try to enter the command "sc delete MouseDriver" I get the error "The specified service does not exist as an installed service". I think this means that my driver is not installed on the system, but there are no errors during the installation process. What could be the problem and how can I find the reason?
My driver is not WDF driver
Platform is NTAMD64
There is my .inf file
;/++
;
; Copyright (c) Microsoft Corporation. All rights reserved.
;
; Module Name:
; MouseDriver.inf
;
; Important:
; This INF depends on features for the Driver Store DIRIDs which are available starting Windows 10 1809
;
;--/
[Version]
Signature="$Windows NT$"
Class=Mouse
ClassGUID={4D36E96F-E325-11CE-BFC1-08002BE10318}
Provider=%Provider%
DriverVer=03/17/2001,1.0.0.1
CatalogFile=MouseDriver.cat
CatalogFile.NTAMD64 = MouseDriver.cat
PnpLockdown=1
[DestinationDirs]
DefaultDestDir = 13
[SourceDisksNames]
1 = %DiskName%
[SourceDisksFiles]
MouseDriver.sys = 1
[ControlFlags]
; We don't want our device to be installable via the non-PnP hardware dialogs
ExcludeFromSelect = *
; Manufacturer Section
; ---------------------------------------------------------
[Manufacturer]
%ShinyThings%=ShinyThingsMfg,NT,NTAMD64
; Devices Section
; ---------------------------------------------------------
[ShinyThingsMfg.NT]
%HID\Vid_045E&Pid_001E.DeviceDesc%=MouseDriver_Inst, HID\Vid_045E&Pid_001E
%HID\Vid_045E&Pid_0029.DeviceDesc%=MouseDriver_Inst, HID\Vid_045E&Pid_0029
%HID\Vid_045E&Pid_0039.DeviceDesc%=MouseDriver_Inst, HID\Vid_045E&Pid_0039
%HID\Vid_045E&Pid_0040.DeviceDesc%=MouseDriver_Inst, HID\Vid_045E&Pid_0040
%HID\Vid_045E&Pid_0047.DeviceDesc%=MouseDriver_Inst, HID\Vid_045E&Pid_0047
%HID\VID_10C4&PID_8108.DeviceDesc%=MouseDriver_Inst, HID\VID_10C4&PID_8108
; Install Section
; ---------------------------------------------------------
[MouseDriver_Inst.NT]
Include = MSMOUSE.INF
Needs = HID_Mouse_Inst.NT
CopyFiles = MouseDriver_Inst_CopyFiles.NT
[MouseDriver_Inst.NT.HW]
Include = MSMOUSE.INF
Needs = HID_Mouse_Inst.NT.Hw
AddReg = MouseDriver_Inst_HWAddReg.NT
[MouseDriver_Inst_HWAddReg.NT]
HKR,,"UpperFilters",0x00010000,"MouseDriver"
[MouseDriver_Inst_CopyFiles.NT]
MouseDriver.sys
[MouseDriver_Inst.NT.Services]
Include = MSMOUSE.INF
Needs = HID_Mouse_Inst.NT.Services
AddService = MouseDriver, , MouseDriver_Service_Inst
[MouseDriver_Service_Inst]
DisplayName = %MouseDriver.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %13%\MouseDriver.sys
;[MouseDriver_Inst.NT.Wdf]
;KmdfService = MouseDriver, MouseDriver_wdfsect
;[MouseDriver_wdfsect]
;KmdfLibraryVersion = $KMDFVERSION$
; Strings Section
; ---------------------------------------------------------
[Strings]
; Provider names
Provider = "TODO-Set-Provider"
; Mfg names
ShinyThings = "Shiny Things"
; Service names
MouseDriver.SvcDesc = "MouseDriver Service"
; Media names
DiskName = "MouseDriver Driver Disk"
; HID device IDs
HID\VID_045E&PID_001E.DeviceDesc = "Shiny Things MouseDriver Mouse"
HID\VID_045E&PID_0029.DeviceDesc = "Shiny Things MouseDriver Mouse"
HID\VID_045E&PID_0039.DeviceDesc = "Shiny Things MouseDriver Mouse"
HID\VID_045E&PID_0040.DeviceDesc = "Shiny Things MouseDriver Mouse"
HID\VID_045E&PID_0047.DeviceDesc = "Shiny Things MouseDriver Mouse"
HID\VID_10C4&PID_8108.DeviceDesc = "Shiny Things MouseDriver Mouse"
; Standard defs
SPSVCINST_TAGTOFRONT = 0x00000001
SPSVCINST_ASSOCSERVICE= 0x00000002
SERVICE_KERNEL_DRIVER = 1
SERVICE_BOOT_START = 0
SERVICE_SYSTEM_START = 1
SERVICE_AUTO_START = 2
SERVICE_ERROR_NORMAL = 1
SERVICE_ERROR_IGNORE = 0
REG_EXPAND_SZ = 0x00020000
REG_DWORD = 0x00010001
REG_SZ = 0x00000000
I am installed driver using pnputil program and there is output:
Adding driver package: MouseDriver.inf
Driver package added successfully. (Already exists in the system)
Published Name: oem24.inf
Driver package installed on device: HID\VID_10C4&PID_8108\7&2267ed04&0&0000
Total driver packages: 1
Added driver packages: 1
OK, system says my driver is installed. But when i am put device with ID = HID\VID_10C4&PID_8108 into my computer, Windows is not load my driver and of course does not call AddDevice function.
Maybe i misunderstand some key concepts?
When you say "click the 'Install' button", did you mean in Explorer? You NEVER use the "Install" button with a PnP package, and you do not use "sc" to manage its lifetime. Those options are for so-called "legacy" drivers that are not PnP.
Usually, for testing, you plug the device in, and find the device in Device Manager and use "Update Driver". However, pnputil should also work.
It looks like you have installed your driver as an upper filter. Is that what you intended? If you check the registry, do you see the UpperFilters key set up?
However, repeating what we've said before, it's not going to install your device unless you have had it signed by Microsoft. Check the logs in \Windows\Inf\setupapi.log to see if there's anything interesting there.
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
Thank you so much. OK, i got your point about "Install" button. I think i don`t need driver signing, because windbg is enabled and Windows running in the test mode. In this case, driver can be loaded without code sign.
As far as I know, in order for the AddDevice function to be called, I have to set the driver as an upper filter. My end goal is to get a load driver and call to the AddDevice function. If this is done otherwise, please let me know.
In registry, under key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4d36e96f-e325-11ce-bfc1-08002be10318} i have following data:
Class REG_SZ Mouse
ClassDesc REG_SZ @%SystemRoot%\System32\SysClass.Dll,-3004
DefaultService i8042prt
IconPath REG_MULTI_SZ %SystemRoot%\System32\setupapi.dll,-2
NoInstallClass REG_SZ 1
UpperFilters REG_MULTI_SZ mouclass (only 1 value)
Here is my setupapi log:
<<< Section end 2023/08/29 09:21:19.562
<<< [Exit status: SUCCESS]
Well, no. Have you read the MIcrosoft documentation about PnP drivers? Every device has a primary driver (also called "associated driver" or "function driver"). In addition, you can add filter drivers that sit above or below the primary driver. I/O requests flow in to the top of the upper filters, flow through the stack down through the lower filters, and then down to the next bus driver below.
So, if you are an upper filter, you are subordinate (in a sense) to the primary driver that does the heavy lifting. If you want to be THE driver for a device, then you add ",,2" to the "AddService" line in your INF. Right now, your INF is using Needs and Include to load the standard Microsoft mouse driver as its primary.
I'm concerned that you're just hacking around without a real notion of what you want or what you need. Where did you get the source code for your driver? The code for a filter driver is slightly different from a function driver.
What does "setupdev.log" say?
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
I implemented the driver myself... I don`t know which page in msdn i should read for my problem
Let me explain to you.
I implemented a driver and added DriverObject->DriverExtension->AddDevice = AddDeviceRoutine;
As far as I know, such a driver can be installed via pnputil (I did it). Now, as I understand it, due to the fact that I specified the identifier of my USB mouse in the .inf file, each time this mouse is connected, my driver must be loaded and driver loading should be followed by a call to the AddDevice function. This is exactly what I expect.
There is my AddDevice function
NTSTATUS AddDeviceRoutine(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT DeviceObject)
{
UNREFERENCED_PARAMETER(DriverObject);
DbgPrintEx(0, 0, "AddDeviceRoutine... Object type is %d\n", DeviceObject->DeviceType);
return STATUS_SUCCESS;
}
I just wanna see print message in the WinDbg and ensure that the AddDevice function really was called. This is just for test. In reality, i don`t need any additional functionality. I just playing and learning PnP in Windows.
<< If you want to be THE driver for a device, then you add ",,2" to the "AddService" line in your INF
Like this?
AddService = ,, 2
I am already show you setupdev.log (because i have no setupapi.log).
Can you tell me please where i can find registry information about installed driver via pnpuntil? which registry key i should check?
We'd get a better understanding from the setupapi log if the device was connected during the driver install. The logs there just say that the driver will be installed whenever it gets connected so there's not much to see.
Why are you writing a WDM driver? use KMDF and your empty driver is functionally correct from the start.
Zac_Lockard:
Thank you for advice. Here are the logs I got when trying to install the driver while the mouse device is connected
pnputil output
Adding driver package: MouseDriver.inf
Driver package added successfully.
Published Name: oem24.inf
Driver package is up-to-date on device: HID\VID_10C4&PID_8108\7&2267ed04&0&0000
Total driver packages: 1
Added driver packages: 0
setupapi.dev.log
[Driver Install (DrvSetupInstallDriver) - C:\Users\gofor\OneDrive\Desktop\mouse_driver\MouseDriver.inf]
Section start 2023/08/30 00:53:28.272
cmd: pnputil /add-driver MouseDriver.inf /install
dvs: Flags: 0x00000000
dvs: {Driver Setup Import Driver Package: C:\Users\gofor\OneDrive\Desktop\mouse_driver\MouseDriver.inf} 00:53:28.274
dvs: Driver package already imported as 'oem24.inf'.
dvs: {Driver Setup Import Driver Package - exit (0x00000000)} 00:53:28.282
dvs: {Driver Setup Update Device: HID\VID_10C4&PID_8108\7&2267ed04&0&0000} 00:53:28.292
utl: {Select Drivers - HID\VID_10C4&PID_8108\7&2267ed04&0&0000} 00:53:28.296
utl: Driver Node:
utl: Status - Selected | Installed
utl: Driver INF - msmouse.inf (C:\Windows\System32\DriverStore\FileRepository\msmouse.inf_amd64_1793a485b491b199\msmouse.inf)
utl: Class GUID - {4d36e96f-e325-11ce-bfc1-08002be10318}
utl: Driver Version - 06/21/2006,10.0.19041.1
utl: Configuration - HID_DEVICE_SYSTEM_MOUSE [HID_Mouse_Inst.NT]
utl: Driver Rank - 00FF1003
utl: Signer Score - Inbox (0D000003)
utl: Driver Node:
utl: Status - Outranked
utl: Driver INF - oem22.inf (C:\Windows\System32\DriverStore\FileRepository\mousedriver.inf_amd64_abdba583c5b1a65d\mousedriver.inf)
utl: Class GUID - {4d36e96f-e325-11ce-bfc1-08002be10318}
utl: Driver Version - 03/17/2001,1.0.0.1
utl: Configuration - HID\VID_10C4&PID_8108
utl: Driver Rank - 80FF0001
utl: Signer Score - Unsigned (80000000)
utl: Driver Node:
utl: Status - Outranked
utl: Driver INF - oem23.inf (C:\Windows\System32\DriverStore\FileRepository\mousedriver.inf_amd64_e7baa1098b7a44fd\mousedriver.inf)
utl: Class GUID - {4d36e96f-e325-11ce-bfc1-08002be10318}
utl: Driver Version - 03/17/2001,1.0.0.1
utl: Configuration - HID\VID_10C4&PID_8108
utl: Driver Rank - 80FF0001
utl: Signer Score - Unsigned (80000000)
utl: Driver Node:
utl: Status - Outranked
utl: Driver INF - oem25.inf (C:\Windows\System32\DriverStore\FileRepository\mousedriver2.inf_amd64_e744335dc0f92292\mousedriver2.inf)
utl: Class GUID - {4d36e96f-e325-11ce-bfc1-08002be10318}
utl: Driver Version - 03/17/2001,1.0.0.1
utl: Configuration - HID\VID_10C4&PID_8108
utl: Driver Rank - 80FF0001
utl: Signer Score - Unsigned (80000000)
utl: Driver Node:
utl: Status - Outranked
utl: Driver INF - oem24.inf (C:\Windows\System32\DriverStore\FileRepository\mousedriver.inf_amd64_e744335dc0f92292\mousedriver.inf)
utl: Class GUID - {4d36e96f-e325-11ce-bfc1-08002be10318}
utl: Driver Version - 03/17/2001,1.0.0.1
utl: Configuration - HID\VID_10C4&PID_8108
utl: Driver Rank - 80FF0001
utl: Signer Score - Unsigned (80000000)
utl: Driver Node:
utl: Status - Outranked
utl: Driver INF - oem21.inf (C:\Windows\System32\DriverStore\FileRepository\mousedriver.inf_amd64_9b9ffc267cddd4c8\mousedriver.inf)
utl: Class GUID - {4d36e96f-e325-11ce-bfc1-08002be10318}
utl: Driver Version - 03/17/2001,1.0.0.1
utl: Configuration - HID\VID_10C4&PID_8108
utl: Driver Rank - 80FF0001
utl: Signer Score - Unsigned (80000000)
utl: Driver Node:
utl: Status - Outranked
utl: Driver INF - input.inf (C:\Windows\System32\DriverStore\FileRepository\input.inf_amd64_043065bc9d10ae51\input.inf)
utl: Class GUID - {745a17a0-74d3-11d0-b6fe-00a0c90f57da}
utl: Driver Version - 06/21/2006,10.0.19041.3031
utl: Configuration - HID_DEVICE [HID_Raw_Inst.NT]
utl: Driver Rank - 00FF1005
utl: Signer Score - Inbox (0D000003)
utl: {Select Drivers - exit(0x00000000} 00:53:28.332
dvs: Device does not need an update.
! dvs: No better matching drivers found for device 'HID\VID_10C4&PID_8108\7&2267ed04&0&0000'.
dvs: {Driver Setup Update Device - exit(0x00000000)} 00:53:28.334
! dvs: No devices were updated.
Section end 2023/08/30 00:53:28.338
[Exit status: FAILURE(0x00000103)]
Doron_Holan
<<< Why are you writing a WDM driver? use KMDF and your empty driver is functionally correct from the start.
I want learn WDM driver first of all (maybe in future i will learn KMDF)
Done! Thank you so much Tim_Roberts! AddDevice function was called! (But IRP_MJ_PNP not accepted, after my driver was loaded, it is automatically unloaded after AddDevice function is finished. May be i should change my AddDevice function and create device for IRP can be accepted?)... P.S: I am installed my driver through Device Manager -> Update Driver
My final inf file looks like that
[Version]
Signature="$Windows NT$"
Class=Mouse
ClassGUID={4D36E96F-E325-11CE-BFC1-08002BE10318}
Provider=%Provider%
DriverVer=03/17/2001,1.0.0.1
CatalogFile=MouseDriver.cat
CatalogFile.NTAMD64 = MouseDriver.cat
PnpLockdown=1
[DestinationDirs]
DefaultDestDir = 13
[SourceDisksNames]
1 = %DiskName%
[SourceDisksFiles]
MouseDriver.sys = 1
[ControlFlags]
; We don't want our device to be installable via the non-PnP hardware dialogs
ExcludeFromSelect = *
; Manufacturer Section
; ---------------------------------------------------------
[Manufacturer]
%ShinyThings%=ShinyThingsMfg,NT,NTAMD64
; Devices Section
; ---------------------------------------------------------
[ShinyThingsMfg.NTAMD64]
%HID\Vid_045E&Pid_001E.DeviceDesc%=MouseDriver_Inst, HID\Vid_045E&Pid_001E
%HID\Vid_045E&Pid_0029.DeviceDesc%=MouseDriver_Inst, HID\Vid_045E&Pid_0029
%HID\Vid_045E&Pid_0039.DeviceDesc%=MouseDriver_Inst, HID\Vid_045E&Pid_0039
%HID\Vid_045E&Pid_0040.DeviceDesc%=MouseDriver_Inst, HID\Vid_045E&Pid_0040
%HID\Vid_045E&Pid_0047.DeviceDesc%=MouseDriver_Inst, HID\Vid_045E&Pid_0047
%HID\Vid_10C4&PID_8108.DeviceDesc%=MouseDriver_Inst, HID\Vid_10C4&PID_8108
; Install Section
; ---------------------------------------------------------
[MouseDriver_Inst.NTAMD64]
Include = MSMOUSE.INF
Needs = HID_Mouse_Inst.NT
CopyFiles = MouseDriver_Inst_CopyFiles.NT
[MouseDriver_Inst.NTAMD64.HW]
Include = MSMOUSE.INF
Needs = HID_Mouse_Inst.NT.Hw
AddReg = MouseDriver_Inst_HWAddReg.NT
[MouseDriver_Inst_HWAddReg.NTAMD64]
HKR,,"UpperFilters",0x00010000,"MouseDriver"
[MouseDriver_Inst_CopyFiles.NTAMD64]
MouseDriver.sys
[MouseDriver_Inst.NTAMD64.Services]
Include = MSMOUSE.INF
Needs = HID_Mouse_Inst.NT.Services
AddService = MouseDriver, 2, MouseDriver_Service_Inst
[MouseDriver_Service_Inst]
DisplayName = %MouseDriver.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %13%\MouseDriver.sys
;[MouseDriver_Inst.NT.Wdf]
;KmdfService = MouseDriver, MouseDriver_wdfsect
;[MouseDriver_wdfsect]
;KmdfLibraryVersion = $KMDFVERSION$
; Strings Section
; ---------------------------------------------------------
[Strings]
; Provider names
Provider = "TODO-Set-Provider"
; Mfg names
ShinyThings = "Shiny Things"
; Service names
MouseDriver.SvcDesc = "MouseDriver Service"
; Media names
DiskName = "MouseDriver Driver Disk"
; HID device IDs
HID\VID_045E&PID_001E.DeviceDesc = "Shiny Things MouseDriver Mouse"
HID\VID_045E&PID_0029.DeviceDesc = "Shiny Things MouseDriver Mouse"
HID\VID_045E&PID_0039.DeviceDesc = "Shiny Things MouseDriver Mouse"
HID\VID_045E&PID_0040.DeviceDesc = "Shiny Things MouseDriver Mouse"
HID\VID_045E&PID_0047.DeviceDesc = "Shiny Things MouseDriver Mouse"
HID\VID_10C4&PID_8108.DeviceDesc = "Shiny Things MouseDriver Mouse"
; Standard defs
SPSVCINST_TAGTOFRONT = 0x00000001
SPSVCINST_ASSOCSERVICE= 0x00000002
SERVICE_KERNEL_DRIVER = 1
SERVICE_BOOT_START = 0
SERVICE_SYSTEM_START = 1
SERVICE_AUTO_START = 2
SERVICE_ERROR_NORMAL = 1
SERVICE_ERROR_IGNORE = 0
REG_EXPAND_SZ = 0x00020000
REG_DWORD = 0x00010001
REG_SZ = 0x00000000
Finally, i am run this example successfully: https://github.com/9176324/WinDDK/tree/master/3790.1830/src/input/moufiltr
But mouse not working
( driver is successfully loads, AddDevice also was called, but mouse is stuck and i can`t understand why
Still have a problem with USB mouse... it does not work despite the moufiltr driver is loaded successfully. It just stuck and no service callback function called
Good God, man! That source code is from the Windows Server 2003 DDK. It is, quite literally, 20 years old! Remember, source code doesn't age like wine -- it's ages like milk.
Here is the current driver sample from the actual source, not a bootleg copy posted by someone who didn't have the right to do so:
https://github.com/microsoft/Windows-driver-samples/tree/main/input/moufiltr
If you read the readme, that filter is intended to be a filter to the i8042 driver, which means it is designed for PS/2 mice. I doubt you've ever even SEEN a PS/2 mouse. It doesn't know anything about USB. Check out the current moufiltr sample -- it's INF should allow it to be inserted in any mouse stack.
Again, I'm disturbed by the direction you're going. You're just hacking around, throwing stuff together without any understanding of what it's for or how it works, and apparently without reading the reference material. You really need to have a plan.
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
Tim_Roberts
You are right, I am little bit lost in the driver development
Yes, I saw the implementation in WDF, but I want to study WDM first. Moreover, I find more examples for legacy drivers, including books/articles. But for WDF i can`t find enough information (only source codes with comments)
OSR has found that learning WDM first is not the best path. Remember that WDF has now existed far longer than WDM existed before WDF. WDM had a 10 year lifetime before WDF. WDF has now been around for 18 years. It's not the new kid on the block -- it is the correct way to write Windows drivers.
It is true there are fewer textbook-type materials for WDF, but that's only because it arrived at a point when books were dying out. There are tutorials galore, and OSR has some excellent articles on their web site.
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
For me WDF something like black box and i think to better understand WDF i should know WDM. Also as i know, WDF have some limitations and for good confidence in driver development i think WDM knowledge is must have for every kernel developer.
Let me ask you question about WDM moufiltr. How i can modify moufiltr and use it for USB driver?
Can anyone please explain to me what exactly is the problem?
Is this an inf file problem or driver architecture problem? Driver loads successfully by PnP Manager, the AddDevice function is called and I also get the IOCTL_INTERNAL_MOUSE_CONNECT IRP. But service callback function is never called when i try to use USB mouse, it is stuck. I need a direction in which to search for a solution to the problem
Have you changed the source? There's not much to go wrong in that code.
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
No, I didn't change the code. Just added DebugPrintEx to make sure the functions are called. https://github.com/9176324/WinDDK/tree/master/3790.1830/src/input/moufiltr
Still can`t use my USB mouse. Why is it so difficult when all you need to do is install a standard driver so that the mouse works? What do I need to read to understand what the problem is?