summaryrefslogtreecommitdiffstats
path: root/src/fat.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-12-08 14:40:15 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2013-12-08 14:40:15 +0100
commitccc47d5bf2c28e40857912b7c65e3f97415ebe7a (patch)
tree1af42226034ee2f6fca5554f6759b826b3d9e232 /src/fat.c
parent1398b863c2a47d2da492e8a66995e65cc3aded75 (diff)
fat32_get_free_count() and fat32_get_next_free() - code style
Diffstat (limited to 'src/fat.c')
-rw-r--r--src/fat.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/fat.c b/src/fat.c
index aea5407..c64cfb6 100644
--- a/src/fat.c
+++ b/src/fat.c
@@ -747,12 +747,14 @@ int comp_FAT(disk_t *disk, const partition_t *partition, const unsigned long int
unsigned long int fat32_get_free_count(const unsigned char *boot_fat32, const unsigned int sector_size)
{
- return (boot_fat32[sector_size+0x1E8+3]<<24)+(boot_fat32[sector_size+0x1E8+2]<<16)+(boot_fat32[sector_size+0x1E8+1]<<8)+boot_fat32[sector_size+0x1E8];
+ const struct fat_fsinfo *fsinfo=(const struct fat_fsinfo *)&boot_fat32[sector_size];
+ return le32(fsinfo->freecnt);
}
unsigned long int fat32_get_next_free(const unsigned char *boot_fat32, const unsigned int sector_size)
{
- return (boot_fat32[sector_size+0x1EC+3]<<24)+(boot_fat32[sector_size+0x1EC+2]<<16)+(boot_fat32[sector_size+0x1EC+1]<<8)+boot_fat32[sector_size+0x1EC];
+ const struct fat_fsinfo *fsinfo=(const struct fat_fsinfo *)&boot_fat32[sector_size];
+ return le32(fsinfo->nextfree);
}
int recover_FAT(disk_t *disk_car, const struct fat_boot_sector*fat_header, partition_t *partition, const int verbose, const int dump_ind, const int backup)