summaryrefslogtreecommitdiffstats
path: root/src/exfat_dir.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-03-21 08:47:33 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2014-03-21 08:47:33 +0100
commitbb43d90c9dac28d5c5d7db292c36442985427afa (patch)
treec27b20d275794dd3f28ff1335ce5c5ef2fa3719b /src/exfat_dir.c
parent3012b0fc1906a65ac2d41f67855ddb0e8a5e9422 (diff)
src/exfat_dir.c: exFAT cluster number is using 32 bits, fix EOC detection
Diffstat (limited to 'src/exfat_dir.c')
-rw-r--r--src/exfat_dir.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/exfat_dir.c b/src/exfat_dir.c
index 6291eb5..65e91f3 100644
--- a/src/exfat_dir.c
+++ b/src/exfat_dir.c
@@ -96,12 +96,11 @@ static unsigned int exfat_get_next_cluster(disk_t *disk_car,const partition_t *p
free(buffer);
return 0;
}
- /* FAT32 used 28 bits, the 4 high bits are reserved
- * 0x00000000: free cluster
- * 0x0FFFFFF7: bad cluster
- * 0x0FFFFFF8+: EOC End of cluster
+ /* 0x00000000: free cluster
+ * 0xFFFFFFF7: bad cluster
+ * 0xFFFFFFFF: EOC End of cluster
* */
- next_cluster=le32(p32[offset_o])&0xFFFFFFF;
+ next_cluster=le32(p32[offset_o]);
free(buffer);
return next_cluster;
}
@@ -277,6 +276,22 @@ dir_partition_t dir_partition_exfat_init(disk_t *disk, const partition_t *partit
log_error("dir_partition_exfat_init: iconv_open failed\n");
}
#endif
+#ifdef DEBUG_EXFAT
+ log_info("start_sector=%llu\n", (long long unsigned)le64(exfat_header->start_sector));
+ log_info("nr_sectors =%llu\n", (long long unsigned)le64(exfat_header->nr_sectors));
+ log_info("fat_blocknr =%u\n",le32(exfat_header->fat_blocknr));
+ log_info("fat_block_counts=%u\n", le32(exfat_header->fat_block_counts));
+ log_info("clus_blocknr=%u\n", le32(exfat_header->clus_blocknr));
+ log_info("total_clusters=%u\n", le32(exfat_header->total_clusters));
+ log_info("rootdir_clusnr=%u\n", le32(exfat_header->rootdir_clusnr));
+ log_info("serial_number=0x%08x\n", le32(exfat_header->serial_number));
+ log_info("state=0x%x\n", le16(exfat_header->state));
+ log_info("blocksize_bits=%u\n", exfat_header->blocksize_bits);
+ log_info("block_per_clus_bits=%u\n", exfat_header->block_per_clus_bits);
+ log_info("number_of_fats=%u\n", exfat_header->number_of_fats);
+ log_info("drive_select=0x%x\n", exfat_header->drive_select);
+ log_info("allocated_percent=%u\n", exfat_header->allocated_percent);
+#endif
strncpy(dir_data->current_directory,"/",sizeof(dir_data->current_directory));
dir_data->current_inode=0;
dir_data->param=FLAG_LIST_DELETED;