ACS ACR83 PINeasy Smart Card Reader User Manual

Page 45

Advertising
background image

ACR83 – Reference Manual

[email protected]

Version 1.05

www.acs.com.hk

Page 45 of 49

if (lReturn != SCARD_S_SUCCESS)

printf("Error: SCardControl failed with error 0x%08x\n",

lReturn);

else

{

printf("Response: ");

for (i = 0; i < dwRecvBufferLen; i++)

printf("%02X ", bRecvBuffer[i]);

printf("\n");

memset(featureControlCodes, 0, sizeof(featureControlCodes));

i = 0;

while (i < dwRecvBufferLen)

{

// Get the feature

if ((bRecvBuffer[i] >= FEATURE_VERIFY_PIN_START) &&

(bRecvBuffer[i] <= FEATURE_ABORT))

{

// Get the TLV

if (i + 1 + 4 < dwRecvBufferLen)

{

// Get the length field

if (bRecvBuffer[i + 1] == 4)

{

controlCode = bRecvBuffer[i + 2] << 24;

controlCode |= bRecvBuffer[i + 3] << 16;

controlCode |= bRecvBuffer[i + 4] << 8;

controlCode |= bRecvBuffer[i + 5];

featureControlCodes[bRecvBuffer[i]] =

controlCode;

}

}

}

// Get the next feature

if (i + 1 < dwRecvBufferLen)

i += bRecvBuffer[i + 1] + 2;

else

break;

}

}

printf("Beginning transaction...\n");

lReturn = SCardBeginTransaction(hCard);

if (lReturn != SCARD_S_SUCCESS)

printf("Error: SCardBeginTransaction failed with error

0x%08x\n", lReturn);

// Send card command for PIN verification (ACOS3)

dwSendBufferLen = 13;

memcpy(bSendBuffer,

"\x80\x20\x06\x00\x08\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", dwSendBufferLen);

// Create PIN verify structure

PPIN_VERIFY_STRUCTURE pPinVerify = (PPIN_VERIFY_STRUCTURE) new

BYTE[sizeof(PIN_VERIFY_STRUCTURE) - 1 + dwSendBufferLen];

if (pPinVerify == NULL)

{

Advertising