summaryrefslogtreecommitdiffstats
path: root/src/fat_common.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2009-06-21 19:43:25 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2009-06-21 19:43:25 +0200
commite976d6af99cfa1d5b94cc6d8c93f6b09bb66f783 (patch)
tree34168740ce7f3a9faa23747c1203b0f3dfe686fb /src/fat_common.c
parent05063cc236bf7e8b83f3ce9de5dfc2cc447e805a (diff)
PhotoRec: recover FAT filesystem (ie. floppy image)
Note, you should disable the recovery of other filetypes
Diffstat (limited to 'src/fat_common.c')
-rw-r--r--src/fat_common.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/fat_common.c b/src/fat_common.c
new file mode 100644
index 0000000..e6a6bee
--- /dev/null
+++ b/src/fat_common.c
@@ -0,0 +1,38 @@
+/*
+
+ File: fat_common.c
+
+ Copyright (C) 1998-2009 Christophe GRENIER <grenier@cgsecurity.org>
+
+ This software is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write the Free Software Foundation, Inc., 51
+ Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "types.h"
+#include "common.h"
+#include "fat.h"
+
+unsigned int fat_sector_size(const struct fat_boot_sector *fat_header)
+{ return (fat_header->sector_size[1]<<8)+fat_header->sector_size[0]; }
+
+unsigned int get_dir_entries(const struct fat_boot_sector *fat_header)
+{ return (fat_header->dir_entries[1]<<8)+fat_header->dir_entries[0]; }
+
+unsigned int sectors(const struct fat_boot_sector *fat_header)
+{ return (fat_header->sectors[1]<<8)+fat_header->sectors[0]; }
+