Kernel exception on SCardListReaders with no smart card reader fou

From: topixler (topixler_at_noemail.nospam)
Date: 03/18/05

  • Next message: Doug Barlow: "Re: Kernel exception on SCardListReaders with no smart card reader fou"
    Date: Fri, 18 Mar 2005 06:43:15 -0800
    
    

    Hi all,
    I call the following simple sequence in my C++ application source on a
    Windows XP Pro SP2 where the SCardSvr is properly running, in order to get
    the list of smart card readers installed in the system (I've included all the
    Win32 libraries as well as the winscard lib):

    LONG ListReaders()
    {

     SCARDCONTEXT x;
     LPTSTR pmszReaders = NULL;
     DWORD cch = SCARD_AUTOALLOCATE;

     SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &x);
     LONG lReturn = ::SCardListReaders(x, NULL, (LPTSTR)&pmszReaders, &cch);
     if(lReturn==SCARD_S_SUCCESS) {
        // ..... do something to show the card readers list .....
     }
     SCardReleaseContext(x);

     return lReturn;
    }

    But everytime no card reader is installed, I get a kernel C++ exception from
    the SCardListReaders call, even if the call returns
    SCARD_E_NO_READERS_AVAILABLE!
    If a smart card reader is found, no exception occures!

    All consequent SCardXX calls throw exceptions too!

    Any idea what I goes wrong and how to fix it?


  • Next message: Doug Barlow: "Re: Kernel exception on SCardListReaders with no smart card reader fou"