/* fixbs ----- Fix bootsector of an mformat-ed hard drive FAT partition. Gilbert Ramirez Technical Services University Health System $Id: ramirez.fixbs,v 1.1.1.1 2002/08/14 22:27:25 dan Exp $ */ #include #include #include #include #include #include int main(int argc, char **argv) { char *device; int fd; char jmp[2] = { 0x3c, 0x90 }; char dirlen[2] = { 0x00, 0x02 }; if (argc != 2) { fprintf(stderr, "\nusage: %s device\n" "\tFixes boot sector on device\n", argv[0]); exit(-1); } device = argv[1]; if ((fd = open(device, O_WRONLY)) < 0) { fprintf(stderr, "%s: couldn't open %s for writing\n", argv[0], device); exit(-1); } lseek(fd, 1, SEEK_SET); write(fd, jmp, 2); lseek(fd, 0x11, SEEK_SET); write(fd, dirlen, 2); close(fd); return 0; }