Determine OSX Version ... only on OSX

This commit is contained in:
Vincent Sourin 2014-12-14 15:15:33 +01:00
parent 8a028f78e2
commit 719e5c9cdb
1 changed files with 8 additions and 1 deletions

View File

@ -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");