SmartCard Mini Driver Installation Problem

Hello All,

I have developed a smart card mini driver to support Win Vista and later operating systems. I'm currently testing it on Win 7 64-bit OS. I had taken the sample inf provided in the smart card mini driver specifications.

When I insert the smart card in reader it is enumerated and populated in device manager. I tried to install the mini driver for the smart card by right clicking and selecting "Update driver software..". The installation was successfull, but the DLL was copied to SystemDir\DriverStore\FileRepository instead of SysWow64 folder. Due to this, Winlogon or Certutil is unable to find the required mini driver and there by it fails. I would like to know if there is anything wrong in INF sections below. I'm not sure if I have to make any changes to any sections so that files are copied to appropriate folder.

Any help would be appreciated.

INF File

[Version]
Signature="$Windows NT$"
Class=SmartCard
ClassGuid={990A2BD7-E738-46c7-B26F-1CF8FB9F1391}
Provider=%ProviderName%
CatalogFile=delta.cat
DriverVer=01/11/2013,1.0.0.0

[Manufacturer]
%ProviderName%=Minidriver,NTamd64,NTamd64.6.1,NTx86,NTx86.6.1

[Minidriver.NTamd64]
%CardDeviceName%=Minidriver64_Install,SCFILTER\CID_92231091

[Minidriver.NTx86]
%CardDeviceName%=Minidriver32_Install,SCFILTER\CID_92231091

[Minidriver.NTamd64.6.1]
%CardDeviceName%=Minidriver64_61_Install,SCFILTER\CID_92231091

[Minidriver.NTx86.6.1]
%CardDeviceName%=Minidriver32_61_Install,SCFILTER\CID_92231091

[DefaultInstall]
CopyFiles=x86_CopyFiles
AddReg=AddRegDefault

[DefaultInstall.ntamd64]
CopyFiles=amd64_CopyFiles
CopyFiles=wow64_CopyFiles
AddReg=AddRegWOW64
AddReg=AddRegDefault

[DefaultInstall.NTx86]
CopyFiles=x86_CopyFiles
AddReg=AddRegDefault

[DefaultInstall.ntamd64.6.1]
AddReg=AddRegWOW64
AddReg=AddRegDefault

[DefaultInstall.NTx86.6.1]
AddReg=AddRegDefault

[SourceDisksFiles]
%SmartCardCardModule%=1
%SmartCardCardModule64%=1

[SourceDisksNames]
1 = %MediaDescription%

[Minidriver64_Install.NT]
CopyFiles=amd64_CopyFiles
CopyFiles=wow64_CopyFiles
AddReg=AddRegWOW64
AddReg=AddRegDefault

[Minidriver64_61_Install.NT]
AddReg=AddRegWOW64
AddReg=AddRegDefault
Include=umpass.inf
Needs=UmPass

[Minidriver32_Install.NT]
CopyFiles=x86_CopyFiles
AddReg=AddRegDefault

[Minidriver32_61_Install.NT]
AddReg=AddRegDefault
Include=umpass.inf
Needs=UmPass

[Minidriver64_61_Install.NT.Services]
Include=umpass.inf
Needs=UmPass.Services

[Minidriver32_61_Install.NT.Services]
Include=umpass.inf
Needs=UmPass.Services

[Minidriver64_61_Install.NT.HW]
Include=umpass.inf
Needs=UmPass.HW

[Minidriver64_61_Install.NT.CoInstallers]
Include=umpass.inf
Needs=UmPass.CoInstallers

[Minidriver64_61_Install.NT.Interfaces]
Include=umpass.inf
Needs=UmPass.Interfaces

[Minidriver32_61_Install.NT.HW]
Include=umpass.inf
Needs=UmPass.HW

[Minidriver32_61_Install.NT.CoInstallers]
Include=umpass.inf
Needs=UmPass.CoInstallers

[Minidriver32_61_Install.NT.Interfaces]
Include=umpass.inf
Needs=UmPass.Interfaces

[amd64_CopyFiles]
%SmartCardCardModule%,%SmartCardCardModule64%

[x86_CopyFiles]
%SmartCardCardModule%

[wow64_CopyFiles]
%SmartCardCardModule64%

[AddRegWOW64]
HKLM, %SmartCardNameWOW64%,"ATR",0x00000001,3B,04,92,23,10,91
HKLM, %SmartCardNameWOW64%,"ATRMask",0x00000001,ff,ff,ff,ff,ff,ff
HKLM, %SmartCardNameWOW64%,"Crypto Provider",0x00000000,"Microsoft Base Smart Card Crypto Provider"
HKLM, %SmartCardNameWOW64%,"Smart Card Key Storage Provider",0x00000000,"Microsoft Smart Card Key Storage Provider"
HKLM, %SmartCardNameWOW64%,"80000001",0x00000000,%SmartCardCardModule64%

[AddRegDefault]
HKLM, %SmartCardName%,"ATR",0x00000001,3B,04,92,23,10,91
HKLM, %SmartCardName%,"ATRMask",0x00000001,ff,ff,ff,ff,ff,ff
HKLM, %SmartCardName%,"Crypto Provider",0x00000000,"Microsoft Base Smart Card Crypto Provider"
HKLM, %SmartCardName%,"Smart Card Key Storage Provider",0x00000000,"Microsoft Smart Card Key Storage Provider"
HKLM, %SmartCardName%,"80000001",0x00000000,%SmartCardCardModule%

[DestinationDirs]
amd64_CopyFiles=10,system32
x86_CopyFiles=10,system32
wow64_CopyFiles=10,syswow64

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

[Strings]
ProviderName ="SCMinidriver"
MediaDescription="Smart Card Minidriver Installation Disk"
CardDeviceName="Smart Card Minidriver"
SmartCardName="SOFTWARE\Microsoft\Cryptography\Calais\SmartCards\SCMinidriver02"
SmartCardNameWOW64="SOFTWARE\Wow6432Node\Microsoft\Cryptography\Calais\SmartCards\SCMinidriver02"
SmartCardCardModule="SCMinidriver02.dll"
SmartCardCardModule64="SCMinidriver02.dll"

xxxxx@gmail.com wrote:

I have developed a smart card mini driver to support Win Vista and later operating systems. I’m currently testing it on Win 7 64-bit OS. I had taken the sample inf provided in the smart card mini driver specifications.

When I insert the smart card in reader it is enumerated and populated in device manager. I tried to install the mini driver for the smart card by right clicking and selecting “Update driver software…”. The installation was successfull, but the DLL was copied to SystemDir\DriverStore\FileRepository instead of SysWow64 folder.

Of course. You have a specific section for Windows 7:

[Minidriver.NTamd64.6.1]
%CardDeviceName%=Minidriver64_61_Install,SCFILTER\CID_92231091

And the “Minidriver64_61_Install” section does not contain any CopyFiles
directives, so nothing gets copied.

By the way, you can use directory identifier “11” instead of
“10\system32”, and you can use “16425” instead of “10\syswow64”. It
always makes me uncomfortable to see hard-coded directory names.


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

One other thing I missed to mention is that when I right click on INF file and select “Install” the DLL is copied correctly to respective folders and I was able to call the services exposed by the smart card mini driver. But the device manager is not updated that the driver is installed for the smart card.

Also, I believe there is a default section which has CopyFiles directive and there should be no need to have it again in [Minidriver.NTamd64.6.1]

Any how, I had still added CopyFiles directive to above section, but the problem still exists. The file is never copied to SysWow64 folder instead a folder is created in SystemDir\DriverStore\FileRepository and the inf file, dll file and cat file are present in that folder. And Winlogon or CertUtil is unable to locate the smart card mini driver.

Any suggestions.

Regards,
Sushma

xxxxx@gmail.com wrote:

One other thing I missed to mention is that when I right click on INF file and select “Install” the DLL is copied correctly to respective folders and I was able to call the services exposed by the smart card mini driver. But the device manager is not updated that the driver is installed for the smart card.

Right. A right-click install simply runs the [DefaultInstall] section
and is only useful for non-PnP devices. It doesn’t associate the driver
with any PnP identifiers.

Also, I believe there is a default section which has CopyFiles directive and there should be no need to have it again in [Minidriver.NTamd64.6.1]

You are wrong. The [DefaultInstall] section is **ONLY** used for
right-click installs. It is completely ignored in a PnP installation.

[DefaultInstall] is evil. Too many people have inferred behaviors for
it that it does not provide. It should NEVER be included in a PnP
device INF (some PnP class filters do use it).

Any how, I had still added CopyFiles directive to above section, but the problem still exists. The file is never copied to SysWow64 folder instead a folder is created in SystemDir\DriverStore\FileRepository and the inf file, dll file and cat file are present in that folder.

EVERY driver installation goes into the DriverStore first. Are you
uninstalling your old driver, so that it gets removed from the
DriverStore? I guess you will have to show us your current INF file and
the section of \windows\inf\setupapi.dev.log.

And Winlogon or CertUtil is unable to locate the smart card mini driver.

Winlogon and CertUtil are 64-bit processes. They aren’t going to look
for DLLs in SysWow64, which is only used for 32-bit DLLs.


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

Thanks for the reply.

I un-installed the old driver before installing new one. Here is the new INF file contents

[Version]
Signature=“$Windows NT$”
Class=SmartCard
ClassGuid={990A2BD7-E738-46c7-B26F-1CF8FB9F1391}
Provider=%ProviderName%
CatalogFile=delta.cat
DriverVer=02/14/2013,1.0.0.0

[Manufacturer]
%ProviderName%=Minidriver,NTamd64,NTamd64.6.1,NTx86,NTx86.6.1

[Minidriver.NTamd64]
%CardDeviceName%=Minidriver64_Install,SCFILTER\CID_92231091
CopyFiles=amd64_CopyFiles
CopyFiles=wow64_CopyFiles
CopyFiles=x86_CopyFiles

[Minidriver.NTx86]
%CardDeviceName%=Minidriver32_Install,SCFILTER\CID_92231091
CopyFiles=x86_CopyFiles

[Minidriver.NTamd64.6.1]
%CardDeviceName%=Minidriver64_61_Install,SCFILTER\CID_92231091
CopyFiles=wow64_CopyFiles
CopyFiles=x86_CopyFiles

[Minidriver.NTx86.6.1]
%CardDeviceName%=Minidriver32_61_Install,SCFILTER\CID_92231091
CopyFiles=x86_CopyFiles

[DefaultInstall]
CopyFiles=x86_CopyFiles
AddReg=AddRegDefault

[DefaultInstall.ntamd64]
CopyFiles=amd64_CopyFiles
CopyFiles=wow64_CopyFiles
AddReg=AddRegWOW64
AddReg=AddRegDefault

[DefaultInstall.NTx86]
CopyFiles=x86_CopyFiles
AddReg=AddRegDefault

[DefaultInstall.ntamd64.6.1]
AddReg=AddRegWOW64
AddReg=AddRegDefault

[DefaultInstall.NTx86.6.1]
AddReg=AddRegDefault

[SourceDisksFiles]
%SmartCardCardModule%=1
%SmartCardCardModule64%=1

[SourceDisksNames]
1 = %MediaDescription%,

[Minidriver64_Install.NT]
CopyFiles=amd64_CopyFiles
CopyFiles=wow64_CopyFiles
AddReg=AddRegWOW64
AddReg=AddRegDefault

[Minidriver64_61_Install.NT]
AddReg=AddRegWOW64
AddReg=AddRegDefault
Include=umpass.inf
Needs=UmPass

[Minidriver32_Install.NT]
CopyFiles=x86_CopyFiles
AddReg=AddRegDefault

[Minidriver32_61_Install.NT]
AddReg=AddRegDefault
Include=umpass.inf
Needs=UmPass

[Minidriver64_61_Install.NT.Services]
Include=umpass.inf
Needs=UmPass.Services

[Minidriver32_61_Install.NT.Services]
Include=umpass.inf
Needs=UmPass.Services

[Minidriver64_61_Install.NT.HW]
Include=umpass.inf
Needs=UmPass.HW

[Minidriver64_61_Install.NT.CoInstallers]
Include=umpass.inf
Needs=UmPass.CoInstallers

[Minidriver64_61_Install.NT.Interfaces]
Include=umpass.inf
Needs=UmPass.Interfaces

[Minidriver32_61_Install.NT.HW]
Include=umpass.inf
Needs=UmPass.HW

[Minidriver32_61_Install.NT.CoInstallers]
Include=umpass.inf
Needs=UmPass.CoInstallers

[Minidriver32_61_Install.NT.Interfaces]
Include=umpass.inf
Needs=UmPass.Interfaces

[amd64_CopyFiles]
%SmartCardCardModule%,%SmartCardCardModule64%

[x86_CopyFiles]
%SmartCardCardModule%

[wow64_CopyFiles]
%SmartCardCardModule64%

[AddRegWOW64]
HKLM, %SmartCardNameWOW64%,“ATR”,0x00000001,3B,04,92,23,10,91
HKLM, %SmartCardNameWOW64%,“ATRMask”,0x00000001,ff,ff,ff,ff,ff,ff
HKLM, %SmartCardNameWOW64%,“Crypto Provider”,0x00000000,“Microsoft Base Smart Card Crypto Provider”
HKLM, %SmartCardNameWOW64%,“Smart Card Key Storage Provider”,0x00000000,“Microsoft Smart Card Key Storage Provider”
HKLM, %SmartCardNameWOW64%,“80000001”,0x00000000,%SmartCardCardModule64%

[AddRegDefault]
HKLM, %SmartCardName%,“ATR”,0x00000001,3B,04,92,23,10,91
HKLM, %SmartCardName%,“ATRMask”,0x00000001,ff,ff,ff,ff,ff,ff
HKLM, %SmartCardName%,“Crypto Provider”,0x00000000,“Microsoft Base Smart Card Crypto Provider”
HKLM, %SmartCardName%,“Smart Card Key Storage Provider”,0x00000000,“Microsoft Smart Card Key Storage Provider”
HKLM, %SmartCardName%,“80000001”,0x00000000,%SmartCardCardModule%

[DestinationDirs]
amd64_CopyFiles=11
x86_CopyFiles=11
wow64_CopyFiles=16425

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

[Strings]
ProviderName =“MQMinidriver”
MediaDescription=“OpenSC Smart Card Minidriver Installation Disk”
CardDeviceName=“Smart Card Minidriver”
SmartCardName=“SOFTWARE\Microsoft\Cryptography\Calais\SmartCards\SCMinidriver02”
SmartCardNameWOW64=“SOFTWARE\Wow6432Node\Microsoft\Cryptography\Calais\SmartCards\SCMinidriver02”
SmartCardCardModule=“MQMiniDriver_02.dll”
SmartCardCardModule64=“MQMiniDriver_02.dll”

Please ignore my earlier e-mail.

I was able to install the INF successfully and see that the files are copied to correct folder with minor changes.

Thank you once again.

Regards,
Sushma