| 1 | /* |
| 2 | * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. Oracle designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Oracle in the LICENSE file that accompanied this code. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | * version 2 for more details (a copy is included in the LICENSE file that |
| 15 | * accompanied this code). |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License version |
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 22 | * or visit www.oracle.com if you need additional information or have any |
| 23 | * questions. |
| 24 | */ |
| 25 | |
| 26 | typedef LONG (*FPTR_SCardEstablishContext)(DWORD dwScope, |
| 27 | LPCVOID pvReserved1, |
| 28 | LPCVOID pvReserved2, |
| 29 | LPSCARDCONTEXT phContext); |
| 30 | |
| 31 | typedef LONG (*FPTR_SCardConnect)(SCARDCONTEXT hContext, |
| 32 | LPCSTR szReader, |
| 33 | DWORD dwShareMode, |
| 34 | DWORD dwPreferredProtocols, |
| 35 | LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol); |
| 36 | |
| 37 | typedef LONG (*FPTR_SCardDisconnect)(SCARDHANDLE hCard, DWORD dwDisposition); |
| 38 | |
| 39 | typedef LONG (*FPTR_SCardStatus)(SCARDHANDLE hCard, |
| 40 | LPSTR mszReaderNames, |
| 41 | LPDWORD pcchReaderLen, |
| 42 | LPDWORD pdwState, |
| 43 | LPDWORD pdwProtocol, |
| 44 | LPBYTE pbAtr, LPDWORD pcbAtrLen); |
| 45 | |
| 46 | typedef LONG (*FPTR_SCardGetStatusChange)(SCARDCONTEXT hContext, |
| 47 | DWORD dwTimeout, |
| 48 | SCARD_READERSTATE *rgReaderStates, DWORD cReaders); |
| 49 | |
| 50 | typedef LONG (*FPTR_SCardTransmit)(SCARDHANDLE hCard, |
| 51 | const SCARD_IO_REQUEST *pioSendPci, |
| 52 | LPCBYTE pbSendBuffer, |
| 53 | DWORD cbSendLength, |
| 54 | SCARD_IO_REQUEST *pioRecvPci, |
| 55 | LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength); |
| 56 | |
| 57 | typedef LONG (*FPTR_SCardListReaders)(SCARDCONTEXT hContext, |
| 58 | LPCSTR mszGroups, |
| 59 | LPSTR mszReaders, LPDWORD pcchReaders); |
| 60 | |
| 61 | typedef LONG (*FPTR_SCardBeginTransaction)(SCARDHANDLE hCard); |
| 62 | |
| 63 | typedef LONG (*FPTR_SCardEndTransaction)(SCARDHANDLE hCard, |
| 64 | DWORD dwDisposition); |
| 65 | |
| 66 | typedef LONG (*FPTR_SCardControl)(SCARDHANDLE hCard, DWORD dwControlCode, |
| 67 | LPCVOID pbSendBuffer, DWORD cbSendLength, LPVOID pbRecvBuffer, |
| 68 | DWORD pcbRecvLength, LPDWORD lpBytesReturned); |
| 69 | |
| 70 | #define CALL_SCardEstablishContext(dwScope, pvReserved1, pvReserved2, phContext) \ |
| 71 | ((scardEstablishContext)(dwScope, pvReserved1, pvReserved2, phContext)) |
| 72 | |
| 73 | #define CALL_SCardConnect(hContext, szReader, dwSharedMode, dwPreferredProtocols, phCard, pdwActiveProtocols) \ |
| 74 | ((scardConnect)(hContext, szReader, dwSharedMode, dwPreferredProtocols, phCard, pdwActiveProtocols)) |
| 75 | |
| 76 | #define CALL_SCardDisconnect(hCard, dwDisposition) \ |
| 77 | ((scardDisconnect)(hCard, dwDisposition)) |
| 78 | |
| 79 | #define CALL_SCardStatus(hCard, mszReaderNames, pcchReaderLen, pdwState, pdwProtocol, pbAtr, pcbAtrLen) \ |
| 80 | ((scardStatus)(hCard, mszReaderNames, pcchReaderLen, pdwState, pdwProtocol, pbAtr, pcbAtrLen)) |
| 81 | |
| 82 | #define CALL_SCardGetStatusChange(hContext, dwTimeout, rgReaderStates, cReaders) \ |
| 83 | ((scardGetStatusChange)(hContext, dwTimeout, rgReaderStates, cReaders)) |
| 84 | |
| 85 | #define CALL_SCardTransmit(hCard, pioSendPci, pbSendBuffer, cbSendLength, \ |
| 86 | pioRecvPci, pbRecvBuffer, pcbRecvLength) \ |
| 87 | ((scardTransmit)(hCard, pioSendPci, pbSendBuffer, cbSendLength, \ |
| 88 | pioRecvPci, pbRecvBuffer, pcbRecvLength)) |
| 89 | |
| 90 | #define CALL_SCardListReaders(hContext, mszGroups, mszReaders, pcchReaders) \ |
| 91 | ((scardListReaders)(hContext, mszGroups, mszReaders, pcchReaders)) |
| 92 | |
| 93 | #define CALL_SCardBeginTransaction(hCard) \ |
| 94 | ((scardBeginTransaction)(hCard)) |
| 95 | |
| 96 | #define CALL_SCardEndTransaction(hCard, dwDisposition) \ |
| 97 | ((scardEndTransaction)(hCard, dwDisposition)) |
| 98 | |
| 99 | #define CALL_SCardControl(hCard, dwControlCode, pbSendBuffer, cbSendLength, \ |
| 100 | pbRecvBuffer, pcbRecvLength, lpBytesReturned) \ |
| 101 | ((scardControl)(hCard, dwControlCode, pbSendBuffer, cbSendLength, \ |
| 102 | pbRecvBuffer, pcbRecvLength, lpBytesReturned)) |
| 103 | |
| 104 | extern FPTR_SCardEstablishContext scardEstablishContext; |
| 105 | extern FPTR_SCardConnect scardConnect; |
| 106 | extern FPTR_SCardDisconnect scardDisconnect; |
| 107 | extern FPTR_SCardStatus scardStatus; |
| 108 | extern FPTR_SCardGetStatusChange scardGetStatusChange; |
| 109 | extern FPTR_SCardTransmit scardTransmit; |
| 110 | extern FPTR_SCardListReaders scardListReaders; |
| 111 | extern FPTR_SCardBeginTransaction scardBeginTransaction; |
| 112 | extern FPTR_SCardEndTransaction scardEndTransaction; |
| 113 | extern FPTR_SCardControl scardControl; |
| 114 | |