diff --git a/winpr/libwinpr/smartcard/smartcard_pcsc.c b/winpr/libwinpr/smartcard/smartcard_pcsc.c index 48bf5bec2..72f21f663 100644 --- a/winpr/libwinpr/smartcard/smartcard_pcsc.c +++ b/winpr/libwinpr/smartcard/smartcard_pcsc.c @@ -143,7 +143,9 @@ static int g_StartedEventRefCount = 0; static BOOL g_SCardAutoAllocate = FALSE; static BOOL g_PnP_Notification = TRUE; +#ifdef __MACOSX__ static unsigned int OSXVersion = 0; +#endif /** * g_LockTransactions: enable pcsc-lite SCardBeginTransaction/SCardEndTransaction. @@ -1885,12 +1887,13 @@ WINSCARDAPI LONG WINAPI PCSC_SCardStatus_Internal(SCARDHANDLE hCard, { if (pcchReaderLenAlloc) { +#ifdef __MAXOSX__ /** * Workaround for SCardStatus Bug in MAC OS X Yosemite */ if (OSXVersion == 0x10100000) pcsc_cchReaderLen++; - +#endif *pMszReaderNames = (LPSTR) calloc(1, pcsc_cchReaderLen); if (!*pMszReaderNames) @@ -2809,10 +2812,14 @@ int PCSC_InitializeSCardApi(void) g_PCSC.pfnSCardEndTransaction = (void*) GetProcAddress(g_PCSCModule, "SCardEndTransaction"); g_PCSC.pfnSCardStatus = (void*) GetProcAddress(g_PCSCModule, "SCardStatus"); g_PCSC.pfnSCardGetStatusChange = (void*) GetProcAddress(g_PCSCModule, "SCardGetStatusChange"); +#ifdef __MACOSX__ if (OSXVersion >= 0x10050600) g_PCSC.pfnSCardControl = (void*) GetProcAddress(g_PCSCModule, "SCardControl132"); else g_PCSC.pfnSCardControl = (void*) GetProcAddress(g_PCSCModule, "SCardControl"); +#else + g_PCSC.pfnSCardControl = (void*) GetProcAddress(g_PCSCModule, "SCardControl"); +#endif g_PCSC.pfnSCardTransmit = (void*) GetProcAddress(g_PCSCModule, "SCardTransmit"); g_PCSC.pfnSCardListReaderGroups = (void*) GetProcAddress(g_PCSCModule, "SCardListReaderGroups"); g_PCSC.pfnSCardListReaders = (void*) GetProcAddress(g_PCSCModule, "SCardListReaders");