[Pcsclite-muscle] SCARD_E_NOT_TRANSACTED

Christophe FERRANDO christophe.ferrando at sylyca.com
Wed May 18 14:10:21 UTC 2016


Hi,

 

Same behaviour.

Please find the source code and the log file.

 

Source Code :

#include <stdio.h>

#include <stdlib.h>

#include <errno.h>

#include <string.h>

#include <time.h>

#include <sys/time.h>

#include <PCSC/winscard.h>

#include <PCSC/reader.h>

#include <wintypes.h>

 

 

#define CHECK(f, rv) \

if (SCARD_S_SUCCESS != rv) \

{ \

  printf(f ":[%lx] %s\n", rv, pcsc_stringify_error(rv)); \

  return -1; \

}

 

int main(int argc,char * argv[] )

{

LONG rv;

SCARDCONTEXT hContext;

LPTSTR mszReaders;

SCARDHANDLE hCard;

DWORD dwReaders, dwActiveProtocol, dwRecvLength;

unsigned char *pbAttr;

DWORD dwAttrLen;

DWORD dwState, dwProtocol, dwAtrLen, dwReaderLen;

BYTE *pbAtr = NULL;

char *pcReader = NULL;

SCARD_READERSTATE rgReaderStates[2];

 

rv = SCardEstablishContext(SCARD_SCOPE_USER, NULL, NULL, &hContext);

CHECK("SCardEstablishContext", rv)

rv = SCardConnect(hContext,"Microchip SEC1110 [CCID Interface] (72DE091F) 00 00",

            SCARD_SHARE_EXCLUSIVE,SCARD_PROTOCOL_T0, &hCard, &dwActiveProtocol);

CHECK("SCardConnect", rv);

rv = SCardEndTransaction(hCard,SCARD_LEAVE_CARD);

CHECK("SCardEndTransaction", rv);

rv = SCardDisconnect(hCard, SCARD_LEAVE_CARD);

CHECK("SCardDisconnect", rv)

rv = SCardReleaseContext(hContext);

CHECK("SCardReleaseContext", rv);

return 0;

}

 

 

 

Sincerly,

Christophe

 

De : Pcsclite-muscle [mailto:pcsclite-muscle-bounces+christophe.ferrando=sylyca.com at lists.alioth.debian.org] De la part de Ludovic Rousseau
Envoyé : mercredi 18 mai 2016 15:47
À : Talks about MUSCLE <pcsclite-muscle at lists.alioth.debian.org>
Objet : Re: [Pcsclite-muscle] SCARD_E_NOT_TRANSACTED

 

2016-05-17 16:30 GMT+02:00 Christophe FERRANDO <christophe.ferrando at sylyca.com <mailto:christophe.ferrando at sylyca.com> >:

Hi,

 

Hello,
 

 

I currently use pcsc-lite version 1.8.15.

 

If i use these instructions (C Program)

 

               rv = SCardEstablishContext(SCARD_SCOPE_USER, NULL, NULL, &hContext);

               CHECK("SCardEstablishContext", rv)

               rv = SCardConnect(hContext,"My Drive",

                         SCARD_SHARE_EXCLUSIVE,SCARD_PROTOCOL_T0, &hCard, &dwActiveProtocol);

               CHECK("SCardConnect", rv);

               rv = SCardEndTransaction(hCard,SCARD_LEAVE_CARD);

               CHECK("SCardEndTransaction", rv);

               rv = SCardDisconnect(hCard, SCARD_LEAVE_CARD);

               CHECK("SCardDisconnect", rv)

               rv = SCardReleaseContext(hContext);

               CHECK("SCardReleaseContext", rv)

 

I have no errors.

 

I expected SCARD_E_NOT_TRANSACTED because i call ScardEndTransaction without a previous call to ScardBeginTransaction.

But the result of SCardEndTransaction is E_SUCCESS.

 

That is strange.
On my side I get the expected behavior:
SCardEndTransaction: Transaction failed. 0x80100016
 

Can you share your complete source code?


Can you also generate a pcscd trace as documented in http://pcsclite.alioth.debian.org/pcsclite.html#support

Thanks



-- 

 Dr. Ludovic Rousseau

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pcsclite-muscle/attachments/20160518/ec9604df/attachment-0001.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: log.txt
URL: <http://lists.alioth.debian.org/pipermail/pcsclite-muscle/attachments/20160518/ec9604df/attachment-0001.txt>


More information about the Pcsclite-muscle mailing list