restore original block count logic and add debuggers for block0
This commit is contained in:
parent
a28a537610
commit
e560689f60
1 changed files with 3 additions and 1 deletions
|
@ -426,7 +426,7 @@ write_card(int write_block_zero)
|
||||||
|
|
||||||
printf("Writing %d blocks |", uiBlocks + 1);
|
printf("Writing %d blocks |", uiBlocks + 1);
|
||||||
// Completely write the card, end to start, but skipping block 0
|
// Completely write the card, end to start, but skipping block 0
|
||||||
for (uiBlock = 0; uiBlock <= uiBlocks; uiBlock++) {
|
for (uiBlock = 4; uiBlock <= uiBlocks; uiBlock++) {
|
||||||
printf("{%d}",uiBlock);
|
printf("{%d}",uiBlock);
|
||||||
// Authenticate everytime we reach the first sector of a new block
|
// Authenticate everytime we reach the first sector of a new block
|
||||||
if (is_first_block(uiBlock)) {
|
if (is_first_block(uiBlock)) {
|
||||||
|
@ -515,6 +515,7 @@ write_card(int write_block_zero)
|
||||||
if (write_block_zero || magic2 || magic3) {
|
if (write_block_zero || magic2 || magic3) {
|
||||||
for (uiBlock = 0; uiBlock < 4; uiBlock++) {
|
for (uiBlock = 0; uiBlock < 4; uiBlock++) {
|
||||||
|
|
||||||
|
printf("-%d-",uiBlock);
|
||||||
// The first block 0x00 is read only, skip this
|
// The first block 0x00 is read only, skip this
|
||||||
if (uiBlock == 0) {
|
if (uiBlock == 0) {
|
||||||
//If the card is not magic, we're gonna skip over
|
//If the card is not magic, we're gonna skip over
|
||||||
|
@ -555,6 +556,7 @@ write_card(int write_block_zero)
|
||||||
memset(mp.mpd.abtData, 0x00, sizeof(mp.mpd.abtData));
|
memset(mp.mpd.abtData, 0x00, sizeof(mp.mpd.abtData));
|
||||||
else
|
else
|
||||||
memcpy(mp.mpd.abtData, mtDump.amb[uiBlock].mbd.abtData, sizeof(mp.mpd.abtData));
|
memcpy(mp.mpd.abtData, mtDump.amb[uiBlock].mbd.abtData, sizeof(mp.mpd.abtData));
|
||||||
|
printf("<%d>",uiBlock);
|
||||||
// do not write a block 0 with incorrect BCC - card will be made invalid!
|
// do not write a block 0 with incorrect BCC - card will be made invalid!
|
||||||
if (uiBlock == 0) {
|
if (uiBlock == 0) {
|
||||||
if ((mp.mpd.abtData[0] ^ mp.mpd.abtData[1] ^ mp.mpd.abtData[2] ^ mp.mpd.abtData[3] ^ mp.mpd.abtData[4]) != 0x00 && !magic2) {
|
if ((mp.mpd.abtData[0] ^ mp.mpd.abtData[1] ^ mp.mpd.abtData[2] ^ mp.mpd.abtData[3] ^ mp.mpd.abtData[4]) != 0x00 && !magic2) {
|
||||||
|
|
Loading…
Reference in a new issue