Post
Topic
Board Development & Technical Discussion
Topic OP
Bitcoin private key/wallet.dat data recovery patch
by
thefreshprinceofbell
on 09/03/2021, 21:00:25 UTC
Hey, everyone I'm trying to use the following tool:

https://bitcointalk.org/index.php?topic=25091.0

To recover keys off an old 2011 era hard drive.  The problem is the drive has some bad sectors and I get a drive I/O error crashing the program.

Quote
static int refill_buf(void) {
   int ret;
   //printf("refill_buf: fill = %i pos = %i\n", buffill, bufpos);
   if(bufpos > BUF_WATERMARK) {
      memcpy(buf, buf + BUF_SEGMENT, BUF_LEN-BUF_SEGMENT);
      buffill -= BUF_SEGMENT;
      bufpos -= BUF_SEGMENT;
   }
   if(buffill < BUF_LEN) {
      ret = read(f, buf+buffill, BUF_LEN-buffill);
      if(ret < 0) {
         perror("Device read");
         exit(1);
      }
      //printf("Read %i bytes\n", ret);
      buffill += ret;
      fpos += ret;
      if(fpos > fnextcp) {
         show_progress();
         fnextcp = fpos + (ftotallen/1024);
      }
      return ret;
   } else {
      return -1;
   }
}

Is there a simple way to modify the code to skip ahead instead of jumping to the Device read exit block?