Another question about my filter driver installation

The base USB input device for which I want to install this filter driver shows it has 3 drivers:

hidclass.sys
hidparse.sys
hidusb.sys

My .inf file currently only has:

[HidUsb_AddService]
DisplayName    = %HID.SvcDesc%
ServiceType    = %SERVICE_KERNEL_DRIVER%
StartType      = %SERVICE_DEMAND_START%
ErrorControl   = %SERVICE_ERROR_IGNORE%
ServiceBinary  = %12%\hidusb.sys
LoadOrderGroup = extended base

Am I right to think that I need to add some extra stuff to the inf file so that all three are picked up (not just hidusb.sys).

Is this what I need:

[SourceDisksFiles]
lectouch.sys = 99
hidusb.sys 		= 3426
hidclass.sys 		= 3426
hidparse.sys 		= 3426

and

[LecTouch_Inst.NT]
CopyFiles = CopyFilterDriver

[CopyFilterDriver]
lectouch.sys
hidusb.sys,,,0x100
hidclass.sys,,,0x100
hidparse.sys,,,0x100

If so what does the 0x100 flag mean (I copied those lines from input.inf). I couldn’t find anything about that value in the CopyFiles directive documentation.

Thanks again,
David

From setupAPI.h:

//
// Flags in inf copy sections
//
#define COPYFLG_WARN_IF_SKIP            0x00000001  // warn if user tries to skip file
#define COPYFLG_NOSKIP                  0x00000002  // disallow skipping this file
#define COPYFLG_NOVERSIONCHECK          0x00000004  // ignore versions and overwrite target
#define COPYFLG_FORCE_FILE_IN_USE       0x00000008  // force file-in-use behavior
#define COPYFLG_NO_OVERWRITE            0x00000010  // do not copy if file exists on target
#define COPYFLG_NO_VERSION_DIALOG       0x00000020  // do not copy if target is newer
#define COPYFLG_OVERWRITE_OLDER_ONLY    0x00000040  // leave target alone if version same as source
#define COPYFLG_PROTECTED_WINDOWS_DRIVER_FILE 0x00000100    // a Windows driver file to be
                            // protected as other Windows system files

#define COPYFLG_REPLACEONLY             0x00000400  // copy only if file exists on target
#define COPYFLG_NODECOMP                0x00000800  // don't attempt to decompress file; copy as-is
#define COPYFLG_REPLACE_BOOT_FILE       0x00001000  // file must be present upon reboot (i.e., it's
                                                    // needed by the loader); this flag implies a reboot
#define COPYFLG_NOPRUNE                 0x00002000  // never prune this file
#define COPYFLG_IN_USE_TRY_RENAME       0x00004000  // If file in use, try to rename the target first

Peter

ETA: Before you ask… no, I have no idea if that really does anything or not and I don’t know why that particular value would be left out of the documentation.

A third party INF should really not be installing OS files as the necessary files, how they are set up/installed, etc can change from release to release of the OS. Now that you have your first version of the INF working, it is time to change it ;). Your INF should rely on input.inf to setup the OS drivers and state. To do so, you should use the Needs and Include directives in your ddinst and services install sections

https://docs.microsoft.com/en-us/windows-hardware/drivers/install/inf-ddinstall-section

Roughly it looks like the following changes. Note that you are no longer copying OS files nor adding hidusb as the service via AddService directly anymore since you are “calling” into input.inf to do this for you.

[LecTouch_Inst.NT]
CopyFiles = CopyFilterDriver
Include=input.inf
Needs=HID_Inst.NT

[LecTouch_Inst.NT.HW]
DelReg = LecTouch_Inst.DelReg.NT.HW
AddReg = LecTOuch_Inst.AddReg.NT.HW
Include=input.inf
Needs=HID_Inst.NT.HW

[LecTouch_Inst.NT.Services]
AddService = lectouch, lectouch_Service_Inst,
Include=input.inf
Needs=HID_Inst.NT.Services

Peter,

Thanks for the pointer to the header with that flag definition

Doron,

Aha! That’s how it’s supposed to work - I’d not spotted that “delegation” stuff in the documentation.

That makes perfect sense.
David