[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ms-smartcardddk
Subject:    SMCLIB and virtual reader
From:       Ron Darziv <ron.darziv () AKS ! COM>
Date:       1999-12-01 10:57:22
[Download RAW message or body]


We are developing an IFDH that acts as a reader for a USB token.
The reader is virtual in the sense that it manages no real hardware.
Whenever the USB tokens are inserted into the host a card is "there",
otherwise it's not.
I am having a problem with SMCLIB on Windows 2000 (RC3 free build 2183, DDK
RC3), On Win 98 the following code works just fine:

I am declaring the following SMARTCARD extension:

  // smartcard extension callbacks
     m_scExt.ReaderFunction[RDF_CARD_POWER]    = CardPower;
     m_scExt.ReaderFunction[RDF_TRANSMIT]      = CardTransmit;
     m_scExt.ReaderFunction[RDF_CARD_TRACKING] = CardTrack;
     m_scExt.ReaderFunction[RDF_SET_PROTOCOL]  = CardSetProtocol;
     m_scExt.ReaderFunction[RDF_ATR_PARSE]     = CardParseATR;
  //m_scExt.ReaderFunction[RDF_IOCTL_VENDOR]  = CBGenericIOCTL;

     RtlCopyMemory (m_scExt.VendorAttr.VendorName.Buffer, VENDOR_NAME,
sizeof (VENDOR_NAME));
     m_scExt.VendorAttr.VendorName.Length = sizeof (VENDOR_NAME);
     RtlCopyMemory (m_scExt.VendorAttr.IfdType.Buffer, ETOKEN_IFD_TYPE,
sizeof (ETOKEN_IFD_TYPE));
     m_scExt.VendorAttr.IfdType.Length = sizeof (ETOKEN_IFD_TYPE);

     m_scExt.VendorAttr.UnitNo                       = devNum; // important
     m_scExt.VendorAttr.IfdVersion.BuildNumber       = 0;
     m_scExt.VendorAttr.IfdVersion.VersionMajor      = BUILD_MAJOR_VERSION;
     m_scExt.VendorAttr.IfdVersion.VersionMinor      = BUILD_MINOR_VERSION;
     m_scExt.VendorAttr.IfdSerialNo.Length           = 0;
     m_scExt.ReaderCapabilities.SupportedProtocols   = SCARD_PROTOCOL_T0;
// | SCARD_PROTOCOL_T1;
     m_scExt.ReaderCapabilities.ReaderType           =
SCARD_READER_TYPE_USB;
     m_scExt.ReaderCapabilities.MechProperties       = 0;  // none, no
swallow, or eject
     //m_scExt.ReaderCapabilities.CurrentState         = SCARD_UNKNOWN;
     //m_scExt.ReaderCapabilities.CardConfiscated      = FALSE;
     m_scExt.ReaderCapabilities.Channel              = 0;                //
device number for USB ???
     m_scExt.ReaderCapabilities.MaxIFSD              = 254;            //
Taken from PCSR example
     m_scExt.ReaderCapabilities.CLKFrequency.Default = 3580;
     m_scExt.ReaderCapabilities.CLKFrequency.Max       = 3580;
     m_scExt.ReaderCapabilities.DataRate.Default     = 10750;
     m_scExt.ReaderCapabilities.DataRate.Max         = 10750;
     //m_scExt.ReaderCapabilities.PowerMgmtSupport     = 1;              //
??
     m_scExt.Version                                 = SMCLIB_VERSION; //
Must
     m_scExt.SmartcardRequest.BufferSize                  = 0x2000;
// hard coded
     m_scExt.SmartcardReply.BufferSize                 = 0x2000;
The sequence of IOCTLs from the resource manager is as follows:

IOCTL_SMARTCARD_GET_ATTRIBUTE                 tag: CHARACTERISTICS
IOCTL_SMARTCARD_GET_ATTRIBUTE                 tag: VENDOR_NAME
IOCTL_SMARTCARD_GET_ATTRIBUTE                 tag: IFD_TYPE
IOCTL_SMARTCARD_GET_ATTRIBUTE                 tag: DEVICE_UNIT

all completed successfuly by SMCLIB

The next sequence is (3 tries and you're out) of the following:

IOCTL_SMARTCARD_IS_PRESENT

to which SMCLIB returns STATUS_INVALID_DEVICE_STATE.

How does it know my device state, when it never asked for it ?
Is it interacting with the PnP manager to query stuff about the device
state ?

I am thinking of not using SMCLIB and implementing the 11 IOCTLS that the
resource manager by hand, but it seems a shame.

Regards, Ron

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic