取得PCSC讀卡機清單 |
|
juitsung
一般會員 發表:4 回覆:2 積分:1 註冊:2003-03-31 發送簡訊給我 |
//--------------------------------------------------------------------------- bool __fastcall GetReaderList() { unsigned long pcchReaders = 0; TStringList *readers; if(ret != SCARD_S_SUCCESS) String msg = "Failed SCardEstablishContext! " GetErrorCodeDescription(ret); return false; ret = SCardListReaders(_ContextHandle, NULL, NULL, &pcchReaders); // 有錯誤 Application->NormalizeTopMosts(); #ifdef _DELPHI_STRING_UNICODE Application->MessageBox(msg.w_str(), Application->MessageBox( "WARRING", MB_OKCANCEL); #endif return false; // 取得讀卡機資訊的字串長度 if (ret != SCARD_S_SUCCESS) String msg = GetErrorCodeDescription(ret); return false; try TStringList *readers = new TStringList(); // 取得系統讀卡機資訊的字串 if (ret == SCARD_S_SUCCESS) LPTSTR readerName = mszReaders; // 拆解字串 { readerNumber ; } return true; } { free(mszReaders); } AnsiString sErrString; return sErrString; } //--------------------------------------------------------------------------- String __fastcall GetErrorCodeDescription(int nErrCode) { String sErrString; if(sErrCode == "80100001") else if(sErrCode == "0x80100002") else if(sErrCode == "0x80100003") sErrString = "Invalid Handle"; sErrString = "Invalid Parameter"; sErrString = "Invalid Target"; else if(sErrCode == "0x80100007") else if(sErrCode == "0x80100008") sErrString = "Insufficient Buffer"; else if(sErrCode == "0x8010000A") else if(sErrCode == "0x8010000B") else if(sErrCode == "0x8010000C") else if(sErrCode == "0x8010000D") sErrString = "Unknown Card"; sErrString = "Can't Dispose"; else if(sErrCode == "0x80100010") sErrString = "Not Ready"; sErrString = "Invalid Value"; sErrString = "System Cancelled"; sErrString = "Comm Error"; sErrString = "Unknown Error"; sErrString = "Invalid ATR"; sErrString = "Not Transacted"; sErrString = "Reader Unavailable"; sErrString = "Shutdown"; sErrString = "PCI Too Small"; sErrString = "Reader Unsupported"; sErrString = "Duplicate Reader"; sErrString = "Card Unsupported"; sErrString = "No Service"; sErrString = "Service Stopped"; sErrString = "Unsupported Card"; sErrString = "Unresponsive Card"; sErrString = "Unpowered Card"; sErrString = "Reset Card"; sErrString = "Removed Card"; sErrString = "Unknown PC/SC Error Code - No Further Information Is Available."; return sErrString; } |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |