|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Re: SCardTransmit returning SCARD_E_NOT_TRANSACTED
From: Teresa Carmen Han (tinghan
PC.JARING.MY)
Date: Sun Oct 12 2003 - 09:20:38 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
How r u? Where r u from? I am from Malaysia.
Regards,
Teresa
----- Original Message -----
From: Shane Hird <shanehird
HOTMAIL.COM>
To: <SmartCardSDK
DISCUSS.MICROSOFT.COM>
Sent: Friday, September 12, 2003 11:09 AM
Subject: Re: SCardTransmit returning SCARD_E_NOT_TRANSACTED
> Oops, you're correct. Due to the error returned I thought the macros must
> have stripped the leading 0x80... value from the error codes.
>
> The error returned is 0x00000016. Is that 'The device does not recognise
the
> command"? or something else?
>
> I realise the APDU/TPDU stuff is probably wrong but I figured the
smartcard
> would just spew back an error rather than the API.
>
> -Shane
>
> >
> >Are you sure about the error?
> >At first sight, this error is only thrown by SCardEndTransaction.
> >Note, in T=0, you may want to transmit one less byte (TPDU).
> >
> >Eric Perlin [MS]
> >
> >-----Original Message-----
> >From: SmartCardSDK [mailto:SmartCardSDK
DISCUSS.MICROSOFT.COM] On Behalf
> >Of Shane Hird
> >Sent: Thursday, September 11, 2003 6:49 PM
> >To: SmartCardSDK
DISCUSS.MICROSOFT.COM
> >Subject: SCardTransmit returning SCARD_E_NOT_TRANSACTED
> >
> >I have been able to connect successfully to a GemPlusPC410-SL reader and
> >obtain a handle to the card. However when attempting to transmit to the
> >card
> >with the below code, I continually get the error SCARD_E_NOT_TRANSACTED.
> >With other code, I have been able to get the ATR string ok, and
> >GetStatus is
> >returning "Card has specific communication protocols set."
> >
> >The protocol in use seems to be T1. I have tried a few different
> >variations
> >of the code with no success. I have also tried surrounding the call to
> >SCardTransmit with calls to BeginTransaction and EndTransaction.
> >
> >Can anyone shed some light on this issue?
> >
> >-Thanks,
> >Shane.
> >
> >
> > lResult = SCardEstablishContext(SCARD_SCOPE_USER, NULL, NULL,
> >hContext);
> >
> > file://Get list of readers
> > lResult = SCardListReaders(hContext, NULL, (LPTSTR)&szReaders,
> >&cchReaders);
> >
> > file://Connect to card (won't work too well if more than one
reader...)
> > lResult = SCardConnect(hContext, (LPCSTR)szReaders,
> >SCARD_SHARE_EXCLUSIVE, SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1, &hCard,
> >&dwProtocol);
> >
> > BYTE sAPDU[100];
> > BYTE rDATA[100];
> > DWORD dwrSize = 100;
> > BYTE buf[] = {0x44, 0x45, 0x46, 0x47, 0x48, 0x44, 0x45, 0x46, 0x47 };
> >
> > sAPDU[0] = (BYTE)CLA_ISO;
> > sAPDU[1] = (BYTE)INS_ISO_SELECT;
> > sAPDU[2] = (BYTE)0x04;
> > sAPDU[3] = (BYTE)0x00;
> > sAPDU[4] = (BYTE)sizeof(buf);
> > memcpy(&sAPDU[5], buf, sizeof(buf));
> > sAPDU[sizeof(buf) + 5] = (BYTE)0x00;
> >
> > if (dwProtocol == 0)
> > lResult = SCardTransmit(hCard, SCARD_PCI_T0, sAPDU, sizeof(buf) + 6,
> >NULL, rDATA, &dwrSize);
> > else
> > lResult = SCardTransmit(hCard, SCARD_PCI_T1, sendData, sizeof(buf) +
> >6,
> >NULL, rDATA, &dwrSize);
> >
> >_________________________________________________________________
> >Chat via SMS. Simply send 'CHAT' to 1889918. More info at
> >http://ninemsn.com.au/mobilemania/MoChat.asp?blipid=6800
>
> _________________________________________________________________
> Get less junk mail with ninemsn Premium. Click here
> http://ninemsn.com.au/premium/landing.asp
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]