MCPcopy Create free account
hub / github.com/cgsecurity/testdisk / get_subdirectory

Function get_subdirectory

src/fat_adv.c:155–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153
154
155static unsigned long int get_subdirectory(disk_t *disk_car,const uint64_t hd_offset,const unsigned long int i)
156{
157 unsigned char buffer[DEFAULT_SECTOR_SIZE];
158 const struct msdos_dir_entry *entry1=(const struct msdos_dir_entry *)&buffer[0];
159 const struct msdos_dir_entry *entry2=(const struct msdos_dir_entry *)&buffer[0x20];
160 if(disk_car->pread(disk_car, &buffer, sizeof(buffer), hd_offset) != sizeof(buffer))
161 {
162 log_error("fat_dir, get_subdirectory(), can't read directory\n");
163 return 1;
164 }
165 if(!is_fat_directory(buffer))
166 return 1;
167 if(fat_get_cluster_from_entry(entry1) != i)
168 return 1;
169 return fat_get_cluster_from_entry(entry2);
170}
171
172#ifdef HAVE_NCURSES
173#define INTER_DIR 16

Callers 1

fat32_find_root_clusterFunction · 0.85

Calls 2

is_fat_directoryFunction · 0.85

Tested by

no test coverage detected