Hello,

we have developed an OCF-based (version 1.2) applet which communicates with
the user's smart card through PC/SC using the PassthruCardService;
i.e. the applet opens a PC/SC session, sends a number of APDUs to the card
and closes the session. This may be repeated several times, and the applet
may be
stopped and started between the PC/SC sessions.
In some situations, we get a PC/SC exception from SCardConnect on the 2nd
and subsequent attempts to open a PC/SC session.
The error code from SCardConnect is 0x8010000B ("Sharing violation")
which seems to indicate that the previous exclusive PC/SC session to the
card
has not been closed.
We added some logging to the OCFPCSC1.DLL in order to see what is going on
at the PC/SC level; an extract from the resulting log file follows:

SCardEstablishContext() called
SCardEstablishContext() returns OK, context is CD010001
SCardGetStatusChange(CD010001) called, timeout is 1
SCardGetStatusChange() returned OK
SCardGetStatusChange(CD010001) called, timeout is 1
SCardGetStatusChange() returned OK
SCardConnect(CD010001) called
SCardConnect() returns OK, Card handle is EA010000, share mode is EXCLUSIVE
.....
several SCardTransmits which all execute successfully...
.....
SCardDisconnect(EA010000) called, disposition is SCARD_LEAVE_CARD
SCardDisconnect() returns OK
SCardReleaseContext(CD010001) called
SCardReleaseContext() returns OK
.....
Next smart card session:
.....
SCardEstablishContext() called
SCardEstablishContext() returns OK, context is CD020001
SCardGetStatusChange(CD020001) called, timeout is 1
SCardGetStatusChange() returned OK
SCardGetStatusChange(CD020001) called, timeout is 1
SCardGetStatusChange() returned OK
SCardConnect(CD020001) called
PCSC Exception in method SCardConnect: PC/SC Error SCardConnect
return code = 8010000b

To me, it seems like the session handling is well-behaved on the PC/SC
level; i.e. that each 
SCardConnect is preceded by an SCardDisconnect on the previous session.

Does anyone have a clue as to what's going on here?

Best Regards,
Dag Legern�s, Posten SDS

----------------------------------------------------------------------
Dag Legern�s, Posten SDS AS, Postboks 4364 Torshov, 0402 Oslo
Norway
Email: [EMAIL PROTECTED]
----------------------------------------------------------------------




----------------------------------------------------------------------
Dag Legern�s, Posten SDS AS, Postboks 4364 Torshov, 0402 Oslo
Norway
Email: [EMAIL PROTECTED]
Fax: +47 23 14 51 01     Phone: +47 23 14 57 87
----------------------------------------------------------------------



---
> Visit the OpenCard web site at http://www.opencard.org/ for more
> information on OpenCard---binaries, source code, documents.
> This list is being archived at http://www.opencard.org/archive/opencard/

! To unsubscribe from the [EMAIL PROTECTED] mailing list send an email
! to
!                           [EMAIL PROTECTED]
! containing the word
!                           unsubscribe
! in the body.

Reply via email to