// TODO: use an (fn,str) table and simplify this whole thing BOOL AnalyzePBR(HANDLE hLogicalVolume) { FILE fake_fd = { 0 }; fake_fd._ptr = (char*)hLogicalVolume; fake_fd._bufsiz = SelectedDrive.Geometry.BytesPerSector; if (!is_br(&fake_fd)) { uprintf("Volume does not have an x86 partition boot record\n"); return FALSE; } if (is_fat_16_br(&fake_fd) || is_fat_32_br(&fake_fd)) { if (entire_fat_16_br_matches(&fake_fd)) { uprintf("Drive has a FAT16 DOS partition boot record\n"); } else if (entire_fat_16_fd_br_matches(&fake_fd)) { uprintf("Drive has a FAT16 FreeDOS partition boot record\n"); } else if (entire_fat_16_ros_br_matches(&fake_fd)) { uprintf("Drive has a FAT16 ReactOS partition boot record\n"); } else if (entire_fat_32_br_matches(&fake_fd)) { uprintf("Drive has a FAT32 DOS partition boot record\n"); } else if (entire_fat_32_nt_br_matches(&fake_fd)) { uprintf("Drive has a FAT32 NT partition boot record\n"); } else if (entire_fat_32_fd_br_matches(&fake_fd)) { uprintf("Drive has a FAT32 FreeDOS partition boot record\n"); } else if (entire_fat_32_ros_br_matches(&fake_fd)) { uprintf("Drive has a FAT32 ReactOS partition boot record\n"); } else { uprintf("Drive has an unknown FAT16 or FAT32 partition boot record\n"); } } else { uprintf("Drive has an unknown partition boot record\n"); } return TRUE; }
void diagnose(FILE *fp, const char *szPath) { if(is_fat_12_fs(fp)) printf(_("%s has a FAT12 file system.\n"), szPath); if(is_fat_16_fs(fp)) printf(_("%s has a FAT16 file system.\n"), szPath); if(is_fat_32_fs(fp)) printf(_("%s has a FAT32 file system.\n"), szPath); if(is_ntfs_fs(fp)) printf(_("%s has a NTFS file system.\n"), szPath); if(is_br(fp)) printf(_("%s has an x86 boot sector,\n"), szPath); else { printf(_("%s has no x86 boot sector\n"), szPath); return; } if(entire_ntfs_br_matches(fp)) { printf( _("it is exactly the kind of NTFS boot record this program\n")); printf( _("would create with the switch -n on a NTFS partition.\n")); } else if(entire_fat_12_br_matches(fp)) { printf( _("it is exactly the kind of FAT12 boot record this program\n")); printf( _("would create with the switch -1 on a floppy.\n")); } else if(is_fat_16_br(fp) || is_fat_32_br(fp)) { if(entire_fat_16_br_matches(fp)) { printf( _("it is exactly the kind of FAT16 DOS boot record this program\n")); printf( _("would create with the switch -6 on a FAT16 partition.\n")); } else if(entire_fat_16_fd_br_matches(fp)) { printf( _("it is exactly the kind of FAT16 FreeDOS boot record this program\n")); printf( _("would create with the switch -5 on a FAT16 partition.\n")); } else if(entire_fat_32_br_matches(fp)) { printf( _("it is exactly the kind of FAT32 DOS boot record this program\n")); printf( _("would create with the switch -3 on a FAT32 partition.\n")); } else if(entire_fat_32_nt_br_matches(fp)) { printf( _("it is exactly the kind of FAT32 NT boot record this program\n")); printf( _("would create with the switch -2 on a FAT32 partition.\n")); } else if(entire_fat_32_fd_br_matches(fp)) { printf( _("it is exactly the kind of FAT32 FreeDOS boot record this program\n")); printf( _("would create with the switch -4 on a FAT32 partition.\n")); } else { printf( _("it seems to be a FAT16 or FAT32 boot record, but it\n")); printf( _("differs from what this program would create with the\n")); printf(_("switch -6, -2 or -3 on a FAT16 or FAT32 partition.\n")); } } else if(is_lilo_br(fp)) { printf(_("it seems to be a LILO boot record, please use lilo to\n")); printf(_("create such boot records.\n")); } else if(is_dos_mbr(fp)) { printf( _("it is a Microsoft DOS/NT/95A master boot record, like the one this\n")); printf( _("program creates with the switch -d on a hard disk device.\n")); } else if(is_dos_f2_mbr(fp)) { printf( _("it is a Microsoft DOS/NT/95A master boot record with the undocumented\n")); printf( _("F2 instruction. You will get equal functionality with the MBR this\n")); printf( _("program creates with the switch -d on a hard disk device.\n")); } else if(is_95b_mbr(fp)) { printf( _("it is a Microsoft 95B/98/98SE/ME master boot record, like the one this\n")); printf( _("program creates with the switch -9 on a hard disk device.\n")); } else if(is_2000_mbr(fp)) { printf( _("it is a Microsoft 2000/XP/2003 master boot record, like the one this\n")); printf( _("program creates with the switch -m on a hard disk device.\n")); } else if(is_vista_mbr(fp)) { printf( _("it is a Microsoft Vista master boot record, like the one this\n")); printf( _("program creates with the switch -i on a hard disk device.\n")); } else if(is_win7_mbr(fp)) { printf( _("it is a Microsoft 7 master boot record, like the one this\n")); printf( _("program creates with the switch -7 on a hard disk device.\n")); } else if(is_syslinux_mbr(fp)) { printf( _("it is a public domain syslinux master boot record, like the one this\n")); printf( _("program creates with the switch -s on a hard disk device.\n")); } else if(is_syslinux_gpt_mbr(fp)) { printf( _("it is a GPL syslinux GPT master boot record, like the one this\n")); printf( _("program creates with the switch -t on a hard disk device.\n")); } else if(is_zero_mbr(fp)) { printf( _("it is a zeroed non-bootable master boot record, like the one this\n")); printf( _("program creates with the switch -z on a hard disk device.\n")); } else printf(_("it is an unknown boot record\n")); } /* diagnose */