Mifare 1K writing data in two blocks

  apdu, c++, nfc, rfid

hello i’m working with APDU command for writting and reading a RFID card . I can read from the block num 2 and write a data of 16 bytes . but i have a problem in writting a longer data so how can i mange i have tried to write in two blocks but it doesnt work.
this the way that i have implemented my code in the operation of writing

// write...
//


if (nres == SM_SUCCESS)// &&
//bAPDURes )
{
nlenrcv = sizeof(btRcv);
nlencmd = 0;

btCmd[nlencmd++] = 0xFF;                // CLA
btCmd[nlencmd++] = 0xD6;                // INS
btCmd[nlencmd++] = 0x00;                // P1, Mifare Block Number MSB, for mifare it is always 0x00
btCmd[nlencmd++] = 0x04;                // P2, Mifare Block Number LSB
btCmd[nlencmd++] = 32;              // Lc, Data Length
memcpy(btCmd + nlencmd, btWrite, 32);
nlencmd += 32;

nres = m_Smart.RFTransmit(DEV_INTERNALRF, nlencmd, btCmd, (DWORD*)&nlenrcv, btRcv);

Source: Windows Questions C++

LEAVE A COMMENT