Index: nfc-mfultralight.c =================================================================== --- nfc-mfultralight.c (revision 841) +++ nfc-mfultralight.c (working copy) @@ -110,18 +110,31 @@ char buffer[BUFSIZ]; bool write_otp; + bool write_lock; printf ("Write OTP bytes ? [yN] "); fgets (buffer, BUFSIZ, stdin); write_otp = ((buffer[0] == 'y') || (buffer[0] == 'Y')); + printf ("Lock card ? [yN] "); + fgets (buffer, BUFSIZ, stdin); + write_lock = ((buffer[0] == 'y') || (buffer[0] == 'Y')); - /* We need to skip 3 first pages. */ + /* We need to skip 2 first pages. */ printf ("Writing %d pages |", uiBlocks + 1); - printf ("sss"); + printf ("ss"); - if (write_otp) { + if (write_lock) + { + page = 0x2; + } + else if (write_otp) + { + //skipped page 3 for locks + printf("s"); page = 0x3; - } else { + } + else + { /* If user don't want to write OTP, we skip 1 page more. */ printf ("s"); page = 0x4; @@ -149,8 +162,14 @@ print_success_or_failure (bFailure, &uiWritenPages); } printf ("|\n"); - printf ("Done, %d of %d pages written (%d first pages are skipped).\n", uiWritenPages, uiBlocks + 1, - write_otp ? 3 : 4); + if(write_lock) + { + printf ("Done, %d of %d pages written (%d first pages are skipped).\n", uiWritenPages, uiBlocks + 1, write_lock ? 2 : 3); + } + else + { + printf ("Done, %d of %d pages written (%d first pages are skipped).\n", uiWritenPages, uiBlocks + 1, write_otp ? 3 : 4); + } return true; }