Zum Inhalt springen

moritz.t

Mitglieder
  • Gesamte Inhalte

    1
  • Benutzer seit

  • Letzter Besuch

Alle Inhalte von moritz.t

  1. Hello. I'm trying to read data from a MemoryCard (non microprozessor, synchronous). Therefor I'm using an USB based Card Reader ( which obviously works best with SmartCards(Microprozessor, asynchronous) ). That fact results in a few Problems. My configuration: WindowsXP Gemplus Gemcore POS Pro Smart Card Reader C++ with winscard.dll winscard.lib winscard.h Manuals: Card Reader Basic Manual -> http://tw.uberhost.de/MiniSmart_Datasheet_Logo.pdf Card Reader Extended Manual -> http://tw.uberhost.de/MiniSmart_Int...S232_Manual.pdf USB interface of the Card reader -> http://tw.uberhost.de/Intelligent_MiniSmart_USB.pdf Windows Standard USBCCID Driver for Smartcard readers is installed (usbccid.sys) I'm only using the windows winscard library because of the driver's ccid compatibility. The reader does correctly recognize if there is a card or not, an the SCardConnect function throws correct responses (i.e if there's no card...). I got it to send me a card handle (is set by the SCardConnect function if it succeeds), but only if a real smart card is inserted. When using a memory card, the reader responses a SCARD_W_UNRESPONSIVE_CARD error ... and no cardhandle is responded. (imho a memory card can not answer, no microprocessor ?) Also, the errors reported from the SCardControl function are not of the specified kind of winscrd ((DWORD)0x80100001L ..etc) they are simple integers from 1 up to 10.... don't know if this are direct error code's from the rader?! The main problem is non existing support for these old memory cards. It's sometimes only possible to use them with a few tricks. In particular there might be some codes to send to the card reader to enable such a compatibility mode. But i can't use the SCardTransmit function either, if I don't get a card handle. Does anyone have any suggestions or examples of a program communicating with a memory card via pcsc or ccid or ct-api standards? Is it possible at all? This is my test program: ------------------------ #include <cstdlib> #include <iostream> #include <string> #include <cstring> #include <winscard.h> DWORD lRet; DWORD m_Ret; SCARDCONTEXT m_hContext; SCARDHANDLE m_hCard; DWORD dwReadersLength = 0; LPSTR szListReaders = NULL; LPTSTR szSCReader = NULL; DWORD dwShareMode = SCARD_SHARE_DIRECT; DWORD dwPreferedProtocol = SCARD_PROTOCOL_T1; DWORD dwProtocol; DWORD dwControlCode = 0x12; //dword = 4byte = 32bit using namespace std; int main(int argc, char *argv[]){ lRet = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &m_hContext); if (lRet != SCARD_S_SUCCESS){ cout << "Error! No context established!"; } cout << "m_hContext: " << m_hContext << endl; lRet = SCardConnect(m_hContext, "Gemplus Gemcore POS Pro Smart Card Read 0", dwPreferedProtocol, dwShareMode, &m_hCard, &dwPreferedProtocol); if (lRet != SCARD_S_SUCCESS){ cout << "Error! Connection Failed! Errorcode: "; printf("%5.5x\n",lRet); } printf("mcardhandle: %d\n",m_hCard); //m_hCard= -369033216; // this cardhandle is returned if a smartcard is used lRet = 0; lRet = SCardBeginTransaction(m_hCard); //successful only with smartcard.. if ( SCARD_S_SUCCESS != lRet ) printf("Failed to begin Transaction! Errorcode: %5.5x\n",lRet); lRet = 0; unsigned char bSendBuffer[32]; unsigned char bRecvBuffer[32];; DWORD verify_ioctl = 0; int offset = 0; bSendBuffer[offset++]= 0x12; //power up accordingly to the manual DWORD bRecvLength = 0; // lRet = SCardControl( m_hCard, dwControlCode, NULL, 0, NULL, 0, 0 ); lRet = SCardControl(m_hCard, verify_ioctl, bSendBuffer, offset, bRecvBuffer, sizeof(bRecvBuffer), &bRecvLength); if ( SCARD_S_SUCCESS != lRet ) printf("Failed SCardControl! Errorcode: %5.5x\n",lRet); cout << "finished"; return EXIT_SUCCESS; } ---------------------- thank you, moritz t.

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...