VFP 愛用者社區 首頁 VFP 愛用者社區
本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.
 
 常見問題常見問題   搜尋搜尋   會員列表會員列表   會員群組會員群組   會員註冊會員註冊 
 個人資料個人資料   登入檢查您的私人訊息登入檢查您的私人訊息   登入登入

[日誌] 取得讀卡機執行錯誤的訊息 (僅供自覽)

 
發表新主題   回覆主題    VFP 愛用者社區 首頁 -> VFP 討論區
上一篇主題 :: 下一篇主題  
發表人 內容
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 1 樓

發表發表於: 星期四 八月 26, 2021 3:07 pm    文章主題: [日誌] 取得讀卡機執行錯誤的訊息 (僅供自覽) 引言回覆

這是最近要以一般讀卡機讀取健保卡中所提供的個案基本資訊(不用經健保署驗證能自由取得的部分)

執行 SCardEstablishContext、SCardListReaders、SCardConnect、SCardTransmit ... 等函數回傳不是 0 時,其回傳的錯誤碼,把它轉譯給人看得懂的資訊,以便使用者在操作過程發生錯誤,藉此資訊才能遠端指導使用者排除狀況

因為原本是英文訊息說明,我英文能力很差,花時間把它翻譯成繁體中文,怕往後自己找不到這段內容,所以才在此留下資料,以供往後調閱

代碼:

FUNCTION GetSmartCardErrorMessage
LPARAMETERS LP_nErrorCode

LOCAL Wi_nErrorCode  && N 錯誤碼

Wi_nErrorCode = LP_nErrorCode

* ---- *
*      *
* ---- *
LOCAL Wo_mErrorMessage  && M 要回傳的錯誤訊息

DO CASE
CASE Wi_nErrorCode = -4294967031  && 0x00000109 ERROR_BROKEN_PIPE
     * > The client attempted a smart card operation in a remote session,
     *   such as a client session running on a terminal server, and the operating system in use does not support smart card redirection.
     Wo_mErrorMessage = "使用者端嘗試在遠端工作階段中執行智慧卡操作,例如在終端伺服器上執行的使用者端工作階段,並且正在使用的作業系統不支援智慧卡重新導向。"
CASE Wi_nErrorCode = -2146435071  && 0x80100001 SCARD_F_INTERNAL_ERROR
     * > An internal consistency check failed.
     Wo_mErrorMessage = "內部一致性檢查失敗。"
CASE Wi_nErrorCode = -2146435070  && 0x80100002 SCARD_E_CANCELLED
     * > The action was canceled by an SCardCancel request.
     Wo_mErrorMessage = "該動作已被 SCardCancel 要求取消。"
CASE Wi_nErrorCode = -2146435069  && 0x80100003 SCARD_E_INVALID_HANDLE
     * > The supplied handle was not valid.
     Wo_mErrorMessage = "提供的控制碼不正確。"
CASE Wi_nErrorCode = -2146435068  && 0x80100004 SCARD_E_INVALID_PARAMETER
     * > One or more of the supplied parameters could not be properly interpreted.
     Wo_mErrorMessage = "無法正確直譯所提供一些參數。"
CASE Wi_nErrorCode = -2146435067  && 0x80100005 SCARD_E_INVALID_TARGET
     * > Registry startup information is missing or not valid.
     Wo_mErrorMessage = "登錄中的啟動資訊遺失或不正確。"
CASE Wi_nErrorCode = -2146435066  && 0x80100006 SCARD_E_NO_MEMORY
     * > Not enough memory available to complete this command.
     Wo_mErrorMessage = "記憶體不足,無法完成指令。"
CASE Wi_nErrorCode = -2146435065  && 0x80100007 SCARD_F_WAITED_TOO_LONG
     * > An internal consistency timer has expired.
     Wo_mErrorMessage = "內部一致性計時器已逾時。"
CASE Wi_nErrorCode = -2146435064  && 0x80100008 SCARD_E_INSUFFICIENT_BUFFER
     * > The data buffer for returned data is too small for the returned data.
     Wo_mErrorMessage = "接收傳回資料的資料緩衝區太小。"
CASE Wi_nErrorCode = -2146435063  && 0x80100009 SCARD_E_UNKNOWN_READER
     * > The specified reader name is not recognized.
     Wo_mErrorMessage = "指定的讀取裝置名稱無法辨識。"
CASE Wi_nErrorCode = -2146435062  && 0x8010000A SCARD_E_TIMEOUT
     * > The user-specified time-out value has expired.
     Wo_mErrorMessage = "使用者指定的等待時間已逾時。"
CASE Wi_nErrorCode = -2146435061  && 0x8010000B SCARD_E_SHARING_VIOLATION
     * > The smart card cannot be accessed because of other outstanding connections.
     Wo_mErrorMessage = "由於其他未處理的連線,無法存取智慧卡。"
CASE Wi_nErrorCode = -2146435060  && 0x8010000C SCARD_E_NO_SMARTCARD
     * > The operation requires a smart card, but no smart card is currently in the device.
     Wo_mErrorMessage = "這項操作需要智慧卡,但目前裝置中沒有智慧卡。"
CASE Wi_nErrorCode = -2146435059  && 0x8010000D SCARD_E_UNKNOWN_CARD
     * > The specified smart card name is not recognized.
     Wo_mErrorMessage = "指定的智慧卡名稱無法辨識。"
CASE Wi_nErrorCode = -2146435058  && 0x8010000E SCARD_E_CANT_DISPOSE
     * > The system could not dispose of the media in the requested manner.
     Wo_mErrorMessage = "系統無法在要求的操作中部署媒體。"
CASE Wi_nErrorCode = -2146435057  && 0x8010000F SCARD_E_PROTO_MISMATCH
     * > The requested protocols are incompatible with the protocol currently in use with the card.
     Wo_mErrorMessage = "要求的通訊協定跟目前智慧卡使用的通訊協定不相容。"
CASE Wi_nErrorCode = -2146435056  && 0x80100010 SCARD_E_NOT_READY
     * > The reader or card is not ready to accept commands.
     Wo_mErrorMessage = "讀取裝置或智慧卡並未就緒,無法接受指令。"
CASE Wi_nErrorCode = -2146435055  && 0x80100011 SCARD_E_INVALID_VALUE
     * > One or more of the supplied parameter values could not be properly interpreted.
     Wo_mErrorMessage = "無法正確直譯所提供的一些參數值。"
CASE Wi_nErrorCode = -2146435054  && 0x80100012 SCARD_E_SYSTEM_CANCELLED
     * > The action was canceled by the system, presumably to log off or shut down.
     Wo_mErrorMessage = "系統已經將動作取消,可能是系統已關機或登出。"
CASE Wi_nErrorCode = -2146435053  && 0x80100013 SCARD_F_COMM_ERROR
     * > An internal communications error has been detected.
     Wo_mErrorMessage = "偵測出一個內部通訊錯誤。"
CASE Wi_nErrorCode = -2146435052  && 0x80100014 SCARD_F_UNKNOWN_ERROR
     * > An internal error has been detected, but the source is unknown.
     Wo_mErrorMessage = "偵測出內部錯誤,但來源不明。"
CASE Wi_nErrorCode = -2146435051  && 0x80100015 SCARD_E_INVALID_ATR
     * > An ATR string obtained from the registry is not a valid ATR string.
     Wo_mErrorMessage = "從登錄中取得的 ATR 字串不是正確的 ATR 字串。"
CASE Wi_nErrorCode = -2146435050  && 0x80100016 SCARD_E_NOT_TRANSACTED
     * > An attempt was made to end a nonexistent transaction.
     Wo_mErrorMessage = "嘗試結束不存在的異動方式。"
CASE Wi_nErrorCode = -2146435049  && 0x80100017 SCARD_E_READER_UNAVAILABLE
     * > The specified reader is not currently available for use.
     Wo_mErrorMessage = "指定的讀取裝置目前無法使用。"
CASE Wi_nErrorCode = -2146435048  && 0x80100018 SCARD_P_SHUTDOWN
     * > The operation has been aborted to allow the server application to exit.
     Wo_mErrorMessage = "操作已經中止,好讓伺服器應用�{式結束。"
CASE Wi_nErrorCode = -2146435047  && 0x80100019 CARD_E_PCI_TOO_SMALL
     * > The PCI receive buffer was too small.
     Wo_mErrorMessage = "PCI 接收緩衝區太小。"
CASE Wi_nErrorCode = -2146435046  && 0x8010001A SCARD_E_READER_UNSUPPORTED
     * > The reader driver does not meet minimal requirements for support.
     Wo_mErrorMessage = "讀取裝置驅動�{式並未到達最小的支援需求。"
CASE Wi_nErrorCode = -2146435045  && 0x8010001B SCARD_E_DUPLICATE_READER
     * > The reader driver did not produce a unique reader name.
     Wo_mErrorMessage = "讀取裝置驅動�{式並未產生唯一性的讀取裝置名稱。"
CASE Wi_nErrorCode = -2146435044  && 0x8010001C SCARD_E_CARD_UNSUPPORTED
     * > The smart card does not meet minimal requirements for support.
     Wo_mErrorMessage = "智慧卡並未到達最小的支援需求。"
CASE Wi_nErrorCode = -2146435043  && 0x8010001D SCARD_E_NO_SERVICE
     * > The smart card resource manager is not running.
     Wo_mErrorMessage = "智慧卡資源管理員並未執行。"
CASE Wi_nErrorCode = -2146435042  && 0x8010001E SCARD_E_SERVICE_STOPPED
     * > The smart card resource manager has shut down.
     Wo_mErrorMessage = "智慧卡資源管理員已關閉。"
CASE Wi_nErrorCode = -2146435041  && 0x8010001F SCARD_E_UNEXPECTED
     * > An unexpected card error has occurred.
     Wo_mErrorMessage = "發生意外的智慧卡錯誤。"
CASE Wi_nErrorCode = -2146435040  && 0x80100020 SCARD_E_ICC_INSTALLATION
     * > No primary provider can be found for the smart card.
     Wo_mErrorMessage = "找不到智慧卡的主要提供者。"
CASE Wi_nErrorCode = -2146435039  && 0x80100021 SCARD_E_ICC_CREATEORDER
     * > The requested order of object creation is not supported.
     Wo_mErrorMessage = "不支援要求的物件建立順序。"
CASE Wi_nErrorCode = -2146435038  && 0x80100022 SCARD_E_UNSUPPORTED_FEATURE
     * > This smart card does not support the requested feature.
     Wo_mErrorMessage = "這個智慧卡不支援要求的功能。"
CASE Wi_nErrorCode = -2146435037  && 0x80100023 SCARD_E_DIR_NOT_FOUND
     * > The specified directory does not exist in the smart card.
     Wo_mErrorMessage = "智慧卡中沒有這個指定目錄。"
CASE Wi_nErrorCode = -2146435036  && 0x80100024 SCARD_E_FILE_NOT_FOUND
     * > The specified file does not exist in the smart card.
     Wo_mErrorMessage = "智慧卡中沒有這個指定檔案。"
CASE Wi_nErrorCode = -2146435035  && 0x80100025 SCARD_E_NO_DIR
     * > The supplied path does not represent a smart card directory.
     Wo_mErrorMessage = "提供的路徑不是智慧卡目錄。"
CASE Wi_nErrorCode = -2146435034  && 0x80100026 SCARD_E_NO_FILE
     * > The supplied path does not represent a smart card file.
     Wo_mErrorMessage = "提供的路徑不是智慧卡檔案。"
CASE Wi_nErrorCode = -2146435033  && 0x80100027 SCARD_E_NO_ACCESS
     * > Access is denied to the file.
     Wo_mErrorMessage = "存取檔案被拒。"
CASE Wi_nErrorCode = -2146435032  && 0x80100028 SCARD_E_WRITE_TOO_MANY
     * > An attempt was made to write more data than would fit in the target object.
     Wo_mErrorMessage = "嘗試寫入過多資料,超過目標物件的負荷。"
CASE Wi_nErrorCode = -2146435031  && 0x80100029 SCARD_E_BAD_SEEK
     * > An error occurred in setting the smart card file object pointer.
     Wo_mErrorMessage = "�]定智慧卡檔案物件指標時發生錯誤。"
CASE Wi_nErrorCode = -2146435030  && 0x8010002A SCARD_E_INVALID_CHV
     * > The supplied PIN is incorrect.
     Wo_mErrorMessage = "提供的 PIN 不正確。"
CASE Wi_nErrorCode = -2146435029  && 0x8010002B SCARD_E_UNKNOWN_RES_MNG
     * > An unrecognized error code was returned.
     Wo_mErrorMessage = "回傳一個無法識別的錯誤碼。"
CASE Wi_nErrorCode = -2146435028  && 0x8010002C SCARD_E_NO_SUCH_CERTIFICATE
     * > The requested certificate does not exist.
     Wo_mErrorMessage = "要求的憑證不存在。"
CASE Wi_nErrorCode = -2146435027  && 0x8010002D SCARD_E_CERTIFICATE_UNAVAILABLE
     * > The requested certificate could not be obtained.
     Wo_mErrorMessage = "無法取得要求的憑證。"
CASE Wi_nErrorCode = -2146435026  && 0x8010002E SCARD_E_NO_READERS_AVAILABLE
     * > No smart card reader is available.
     Wo_mErrorMessage = "沒有可用的智慧卡讀取裝置。"
CASE Wi_nErrorCode = -2146435025  && 0x8010002F SCARD_E_COMM_DATA_LOST
     * > A communications error with the smart card has been detected.
     Wo_mErrorMessage = "已經偵測到智慧卡發生一個通訊錯誤。"
CASE Wi_nErrorCode = -2146435024  && 0x80100030 SCARD_E_NO_KEY_CONTAINER
     * > The requested key container does not exist on the smart card.
     Wo_mErrorMessage = "在智慧卡上不存在請求的金鑰容器。"
CASE Wi_nErrorCode = -2146435023  && 0x80100031 SCARD_E_SERVER_TOO_BUSY
     * > The smart card resource manager is too busy to complete this operation.
     Wo_mErrorMessage = "智慧卡資源管理員太忙,無法完成此項操作。"
CASE Wi_nErrorCode = -2146435022  && 0x80100032 SCARD_E_PIN_CACHE_EXPIRED
     * > The smart card PIN cache has expired.
     *   Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This error code is not available.
     Wo_mErrorMessage = "智慧卡 PIN 快取已過期。"
CASE Wi_nErrorCode = -2146435021  && 0x80100033 SCARD_E_NO_PIN_CACHE
     * > The smart card PIN cannot be cached.
     *   Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This error code is not available.
     Wo_mErrorMessage = "無法快取智慧卡 PIN。"
CASE Wi_nErrorCode = -2146435020  && 0x80100034 SCARD_E_READ_ONLY_CARD
     * > The smart card is read-only and cannot be written to.
     *   Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This error code is not available.
     Wo_mErrorMessage = "智慧卡是唯讀的而且無法寫入。"
CASE Wi_nErrorCode = -2146434971  && 0x80100065 SCARD_W_UNSUPPORTED_CARD
     * > The reader cannot communicate with the card, due to ATR string configuration conflicts.
     Wo_mErrorMessage = "�]為 ATR 字串�]定衝突,造成讀取裝置與智慧卡無法通訊。"
CASE Wi_nErrorCode = -2146434970  && 0x80100066 SCARD_W_UNRESPONSIVE_CARD
     * > The smart card is not responding to a reset.
     Wo_mErrorMessage = "智慧卡並未回應重�]動作。"
CASE Wi_nErrorCode = -2146434969  && 0x80100067 SCARD_W_UNPOWERED_CARD
     * > Power has been removed from the smart card, so that further communication is not possible.
     Wo_mErrorMessage = "智慧卡的電源已移除,無法進行進一步的通訊。"
CASE Wi_nErrorCode = -2146434968  && 0x80100068 SCARD_W_RESET_CARD
     * > The smart card was reset.
     Wo_mErrorMessage = "智慧卡已重�]。"
CASE Wi_nErrorCode = -2146434967  && 0x80100069 SCARD_W_REMOVED_CARD
     * > The smart card has been removed, so further communication is not possible.
     Wo_mErrorMessage = "智慧卡已移除,無法進行進一步的通訊。"
CASE Wi_nErrorCode = -2146434966  && 0x8010006A SCARD_W_SECURITY_VIOLATION
     * > Access was denied because of a security violation.
     Wo_mErrorMessage = "�]為違反安全性�]定,造成存取被拒。"
CASE Wi_nErrorCode = -2146434965  && 0x8010006B SCARD_W_WRONG_CHV
     * > The card cannot be accessed because the wrong PIN was presented.
     Wo_mErrorMessage = "提供的 PIN 錯誤,無法存取智慧卡。"
CASE Wi_nErrorCode = -2146434964  && 0x8010006C SCARD_W_CHV_BLOCKED
     * > The card cannot be accessed because the maximum number of PIN entry attempts has been reached.
     Wo_mErrorMessage = "無法存取智慧卡,�]為已經到達嘗試 PIN 的最大數目限制。"
CASE Wi_nErrorCode = -2146434963  && 0x8010006D SCARD_W_EOF
     * > The end of the smart card file has been reached.
     Wo_mErrorMessage = "到達智慧卡檔案的結尾。"
CASE Wi_nErrorCode = -2146434962  && 0x8010006E SCARD_W_CANCELLED_BY_USER
     * > The action was canceled by the user.
     Wo_mErrorMessage = "該動作已被使用者取消。"
CASE Wi_nErrorCode = -2146434961  && 0x8010006F SCARD_W_CARD_NOT_AUTHENTICATED
     * > No PIN was presented to the smart card.
     Wo_mErrorMessage = "沒有給智慧卡提供 PIN。"
CASE Wi_nErrorCode = -2146434960  && 0x80100070 SCARD_W_CACHE_ITEM_NOT_FOUND
     * > The requested item could not be found in the cache.
     Wo_mErrorMessage = "在快取中找不到要求的項目。"
CASE Wi_nErrorCode = -2146434959  && 0x80100071 SCARD_W_CACHE_ITEM_STALE
     * > The requested cache item is too old and was deleted from the cache.
     Wo_mErrorMessage = "要求的快取項目太舊,已從快取中刪除。"
CASE Wi_nErrorCode = -2146434958  && 0x80100072 SCARD_W_CACHE_ITEM_TOO_BIG
     * > The new cache item exceeds the maximum per-item size defined for the cache.
     Wo_mErrorMessage = "新快取項目超過快取為每個項目所定義的最大大小。"
OTHERWISE
     Wo_mErrorMessage = "錯誤碼 = " + LTRIM(TRANSFORM(Wi_nErrorCode, "@R 999999999999999"))
ENDCASE

RETURN Wo_mErrorMessage
ENDFUNC

_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
kalok



註冊時間: 2010-08-26
文章: 284


第 2 樓

發表發表於: 星期四 十二月 02, 2021 10:49 am    文章主題: Re: [日誌] 取得讀卡機執行錯誤的訊息 (僅供自覽) 引言回覆

朱育興 寫到:
這是最近要以一般讀卡機讀取健保卡中所提供的個案基本資訊(不用經健保署驗證能自由取得的部分)


是用一舨的 card reader 去讀取智能身份證資料之類的嗎?
回頂端
檢視會員個人資料 發送私人訊息
朱育興



註冊時間: 2003-08-25
文章: 661
來自: 台中市大里區

第 3 樓

發表發表於: 星期四 十二月 02, 2021 1:43 pm    文章主題: 引言回覆

是的
_________________
希望有更多人來參與
VFP wiki - 需要大家一起完成的VFP電子書與FAQ
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 MSN Messenger
從之前的文章開始顯示:   
發表新主題   回覆主題    VFP 愛用者社區 首頁 -> VFP 討論區 所有的時間均為 台北時間 (GMT + 8 小時)
1頁(共1頁)

 
前往:  
無法 在這個版面發表文章
無法 在這個版面回覆文章
無法 在這個版面編輯文章
無法 在這個版面刪除文章
無法 在這個版面進行投票
無法 在這個版面附加檔案
無法 在這個版面下載檔案


Powered by phpBB © 2001, 2005 phpBB Group
正體中文語系由 phpbb-tw 維護製作