示例#1
0
        internal IEnumerable <SmartcardReader> GetReaders()
        {
            IntPtr readerPtr;
            int    len = 0;
            List <SmartcardReader> readerList = new List <SmartcardReader>();

            int ret = Interop.Smartcard.GetReaders(out readerPtr, out len);

            if (ret != (int)SmartcardError.None)
            {
                Log.Error(Globals.LogTag, "Failed to remove with AP, Error - " + (SmartcardError)ret);
                SmartcardErrorFactory.ThrowSmartcardException(ret);
            }

            IntPtr tempPtr = readerPtr;

            for (int i = 0; i < len; i++)
            {
                int readerID = Marshal.ReadInt32(tempPtr);

                SmartcardReader readerItem = new SmartcardReader(readerID);
                readerList.Add(readerItem);
                tempPtr += sizeof(int);
            }

            if (len > 0)
            {
                Interop.Libc.Free(readerPtr);
            }

            return(readerList);
        }
示例#2
0
 internal SmartcardSession(SmartcardReader readerHandle, int sessionHandle)
 {
     _readerObject  = readerHandle;
     _sessionHandle = sessionHandle;
 }