From 65263f19b8dca273f548e7e286a4a526f39ba5fd Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Mon, 30 Jun 2008 08:19:34 +0200 Subject: [PATCH] When searching for the first partition, try to deal with incorrect geometry --- src/godmode.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/godmode.c b/src/godmode.c index af7f2e04..39120f60 100644 --- a/src/godmode.c +++ b/src/godmode.c @@ -329,7 +329,9 @@ static unsigned int tab_insert(uint64_t *tab, const uint64_t offset, unsigned in if(tab_nbri;j--) tab[j]=tab[j-1]; @@ -425,6 +427,22 @@ static list_part_t *search_part(disk_t *disk_car, const list_part_t *list_part_o try_offset_nbr=tab_insert(try_offset, 2*disk_car->sector_size+16384, try_offset_nbr); /* sometimes users don't choose Vista by mistake */ try_offset_nbr=tab_insert(try_offset, 2048*512, try_offset_nbr); + /* try to deal with incorrect geometry */ + /* 1/[01]/1 CHS x 16 63 */ + try_offset_nbr=tab_insert(try_offset, 16 * 63 * disk_car->sector_size, try_offset_nbr); + try_offset_nbr=tab_insert(try_offset, 17 * 63 * disk_car->sector_size, try_offset_nbr); + try_offset_nbr=tab_insert(try_offset, 16 * disk_car->CHS.sector * disk_car->sector_size, try_offset_nbr); + try_offset_nbr=tab_insert(try_offset, 17 * disk_car->CHS.sector * disk_car->sector_size, try_offset_nbr); + /* 1/[01]/1 CHS x 240 63 */ + try_offset_nbr=tab_insert(try_offset, 240 * 63 * disk_car->sector_size, try_offset_nbr); + try_offset_nbr=tab_insert(try_offset, 241 * 63 * disk_car->sector_size, try_offset_nbr); + try_offset_nbr=tab_insert(try_offset, 240 * disk_car->CHS.sector * disk_car->sector_size, try_offset_nbr); + try_offset_nbr=tab_insert(try_offset, 241 * disk_car->CHS.sector * disk_car->sector_size, try_offset_nbr); + /* 1/[01]/1 CHS x 255 63 */ + try_offset_nbr=tab_insert(try_offset, 255 * 63 * disk_car->sector_size, try_offset_nbr); + try_offset_nbr=tab_insert(try_offset, 256 * 63 * disk_car->sector_size, try_offset_nbr); + try_offset_nbr=tab_insert(try_offset, 255 * disk_car->CHS.sector * disk_car->sector_size, try_offset_nbr); + try_offset_nbr=tab_insert(try_offset, 256 * disk_car->CHS.sector * disk_car->sector_size, try_offset_nbr); } else if(disk_car->arch==&arch_mac) {