User guide

ACR83 Reference Manual info@acs.com.hk
Version 1.05
www.acs.com.hk
Page 47 of 49
pPinModify->bmPINLengthFormat = 0;
pPinModify->bInsertionOffsetOld = 0;
pPinModify->bInsertionOffsetNew = 0;
pPinModify->wPINMaxExtraDigit = 0x0408;
pPinModify->bConfirmPIN = 0x01;
pPinModify->bEntryValidationCondition = 0x03;
pPinModify->bNumberMessage = 0x02;
pPinModify->wLangId = 0x0409;
pPinModify->bMsgIndex1 = 0;
pPinModify->bMsgIndex2 = 1;
pPinModify->bMsgIndex3 = 0;
pPinModify->bTeoPrologue[0] = 0;
pPinModify->bTeoPrologue[1] = 0;
pPinModify->bTeoPrologue[2] = 0;
pPinModify->ulDataLength = dwSendBufferLen;
memcpy(pPinModify->abData, bSendBuffer, dwSendBufferLen);
// Modify PIN
printf("Modifying PIN using MODIFY_PIN_DIRECT...\n");
dwRecvBufferLen = sizeof(bRecvBuffer);
lReturn = SCardControl(hCard,
featureControlCodes[FEATURE_MODIFY_PIN_DIRECT],
pPinModify, sizeof(PIN_MODIFY_STRUCTURE) - 1 + dwSendBufferLen,
bRecvBuffer, dwRecvBufferLen, &dwRecvBufferLen);
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");
}
delete [] ((BYTE*) pPinModify);
printf("Ending transaction...\n");
lReturn = SCardEndTransaction(hCard, SCARD_LEAVE_CARD);
if (lReturn != SCARD_S_SUCCESS)
printf("Error: SCardEndTransaction failed with error 0x%08x\n",
lReturn);
// Get IFD PIN properties
printf("Getting IFD PIN properties...\n");
dwRecvBufferLen = sizeof(bRecvBuffer);
lReturn = SCardControl(hCard,
featureControlCodes[FEATURE_IFD_PIN_PROP],
NULL, 0,
bRecvBuffer, dwRecvBufferLen, &dwRecvBufferLen);
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");
}