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/
Hello all,
I was asked to help a colleague regarding the following issue.
They had received a sys file containing a SmartCardFilter driver which worked on Windows_7 64 bits (They also had received the source - it's real).
Basically the driver is very simple - it filters out RESET requests.
The problem is that the original installation procedure involved double clicking two reg file, manual coping of files + restart of the system (the driver was signed for win_7).
Nowadays (win_10) this procedure does not work :-), so I was asked to help to solve the issue.
Signing the driver - had a small problem - Microsoft would not sign the driver without an inf file (funny - but I remember being able to sign a driver without an inf file for win_10).
Now I have no idea how to write an inf file for a SmartCardFilter driver, so I tried something out of a VERY few examples which I had seen online. It didn't work.
The company which made the driver - does not support drivers any more (I promised that this would be a funny story). The driver writer had retired for some years, so he does not know how to help (he wants to help, but can't).
If I understand correctly the problem was : "WARNING: No device Ids found in INF"
Finally here comes the question : Any advice or any good/simple example ?
======================================
The inf file which I had tried (with questions) :
;;;
;;; My SmartCard Filter Driver
;;;
;;;
[Version]
Signature = "$Windows NT$"
Class = "SmartCardFilter"
ClassGuid = {DB4F6DDD-9C0E-45e4-9597-78DBBAD0F412} ; Q: Is this correct ?
Provider = %ProviderString%
DriverVer = 01/05/2023,1.2.3.4
CatalogFile = MyScFilter.cat
[DestinationDirs]
DefaultDestDir = 12
MiniFilter.DriverFiles = 12 ;%windir%\system32\drivers
;;
;; Default install sections
;;
[DefaultInstall.ntamd64]
OptionDesc = %ServiceDescription%
CopyFiles = MiniFilter.DriverFiles
[DefaultInstall.ntamd64.Services]
AddService = %ServiceName%,,MiniFilter.Service
;;
;; Default uninstall sections
;;
[DefaultUninstall.ntamd64]
DelFiles = MiniFilter.DriverFiles
LegacyUninstall=1
[DefaultUninstall.ntamd64.Services]
DelService = %ServiceName%,0x200 ;Ensure service is stopped before deleting
LegacyUninstall=1
;
; Services Section
;
[MiniFilter.Service]
DisplayName = %ServiceName%
Description = %ServiceDescription%
ServiceBinary = %12%\%DriverName%.sys ;%windir%\system32\drivers\
; ServiceType = 1 ;SERVICE_KERNEL_DRIVER
; StartType = 2 ;SERVICE_AUTO_START
; ErrorControl = 1 ;SERVICE_ERROR_NORMAL
; LoadOrderGroup = "FSFilter Activity Monitor" // Q: Maybe fix ???
AddReg = MiniFilter.AddRegistry
AddService = , 0x00000002
;
; Registry Modifications
;
[MiniFilter.AddRegistry]
HKR,,UpperFilters,%REG_MULTI_SZ_APPEND%,"MyScFilter"
;
; Copy Files
;
[MiniFilter.DriverFiles]
%DriverName%.sys
[SourceDisksFiles]
MyScFilter.sys = 1,,
[SourceDisksNames]
1 = %DiskId1%,,,
;;
;; String Section
;;
[Strings]
ProviderString = "MyCorporation"
ServiceDescription = "My SmartCard Filter Driver"
ServiceName = "MyScFilter"
DriverName = "MyScFilter"
DiskId1 = "MyScFilter Device Installation Disk"
======================================
The dpinst.log file :
INFO: ****************************************
INFO: 05/17/2023 16:52:52
INFO: Product Version 2.1.0.0.
INFO: Version: 6.0.6000
INFO: Platform ID: 2 (NT)
INFO: Service Pack: 0.0
INFO: Suite: 0x0100, Product Type: 1
INFO: Architecture: AMD64.
INFO: Interactive Windows Station
INFO: Command Line: '"C:\MyDrivers\MyScFilter\MyScFilter_Package\driver\x64\DPInst.exe" /path data'
INFO: DPInst is not multi-lingual.
INFO: ****************************************
INFO: Current working directory: 'C:\MyDrivers\MyScFilter\MyScFilter_Package\driver\x64'
INFO: Running on path 'C:\MyDrivers\MyScFilter\MyScFilter_Package\driver\x64\data'
INFO: User UI Language is 0x409.
INFO: Install option set: Suppressing Wizard but no OS popups.
INFO: Install option set: Force install if driver is not better.
INFO: Found driver package: 'c:\mydrivers\myscfilter\myscfilter_package\driver\x64\data\myscfilter\myscfilter.inf'.
INFO: Preinstalling 'c:\mydrivers\myscfilter\myscfilter_package\driver\x64\data\myscfilter\myscfilter.inf' ...
INFO: ENTER: DriverPackagePreinstallW
SUCCESS:c:\mydrivers\myscfilter\myscfilter_package\driver\x64\data\myscfilter\myscfilter.inf is preinstalled.
INFO: RETURN: DriverPackagePreinstallW (0x0)
INFO: ENTER: DriverPackageGetPathW
INFO: RETURN: DriverPackageGetPathW (0x0)
INFO: ENTER: DriverPackageInstallW
INFO: Installing INF file 'c:\mydrivers\myscfilter\myscfilter_package\driver\x64\data\myscfilter\myscfilter.inf' (Plug and Play).
WARNING:No device Ids found in INF 'C:\WINDOWS\System32\DriverStore\FileRepository\myscfilter.inf_amd64_4fdd83b4488acc55\myscfilter.inf' for current platform.
INFO: RETURN: DriverPackageInstallW (0xE0000301)
WARNING:No device Ids found in INF 'c:\mydrivers\myscfilter\myscfilter_package\driver\x64\data\myscfilter\myscfilter.inf' for current platform.
INFO: Group with ID '4EC25CFB2D1FD9B677EB77C9CF297DDA564DF960' will be written to script 'C:\PROGRA~1\DIFX\UninstallScripts\4EC25CFB2D1FD9B677EB77C9CF297DDA564DF960'.
INFO: Created group entry in Add or Remove Programs.
INFO: Returning with code 0x0
INFO: 05/17/2023 16:53:02
Thanks
Chin
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! | ||
Internals & Software Drivers | 19-23 June 2023 | Live, Online |
Writing WDF Drivers | 10-14 July 2023 | Live, Online |
Kernel Debugging | 16-20 October 2023 | Live, Online |
Developing Minifilters | 13-17 November 2023 | Live, Online |
Comments
This is just a filter driver. The same procedure that works on Windows 7 should still work on Windows 10. All it takes is copying the files in place, creating a couple of registry entries, and restart. What happens when you try this?
The INF isn't going to work because it's a non-PnP INF file, so the HKR reference is not associated with a device. You can't use that kind of an INF for a device filter, although it can work for a class filter.
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.