Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Recognize smart card reader type using winscard visual C++ 6.0

Recognize smart card reader type using winscard visual C++ 6.0

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Eka Candra
    wrote on last edited by
    #1

    Dear all, I get a program that can recognize reader type (contact or contactless reader) before any smart card is inserted into reader. Generally I used SCardEstablishContext[^] and SCardListReaders[^] functions in order to load name of readers. Those two function have just two dynamic variable, handle of reader and list of reader name. Do anybody know how separated contact reader type from contactless reader type without insert any smartcard? Please help me... Thanks before....

    N 1 Reply Last reply
    0
    • E Eka Candra

      Dear all, I get a program that can recognize reader type (contact or contactless reader) before any smart card is inserted into reader. Generally I used SCardEstablishContext[^] and SCardListReaders[^] functions in order to load name of readers. Those two function have just two dynamic variable, handle of reader and list of reader name. Do anybody know how separated contact reader type from contactless reader type without insert any smartcard? Please help me... Thanks before....

      N Offline
      N Offline
      Nikolay Fomichev
      wrote on last edited by
      #2

      Dear Eka Candra, To understand reader's type one can access to its attributes and read default clock rate. Schematic code:

      SCARDCONTEXT hContext;
      SCARDHANDLE hCard;
      DWORD dwActiveProtocol;
      LONG status;

      LPCSTR szReader; // PC/SC reader name to check;

      // Assume that context is already established
      // Make direct connection to PC/SC card reader. No card needed for these step.
      status = SCardConnect(hContext, szReader, SCARD_SHARE_DIRECT, 0, hCard, &dwActiveProtocol);
      // Get attribute SCARD_ATTR_DEFAULT_CLK.
      BYTE pbAttr[4];
      DWORD pcbAttrLen = 4;
      status = SCardGetAttrib(hCard, SCARD_ATTR_DEFAULT_CLK, pbAttr, pcbAttrLen);
      // Cast pbAttr to decimal integer. It will be Default clock rate in kHz.
      // For ISO 14443 contactless card reader it equals to 13560 (i.e. 13.56MHz)
      // For contact card reader it's something from 1000 to 5000 (i.e. from 1MHz to 5MHz)
      status = SCardDisconnect(hCard, SCARD_LEAVE_CARD);

      The method I offer supposes that you are looking for ISO14443 contactless card reader. At least in Windows it works.

      Richard DeemingR 1 Reply Last reply
      0
      • N Nikolay Fomichev

        Dear Eka Candra, To understand reader's type one can access to its attributes and read default clock rate. Schematic code:

        SCARDCONTEXT hContext;
        SCARDHANDLE hCard;
        DWORD dwActiveProtocol;
        LONG status;

        LPCSTR szReader; // PC/SC reader name to check;

        // Assume that context is already established
        // Make direct connection to PC/SC card reader. No card needed for these step.
        status = SCardConnect(hContext, szReader, SCARD_SHARE_DIRECT, 0, hCard, &dwActiveProtocol);
        // Get attribute SCARD_ATTR_DEFAULT_CLK.
        BYTE pbAttr[4];
        DWORD pcbAttrLen = 4;
        status = SCardGetAttrib(hCard, SCARD_ATTR_DEFAULT_CLK, pbAttr, pcbAttrLen);
        // Cast pbAttr to decimal integer. It will be Default clock rate in kHz.
        // For ISO 14443 contactless card reader it equals to 13560 (i.e. 13.56MHz)
        // For contact card reader it's something from 1000 to 5000 (i.e. from 1MHz to 5MHz)
        status = SCardDisconnect(hCard, SCARD_LEAVE_CARD);

        The method I offer supposes that you are looking for ISO14443 contactless card reader. At least in Windows it works.

        Richard DeemingR Offline
        Richard DeemingR Offline
        Richard Deeming
        wrote on last edited by
        #3

        I seriously doubt Eka is still looking for an answer 11½ years later. :doh:


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups