Partager via


Smart Card Resource Manager Service

Updated: February 18, 2010

Applies To: Windows 7, Windows Server 2008 R2

The smart card resource manager provides the basic infrastructure for all other smart card components. The smart card resource manager manages smart card readers and application interactions on the computer. It is fully PC/SC 1.0 compliant.

The smart card resource manager runs in the context of a local service and is implemented as a shared service of the svchost process. The smart card resource manager service has the following service description:

<serviceData
    dependOnService="PlugPlay"
    description="@%SystemRoot%\System32\SCardSvr.dll,-5"
    displayName="@%SystemRoot%\System32\SCardSvr.dll,-1"
    errorControl="normal"
    group="SmartCardGroup"
    imagePath="%SystemRoot%\system32\svchost.exe -k LocalServiceAndNoImpersonation"
    name="SCardSvr"
    objectName="NT AUTHORITY\LocalService"
    requiredPrivileges="SeCreateGlobalPrivilege,SeChangeNotifyPrivilege"
    sidType="unrestricted"
    start="demand"
    type="win32ShareProcess"
    >
  <failureActions resetPeriod="900">
       <actions>
          <action
              delay="120000"
              type="restartService"
          />
          <action
              delay="300000"
              type="restartService"
          />
          <action
               delay="0"
              type="none"
          />
      </actions>
  </failureActions>
  <securityDescriptor name="ServiceXSecurity"/>
</serviceData>

  <registryKeys buildFilter="">
      <registryKey keyName="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SCardSvr\Parameters">
      <registryValue
          name="ServiceDll"
          value="%SystemRoot%\System32\SCardSvr.dll"
          valueType="REG_EXPAND_SZ"
          />
      <registryValue
          name="ServiceMain"
          value="CalaisMain"
          valueType="REG_SZ"
          />
      <registryValue
          name="ServiceDllUnloadOnStop"
          value="1"
          valueType="REG_DWORD"
          />
      </registryKey>
  </registryKeys>

Note

For winscard.dll to be invoked as the proper class installer, the INF file for a smart card reader must specify the following for the Class and ClassGUID:
Class=SmartCardReader
ClassGuid={50DD5230-BA8A-11D1-BF5D-0000F805F530}

By default, the service is configured for manual mode. Creators of smart card reader drivers must configure their INFs to start the service automatically and winscard.dll files to call a predefined entry point to start the service during installation. The entry point is defined as part of the SmartCardReader class and is not called directly. If a device advertises itself as part of this class, the entry point is automatically invoked to start the service when the device is inserted. Using this method ensures that the service is enabled when it is needed but is also disabled for users that do not use smart cards.

When the service is started, it performs several functions:

  1. The service first registers itself for service notifications.

  2. It registers itself for Plug and Play (PnP) notifications for device removal and additions.

  3. It initializes its data cache and a global event that signals that the service has started.

We strongly recommend that you send all communications in Windows with smart card readers through the smart card resource manager, which provides an interface to track, select, and communicate with all drivers that declare themselves members of the smart card reader device group. The smart card resource manager categorizes each smart card reader slot as a unique reader, and each slot is also managed separately, regardless of the device's physical characteristics. The smart card resource manager handles the following high-level actions:

  • Device introduction

  • Reader initialization

  • Notifying clients of new readers

  • Serializing access to readers

  • Smart card access

  • Tunneling of reader-specific commands