fix parameter name and style

This commit is contained in:
iceman1001 2024-11-10 15:08:45 +01:00
commit 3e4ab945f5

View file

@ -1001,22 +1001,25 @@ int mfWriteBlock(uint8_t blockno, uint8_t keyType, const uint8_t *key, uint8_t *
memcpy(data + 10, block, MFBLOCK_SIZE); memcpy(data + 10, block, MFBLOCK_SIZE);
clearCommandBuffer(); clearCommandBuffer();
SendCommandMIX(CMD_HF_MIFARE_WRITEBL, blockno, keytype, 0, data, sizeof(data)); SendCommandMIX(CMD_HF_MIFARE_WRITEBL, blockno, keyType, 0, data, sizeof(data));
PacketResponseNG resp; PacketResponseNG resp;
if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) { if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) {
PrintAndLogEx(FAILED, "mfWriteBlock execution time out"); PrintAndLogEx(FAILED, "mfWriteBlock execution time out");
return PM3_ETIMEOUT; return PM3_ETIMEOUT;
} }
int res = PM3_SUCCESS;
return ((resp.oldarg[0] & 0xff) == 1)?PM3_SUCCESS:PM3_EFAILED; if ((resp.oldarg[0] & 0xff) != 1) {
res = PM3_EFAILED;
}
return res;
} }
int mfWriteSector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *sector){ int mfWriteSector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *sector){
int res;
for (int i=0;i<4; i++){ for (int i = 0; i < 4; i++) {
res = mfWriteBlock((sectorNo*4)+i, keyType, key, sector+(i*MFBLOCK_SIZE)); int res = mfWriteBlock((sectorNo*4)+i, keyType, key, sector + ( i * MFBLOCK_SIZE ));
if (res != PM3_SUCCESS){ if (res != PM3_SUCCESS) {
return (i==0)?PM3_EFAILED:PM3_EPARTIAL; return (i == 0) ? PM3_EFAILED : PM3_EPARTIAL;
} }
} }
return PM3_SUCCESS; return PM3_SUCCESS;