summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2008-04-03 00:22:31 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2008-04-03 00:22:31 +0200
commit5bc721de8ee62310fdca321e4462192138afd86a (patch)
tree66c4ebd8e379b6bd7a05872c358ec9b15e519940 /src
parent1739339385ca8e02bf7827bdc4c9004f67e967b6 (diff)
code cleanup: rename aff_buffer()
Diffstat (limited to 'src')
-rw-r--r--src/adv.c112
-rw-r--r--src/chgtype.c8
-rw-r--r--src/dirpart.c10
-rw-r--r--src/ext2p.c6
-rw-r--r--src/fat.c58
-rw-r--r--src/fat_adv.c8
-rw-r--r--src/godmode.c4
-rw-r--r--src/intrf.c151
-rw-r--r--src/intrf.h10
-rw-r--r--src/intrface.c14
-rw-r--r--src/ntfs.c18
-rw-r--r--src/ntfsp.c6
-rw-r--r--src/partgpt.c28
-rw-r--r--src/parti386.c52
-rw-r--r--src/partmac.c10
-rw-r--r--src/partnone.c8
-rw-r--r--src/partsun.c10
-rw-r--r--src/partxbox.c8
-rw-r--r--src/photorec.c2
-rw-r--r--src/phrecn.c5
-rw-r--r--src/rfs_dir.c2
-rw-r--r--src/testdisk.c2
22 files changed, 264 insertions, 268 deletions
diff --git a/src/adv.c b/src/adv.c
index a8adb3f..1f86746 100644
--- a/src/adv.c
+++ b/src/adv.c
@@ -513,7 +513,7 @@ int fat1x_boot_sector(disk_t *disk_car, partition_t *partition, const int verbos
{
unsigned int menu=0;
int command;
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
if(rescan==1)
{
#ifdef HAVE_NCURSES
@@ -526,15 +526,15 @@ int fat1x_boot_sector(disk_t *disk_car, partition_t *partition, const int verbos
#endif
log_info("\nfat1x_boot_sector\n");
log_partition(disk_car,partition);
- aff_buffer(BUFFER_ADD,"Boot sector\n");
+ screen_buffer_add("Boot sector\n");
if(disk_car->read(disk_car,FAT1x_BOOT_SECTOR_SIZE, buffer_bs, partition->part_offset)!=0)
{
- aff_buffer(BUFFER_ADD,"fat1x_boot_sector: Can't read boot sector.\n");
+ screen_buffer_add("fat1x_boot_sector: Can't read boot sector.\n");
memset(buffer_bs,0,FAT1x_BOOT_SECTOR_SIZE);
}
if(test_FAT(disk_car,(const struct fat_boot_sector *)buffer_bs,partition,verbose,0)==0)
{
- aff_buffer(BUFFER_ADD,"OK\n");
+ screen_buffer_add("OK\n");
if(expert==0)
options="DRCL";
else
@@ -542,12 +542,12 @@ int fat1x_boot_sector(disk_t *disk_car, partition_t *partition, const int verbos
}
else
{
- aff_buffer(BUFFER_ADD,"Bad\n");
+ screen_buffer_add("Bad\n");
options="DRC";
}
- aff_buffer(BUFFER_ADD,"\n");
- aff_buffer(BUFFER_ADD,"A valid FAT Boot sector must be present in order to access\n");
- aff_buffer(BUFFER_ADD,"any data; even if the partition is not bootable.\n");
+ screen_buffer_add("\n");
+ screen_buffer_add("A valid FAT Boot sector must be present in order to access\n");
+ screen_buffer_add("any data; even if the partition is not bootable.\n");
rescan=0;
}
screen_buffer_to_log();
@@ -674,7 +674,7 @@ int fat32_boot_sector(disk_t *disk_car, partition_t *partition, const int verbos
{
unsigned int menu=0;
int command;
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
if(rescan==1)
{
int opt_over=0;
@@ -691,15 +691,15 @@ int fat32_boot_sector(disk_t *disk_car, partition_t *partition, const int verbos
#endif
log_info("\nfat32_boot_sector\n");
log_partition(disk_car,partition);
- aff_buffer(BUFFER_ADD,"Boot sector\n");
+ screen_buffer_add("Boot sector\n");
if(disk_car->read(disk_car,3*disk_car->sector_size, buffer_bs, partition->part_offset)!=0)
{
- aff_buffer(BUFFER_ADD,"fat32_boot_sector: Can't read boot sector.\n");
+ screen_buffer_add("fat32_boot_sector: Can't read boot sector.\n");
memset(buffer_bs,0,3*disk_car->sector_size);
}
if(test_FAT(disk_car,(struct fat_boot_sector *)buffer_bs,partition,verbose,0)==0)
{
- aff_buffer(BUFFER_ADD,"OK\n");
+ screen_buffer_add("OK\n");
if(partition->upart_type==UP_FAT32)
{
opt_O=1;
@@ -707,22 +707,22 @@ int fat32_boot_sector(disk_t *disk_car, partition_t *partition, const int verbos
}
else
{
- aff_buffer(BUFFER_ADD,"Warning: valid FAT bootsector but not a FAT32 one!");
+ screen_buffer_add("Warning: valid FAT bootsector but not a FAT32 one!");
}
}
else
{
- aff_buffer(BUFFER_ADD,"Bad\n");
+ screen_buffer_add("Bad\n");
}
- aff_buffer(BUFFER_ADD,"\nBackup boot sector\n");
+ screen_buffer_add("\nBackup boot sector\n");
if(disk_car->read(disk_car,3*disk_car->sector_size, buffer_backup_bs, partition->part_offset+6*disk_car->sector_size)!=0)
{
- aff_buffer(BUFFER_ADD,"fat32_boot_sector: Can't read backup boot sector.\n");
+ screen_buffer_add("fat32_boot_sector: Can't read backup boot sector.\n");
memset(buffer_backup_bs,0,3*disk_car->sector_size);
}
if(test_FAT(disk_car,(struct fat_boot_sector *)buffer_backup_bs,partition,verbose,0)==0)
{
- aff_buffer(BUFFER_ADD,"OK\n");
+ screen_buffer_add("OK\n");
if(partition->upart_type==UP_FAT32)
{
opt_B=1;
@@ -730,32 +730,32 @@ int fat32_boot_sector(disk_t *disk_car, partition_t *partition, const int verbos
}
else
{
- aff_buffer(BUFFER_ADD,"Warning: valid FAT backup bootsector but not a FAT32 one!");
+ screen_buffer_add("Warning: valid FAT backup bootsector but not a FAT32 one!");
}
}
else
{
- aff_buffer(BUFFER_ADD,"Bad\n");
+ screen_buffer_add("Bad\n");
}
- aff_buffer(BUFFER_ADD,"\n");
+ screen_buffer_add("\n");
if((memcmp(buffer_bs,buffer_backup_bs,0x3E8)==0)&&(memcmp(buffer_bs+0x3F0,buffer_backup_bs+0x3F0,0x600-0x3F0))==0)
{
- aff_buffer(BUFFER_ADD,"Sectors are identical.\n");
+ screen_buffer_add("Sectors are identical.\n");
opt_over=0;
}
else
{
if(memcmp(buffer_bs,buffer_backup_bs,0x200)!=0)
- aff_buffer(BUFFER_ADD,"First sectors (Boot code and partition information) are not identical.\n");
+ screen_buffer_add("First sectors (Boot code and partition information) are not identical.\n");
if((memcmp(buffer_bs+disk_car->sector_size, buffer_backup_bs+disk_car->sector_size,0x1E8)!=0)||
(memcmp(buffer_bs+disk_car->sector_size+0x1F0, buffer_backup_bs+disk_car->sector_size+0x1F0,0x200-0x1F0)!=0))
- aff_buffer(BUFFER_ADD,"Second sectors (cluster information) are not identical.\n");
+ screen_buffer_add("Second sectors (cluster information) are not identical.\n");
if(memcmp(buffer_bs+2*disk_car->sector_size, buffer_backup_bs+2*disk_car->sector_size,0x200)!=0)
- aff_buffer(BUFFER_ADD,"Third sectors (Second part of boot code) are not identical.\n");
+ screen_buffer_add("Third sectors (Second part of boot code) are not identical.\n");
}
- aff_buffer(BUFFER_ADD,"\n");
- aff_buffer(BUFFER_ADD,"A valid FAT Boot sector must be present in order to access\n");
- aff_buffer(BUFFER_ADD,"any data; even if the partition is not bootable.\n");
+ screen_buffer_add("\n");
+ screen_buffer_add("A valid FAT Boot sector must be present in order to access\n");
+ screen_buffer_add("any data; even if the partition is not bootable.\n");
if(opt_over!=0)
{
if(opt_B!=0 && opt_O!=0)
@@ -942,7 +942,7 @@ int ntfs_boot_sector(disk_t *disk_car, partition_t *partition, const int verbose
{
unsigned int menu=0;
int command;
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
if(rescan==1)
{
int identical_sectors=0;
@@ -958,52 +958,52 @@ int ntfs_boot_sector(disk_t *disk_car, partition_t *partition, const int verbose
#endif
log_info("\nntfs_boot_sector\n");
log_partition(disk_car,partition);
- aff_buffer(BUFFER_ADD,"Boot sector\n");
+ screen_buffer_add("Boot sector\n");
if(disk_car->read(disk_car,NTFS_BOOT_SECTOR_SIZE, buffer_bs, partition->part_offset)!=0)
{
- aff_buffer(BUFFER_ADD,"ntfs_boot_sector: Can't read boot sector.\n");
+ screen_buffer_add("ntfs_boot_sector: Can't read boot sector.\n");
memset(buffer_bs,0,NTFS_BOOT_SECTOR_SIZE);
}
if(test_NTFS(disk_car,(struct ntfs_boot_sector*)buffer_bs,partition,verbose,0)==0)
{
- aff_buffer(BUFFER_ADD,"Status: OK\n");
+ screen_buffer_add("Status: OK\n");
opt_O=1;
}
else
{
- aff_buffer(BUFFER_ADD,"Status: Bad\n");
+ screen_buffer_add("Status: Bad\n");
}
- aff_buffer(BUFFER_ADD,"\nBackup boot sector\n");
+ screen_buffer_add("\nBackup boot sector\n");
if(disk_car->read(disk_car,NTFS_BOOT_SECTOR_SIZE, buffer_backup_bs, partition->part_offset+partition->part_size-disk_car->sector_size)!=0)
{
- aff_buffer(BUFFER_ADD,"ntfs_boot_sector: Can't read backup boot sector.\n");
+ screen_buffer_add("ntfs_boot_sector: Can't read backup boot sector.\n");
memset(buffer_backup_bs,0,NTFS_BOOT_SECTOR_SIZE);
}
if(test_NTFS(disk_car,(struct ntfs_boot_sector*)buffer_backup_bs,partition,verbose,0)==0)
{
- aff_buffer(BUFFER_ADD,"Status: OK\n");
+ screen_buffer_add("Status: OK\n");
opt_B=1;
}
else
{
- aff_buffer(BUFFER_ADD,"Status: Bad\n");
+ screen_buffer_add("Status: Bad\n");
}
- aff_buffer(BUFFER_ADD,"\n");
+ screen_buffer_add("\n");
if(memcmp(buffer_bs,buffer_backup_bs,NTFS_BOOT_SECTOR_SIZE)==0)
{
log_ntfs_info((const struct ntfs_boot_sector *)buffer_bs);
- aff_buffer(BUFFER_ADD,"Sectors are identical.\n");
+ screen_buffer_add("Sectors are identical.\n");
identical_sectors=1;
}
else
{
log_ntfs2_info((const struct ntfs_boot_sector *)buffer_bs, (const struct ntfs_boot_sector *)buffer_backup_bs);
- aff_buffer(BUFFER_ADD,"Sectors are not identical.\n");
+ screen_buffer_add("Sectors are not identical.\n");
identical_sectors=0;
}
- aff_buffer(BUFFER_ADD,"\n");
- aff_buffer(BUFFER_ADD,"A valid NTFS Boot sector must be present in order to access\n");
- aff_buffer(BUFFER_ADD,"any data; even if the partition is not bootable.\n");
+ screen_buffer_add("\n");
+ screen_buffer_add("A valid NTFS Boot sector must be present in order to access\n");
+ screen_buffer_add("any data; even if the partition is not bootable.\n");
if(opt_B!=0 && opt_O!=0)
{
// options="DRMLU";
@@ -1188,7 +1188,7 @@ int HFS_HFSP_boot_sector(disk_t *disk_car, partition_t *partition, const int ver
{
unsigned int menu=0;
int command;
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
if(rescan==1)
{
int opt_over=0;
@@ -1205,55 +1205,55 @@ int HFS_HFSP_boot_sector(disk_t *disk_car, partition_t *partition, const int ver
#endif
log_info("\nHFS_HFSP_boot_sector\n");
log_partition(disk_car,partition);
- aff_buffer(BUFFER_ADD,"Volum header\n");
+ screen_buffer_add("Volume header\n");
if(disk_car->read(disk_car,HFSP_BOOT_SECTOR_SIZE, buffer_bs, partition->part_offset+0x400)!=0)
{
- aff_buffer(BUFFER_ADD,"Bad: can't read HFS/HFS+ volume header.\n");
+ screen_buffer_add("Bad: can't read HFS/HFS+ volume header.\n");
memset(buffer_bs,0,HFSP_BOOT_SECTOR_SIZE);
}
else if(test_HFSP(disk_car,(const struct hfsp_vh*)buffer_bs,partition,verbose,0)==0)
{
- aff_buffer(BUFFER_ADD,"HFS+ OK\n");
+ screen_buffer_add("HFS+ OK\n");
opt_O=1;
opt_over=1;
}
else if(test_HFS(disk_car,(const hfs_mdb_t*)buffer_bs,partition,verbose,0)==0)
{
- aff_buffer(BUFFER_ADD,"HFS Ok\n");
+ screen_buffer_add("HFS Ok\n");
opt_O=1;
opt_over=1;
}
else
- aff_buffer(BUFFER_ADD,"Bad\n");
- aff_buffer(BUFFER_ADD,"\nBackup volume header\n");
+ screen_buffer_add("Bad\n");
+ screen_buffer_add("\nBackup volume header\n");
if(disk_car->read(disk_car,HFSP_BOOT_SECTOR_SIZE, buffer_backup_bs, partition->part_offset+partition->part_size-0x400)!=0)
{
- aff_buffer(BUFFER_ADD,"Bad: can't read HFS/HFS+ backup volume header.\n");
+ screen_buffer_add("Bad: can't read HFS/HFS+ backup volume header.\n");
memset(buffer_backup_bs,0,HFSP_BOOT_SECTOR_SIZE);
}
else if(test_HFSP(disk_car,(const struct hfsp_vh*)buffer_backup_bs,partition,verbose,0)==0)
{
- aff_buffer(BUFFER_ADD,"HFS+ OK\n");
+ screen_buffer_add("HFS+ OK\n");
opt_B=1;
opt_over=1;
}
else if(test_HFS(disk_car,(const hfs_mdb_t*)buffer_backup_bs,partition,verbose,0)==0)
{
- aff_buffer(BUFFER_ADD,"HFS Ok\n");
+ screen_buffer_add("HFS Ok\n");
opt_B=1;
opt_over=1;
}
else
- aff_buffer(BUFFER_ADD,"Bad\n");
- aff_buffer(BUFFER_ADD,"\n");
+ screen_buffer_add("Bad\n");
+ screen_buffer_add("\n");
if(memcmp(buffer_bs,buffer_backup_bs,HFSP_BOOT_SECTOR_SIZE)==0)
{
- aff_buffer(BUFFER_ADD,"Sectors are identical.\n");
+ screen_buffer_add("Sectors are identical.\n");
opt_over=0;
}
else
{
- aff_buffer(BUFFER_ADD,"Sectors are not identical.\n");
+ screen_buffer_add("Sectors are not identical.\n");
}
if(opt_over!=0)
{
diff --git a/src/chgtype.c b/src/chgtype.c
index f4d25e5..8123124 100644
--- a/src/chgtype.c
+++ b/src/chgtype.c
@@ -2,7 +2,7 @@
File: chgtype.c
- Copyright (C) 1998-2005 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 1998-2008 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
@@ -91,14 +91,14 @@ static void change_part_type_ncurses(const disk_t *disk_car,partition_t *partiti
free(new_partition);
/* Display the list of partition type in 3 columns */
- aff_buffer(BUFFER_RESET,"Q");
- aff_buffer(BUFFER_ADD,"List of partition type\n");
+ screen_buffer_to_log();
+ screen_buffer_add("List of partition type\n");
for (i = 2; i >= 0; i--)
last[2 - i] = done += (size + i - done) / (i + 1);
i = done = 0;
while (done < last[0])
{
- aff_buffer(BUFFER_ADD, "%02x %-20s%c", part_name[next].index, part_name[next].name,(i==2 ? '\n' : ' '));
+ screen_buffer_add( "%02x %-20s%c", part_name[next].index, part_name[next].name,(i==2 ? '\n' : ' '));
next = last[i++] + done;
if (i > 2 || next >= last[i]) {
i = 0;
diff --git a/src/dirpart.c b/src/dirpart.c
index 8a79154..aae3514 100644
--- a/src/dirpart.c
+++ b/src/dirpart.c
@@ -2,7 +2,7 @@
File: dirpart.c
- Copyright (C) 1998-2006 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 1998-2008 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
@@ -110,14 +110,14 @@ int dir_partition(disk_t *disk_car, const partition_t *partition, const int verb
switch(res)
{
case -2:
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
#ifdef HAVE_NCURSES
aff_copy(window);
wmove(window,4,0);
aff_part(window,AFF_PART_ORDER|AFF_PART_STATUS,disk_car,partition);
#endif
log_partition(disk_car,partition);
- aff_buffer(BUFFER_ADD,"Support for this filesystem hasn't been enable during compilation.\n");
+ screen_buffer_add("Support for this filesystem hasn't been enable during compilation.\n");
screen_buffer_to_log();
if(*current_cmd==NULL)
{
@@ -127,14 +127,14 @@ int dir_partition(disk_t *disk_car, const partition_t *partition, const int verb
}
break;
case -1:
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
#ifdef HAVE_NCURSES
aff_copy(window);
wmove(window,4,0);
aff_part(window,AFF_PART_ORDER|AFF_PART_STATUS,disk_car,partition);
#endif
log_partition(disk_car,partition);
- aff_buffer(BUFFER_ADD,"Can't open filesystem. Filesystem seems damaged.\n");
+ screen_buffer_add("Can't open filesystem. Filesystem seems damaged.\n");
screen_buffer_to_log();
if(*current_cmd==NULL)
{
diff --git a/src/ext2p.c b/src/ext2p.c
index 8713bfd..4046ff8 100644
--- a/src/ext2p.c
+++ b/src/ext2p.c
@@ -2,7 +2,7 @@
File: ext2p.c
- Copyright (C) 2007 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 2007-2008 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
@@ -58,7 +58,7 @@ unsigned int ext2_remove_used_space(disk_t *disk_car,const partition_t *partitio
{
case -2:
case -1:
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
{
#ifdef HAVE_NCURSES
WINDOW *window;
@@ -68,7 +68,7 @@ unsigned int ext2_remove_used_space(disk_t *disk_car,const partition_t *partitio
aff_part(window,AFF_PART_ORDER|AFF_PART_STATUS,disk_car,partition);
#endif
log_partition(disk_car,partition);
- aff_buffer(BUFFER_ADD,"Can't open filesystem. Filesystem seems damaged.\n");
+ screen_buffer_add("Can't open filesystem. Filesystem seems damaged.\n");
screen_buffer_to_log();
#ifdef HAVE_NCURSES
screen_buffer_display(window,"",NULL);
diff --git a/src/fat.c b/src/fat.c
index 6f302f9..16827d9 100644
--- a/src/fat.c
+++ b/src/fat.c
@@ -284,7 +284,7 @@ int check_FAT(disk_t *disk_car,partition_t *partition,const int verbose)
buffer=MALLOC(3*disk_car->sector_size);
if(disk_car->read(disk_car,3*disk_car->sector_size, buffer, partition->part_offset)!=0)
{
- aff_buffer(BUFFER_ADD,"check_FAT: can't read FAT boot sector\n");
+ screen_buffer_add("check_FAT: can't read FAT boot sector\n");
log_error("check_FAT: can't read FAT boot sector\n");
free(buffer);
return 1;
@@ -301,7 +301,7 @@ int check_FAT(disk_t *disk_car,partition_t *partition,const int verbose)
return 1;
}
set_FAT_info(disk_car,(const struct fat_boot_sector *)buffer,partition,verbose);
- /* aff_buffer(BUFFER_ADD,"Ok\n"); */
+ /* screen_buffer_add("Ok\n"); */
free(buffer);
return 0;
}
@@ -541,13 +541,13 @@ int test_FAT(disk_t *disk_car,const struct fat_boot_sector *fat_header, partitio
#endif
if(!((fat_header->ignored[0]==0xeb && fat_header->ignored[2]==0x90)||fat_header->ignored[0]==0xe9))
{
- aff_buffer(BUFFER_ADD,msg_CHKFAT_BAD_JUMP);
+ screen_buffer_add(msg_CHKFAT_BAD_JUMP);
log_error(msg_CHKFAT_BAD_JUMP);
return 1;
}
if(fat_sector_size(fat_header)!=disk_car->sector_size)
{
- aff_buffer(BUFFER_ADD,"check_FAT: Incorrect number of bytes per sector %u (FAT) != %u (HD)\n",fat_sector_size(fat_header),disk_car->sector_size);
+ screen_buffer_add("check_FAT: Incorrect number of bytes per sector %u (FAT) != %u (HD)\n",fat_sector_size(fat_header),disk_car->sector_size);
log_error("check_FAT: Incorrect number of bytes per sector %u (FAT) != %u (HD)\n",fat_sector_size(fat_header),disk_car->sector_size);
return 1;
}
@@ -563,32 +563,32 @@ int test_FAT(disk_t *disk_car,const struct fat_boot_sector *fat_header, partitio
case 128:
break;
default:
- aff_buffer(BUFFER_ADD,msg_CHKFAT_SECT_CLUSTER);
+ screen_buffer_add(msg_CHKFAT_SECT_CLUSTER);
log_error(msg_CHKFAT_SECT_CLUSTER);
return 1;
}
switch(fat_header->fats)
{
case 1:
- aff_buffer(BUFFER_ADD,"check_FAT: Unusual, only one FAT\n");
+ screen_buffer_add("check_FAT: Unusual, only one FAT\n");
log_warning("check_FAT: Unusual, only one FAT\n");
break;
case 2:
break;
default:
- aff_buffer(BUFFER_ADD,"check_FAT: Bad number %u of FAT\n", fat_header->fats);
+ screen_buffer_add("check_FAT: Bad number %u of FAT\n", fat_header->fats);
log_error("check_FAT: Bad number %u of FAT\n", fat_header->fats);
return 1;
}
if(fat_header->media!=0xF0 && fat_header->media<0xF8)
{ /* Legal values are 0xF0, 0xF8-0xFF */
- aff_buffer(BUFFER_ADD,"check_FAT: Bad media descriptor (0x%2x!=0xf8)\n",fat_header->media);
+ screen_buffer_add("check_FAT: Bad media descriptor (0x%2x!=0xf8)\n",fat_header->media);
log_error("check_FAT: Bad media descriptor (0x%2x!=0xf8)\n",fat_header->media);
return 1;
}
if(fat_header->media!=0xF8)
{ /* the only value I have ever seen is 0xF8 */
- aff_buffer(BUFFER_ADD,"check_FAT: Unusual media descriptor (0x%2x!=0xf8)\n",fat_header->media);
+ screen_buffer_add("check_FAT: Unusual media descriptor (0x%2x!=0xf8)\n",fat_header->media);
log_warning("check_FAT: Unusual media descriptor (0x%2x!=0xf8)\n",fat_header->media);
}
fat_length=le16(fat_header->fat_length)>0?le16(fat_header->fat_length):le32(fat_header->fat32_length);
@@ -614,23 +614,23 @@ int test_FAT(disk_t *disk_car,const struct fat_boot_sector *fat_header, partitio
}
if(sectors(fat_header)==0)
{
- aff_buffer(BUFFER_ADD,msg_CHKFAT_SIZE);
+ screen_buffer_add(msg_CHKFAT_SIZE);
log_error(msg_CHKFAT_SIZE);
}
if(le16(fat_header->reserved)!=1)
{
- aff_buffer(BUFFER_ADD,"check_FAT: Unusual number of reserved sectors %u (FAT), should be 1.\n",le16(fat_header->reserved));
+ screen_buffer_add("check_FAT: Unusual number of reserved sectors %u (FAT), should be 1.\n",le16(fat_header->reserved));
log_warning("check_FAT: Unusual number of reserved sectors %u (FAT), should be 1.\n",le16(fat_header->reserved));
}
if((get_dir_entries(fat_header)==0)||(get_dir_entries(fat_header)%16!=0))
{
- aff_buffer(BUFFER_ADD,msg_CHKFAT_ENTRY);
+ screen_buffer_add(msg_CHKFAT_ENTRY);
log_error(msg_CHKFAT_ENTRY);
return 1;
}
if((le16(fat_header->fat_length)>256)||(le16(fat_header->fat_length)==0))
{
- aff_buffer(BUFFER_ADD,msg_CHKFAT_SECTPFAT);
+ screen_buffer_add(msg_CHKFAT_SECTPFAT);
log_error(msg_CHKFAT_SECTPFAT);
return 1;
}
@@ -639,7 +639,7 @@ int test_FAT(disk_t *disk_car,const struct fat_boot_sector *fat_header, partitio
partition->upart_type=UP_FAT12;
if(memcmp(buffer+FAT_NAME1,"FAT12 ",8)!=0) /* 2 Mo max */
{
- aff_buffer(BUFFER_ADD,"Should be marked as FAT12\n");
+ screen_buffer_add("Should be marked as FAT12\n");
log_warning("Should be marked as FAT12\n");
}
}
@@ -655,18 +655,18 @@ int test_FAT(disk_t *disk_car,const struct fat_boot_sector *fat_header, partitio
}
if(le16(fat_header->reserved)!=1)
{
- aff_buffer(BUFFER_ADD,"check_FAT: Unusual number of reserved sectors %u (FAT), should be 1.\n",le16(fat_header->reserved));
+ screen_buffer_add("check_FAT: Unusual number of reserved sectors %u (FAT), should be 1.\n",le16(fat_header->reserved));
log_warning("check_FAT: Unusual number of reserved sectors %u (FAT), should be 1.\n",le16(fat_header->reserved));
}
if(le16(fat_header->fat_length)==0)
{
- aff_buffer(BUFFER_ADD,msg_CHKFAT_SECTPFAT);
+ screen_buffer_add(msg_CHKFAT_SECTPFAT);
log_error(msg_CHKFAT_SECTPFAT);
return 1;
}
if((get_dir_entries(fat_header)==0)||(get_dir_entries(fat_header)%16!=0))
{
- aff_buffer(BUFFER_ADD,msg_CHKFAT_ENTRY);
+ screen_buffer_add(msg_CHKFAT_ENTRY);
log_error(msg_CHKFAT_ENTRY);
return 1;
}
@@ -675,7 +675,7 @@ int test_FAT(disk_t *disk_car,const struct fat_boot_sector *fat_header, partitio
partition->upart_type=UP_FAT16;
if(memcmp(buffer+FAT_NAME1,"FAT16 ",8)!=0)
{
- aff_buffer(BUFFER_ADD,"Should be marked as FAT16\n");
+ screen_buffer_add("Should be marked as FAT16\n");
log_warning("Should be marked as FAT16\n");
}
}
@@ -691,24 +691,24 @@ int test_FAT(disk_t *disk_car,const struct fat_boot_sector *fat_header, partitio
}
if(sectors(fat_header)!=0)
{
- aff_buffer(BUFFER_ADD,msg_CHKFAT_SIZE);
+ screen_buffer_add(msg_CHKFAT_SIZE);
log_error(msg_CHKFAT_SIZE);
return 1;
}
if(get_dir_entries(fat_header)!=0)
{
- aff_buffer(BUFFER_ADD,msg_CHKFAT_ENTRY);
+ screen_buffer_add(msg_CHKFAT_ENTRY);
log_error(msg_CHKFAT_ENTRY);
return 1;
}
if((fat_header->version[0]!=0) || (fat_header->version[1]!=0))
{
- aff_buffer(BUFFER_ADD,msg_CHKFAT_BADFAT32VERSION);
+ screen_buffer_add(msg_CHKFAT_BADFAT32VERSION);
log_error(msg_CHKFAT_BADFAT32VERSION);
}
if((le32(fat_header->root_cluster)<2) ||(le32(fat_header->root_cluster)>=2+no_of_cluster))
{
- aff_buffer(BUFFER_ADD,"Bad root_cluster\n");
+ screen_buffer_add("Bad root_cluster\n");
log_error("Bad root_cluster\n");
return 1;
}
@@ -717,7 +717,7 @@ int test_FAT(disk_t *disk_car,const struct fat_boot_sector *fat_header, partitio
partition->upart_type=UP_FAT32;
if(memcmp(buffer+FAT_NAME2,"FAT32 ",8)!=0)
{
- aff_buffer(BUFFER_ADD,"Should be marked as FAT32\n");
+ screen_buffer_add("Should be marked as FAT32\n");
log_warning("Should be marked as FAT32\n");
}
}
@@ -725,7 +725,7 @@ int test_FAT(disk_t *disk_car,const struct fat_boot_sector *fat_header, partitio
{
if(part_size > partition->part_size/disk_car->sector_size)
{
- aff_buffer(BUFFER_ADD, "Error: size boot_sector %lu > partition %lu\n",
+ screen_buffer_add( "Error: size boot_sector %lu > partition %lu\n",
(long unsigned)part_size,
(long unsigned)(partition->part_size/disk_car->sector_size));
log_error("test_FAT size boot_sector %lu > partition %lu\n",
@@ -756,19 +756,19 @@ int test_FAT(disk_t *disk_car,const struct fat_boot_sector *fat_header, partitio
}
if(fat_length<fat_length_calc)
{
- aff_buffer(BUFFER_ADD,msg_CHKFAT_SECTPFAT);
+ screen_buffer_add(msg_CHKFAT_SECTPFAT);
return 1;
}
if(fat_header->fats>1)
comp_FAT(disk_car,partition,fat_length,le16(fat_header->reserved));
if(le16(fat_header->heads)!=disk_car->CHS.head+1)
{
- aff_buffer(BUFFER_ADD,"Warning: Incorrect number of heads/cylinder %u (FAT) != %u (HD)\n",le16(fat_header->heads),disk_car->CHS.head+1);
+ screen_buffer_add("Warning: Incorrect number of heads/cylinder %u (FAT) != %u (HD)\n",le16(fat_header->heads),disk_car->CHS.head+1);
log_warning("heads/cylinder %u (FAT) != %u (HD)\n",le16(fat_header->heads),disk_car->CHS.head+1);
}
if(le16(fat_header->secs_track)!=disk_car->CHS.sector)
{
- aff_buffer(BUFFER_ADD,"Warning: Incorrect number of sectors per track %u (FAT) != %u (HD)\n",le16(fat_header->secs_track),disk_car->CHS.sector);
+ screen_buffer_add("Warning: Incorrect number of sectors per track %u (FAT) != %u (HD)\n",le16(fat_header->secs_track),disk_car->CHS.sector);
log_warning("sect/track %u (FAT) != %u (HD)\n",le16(fat_header->secs_track),disk_car->CHS.sector);
}
return 0;
@@ -955,7 +955,7 @@ int check_HPFS(disk_t *disk_car,partition_t *partition,const int verbose)
unsigned char buffer[512];
if(disk_car->read(disk_car,disk_car->sector_size, &buffer, partition->part_offset)!=0)
{
- aff_buffer(BUFFER_ADD,"check_HPFS: Read error\n");
+ screen_buffer_add("check_HPFS: Read error\n");
log_error("check_HPFS: Read error\n");
return 1;
}
@@ -1016,7 +1016,7 @@ int check_OS2MB(disk_t *disk_car,partition_t *partition,const int verbose)
unsigned char buffer[0x200];
if(disk_car->read(disk_car,disk_car->sector_size, &buffer, partition->part_offset)!=0)
{
- aff_buffer(BUFFER_ADD,"check_OS2MB: Read error\n");
+ screen_buffer_add("check_OS2MB: Read error\n");
log_error("check_OS2MB: Read error\n");
return 1;
}
diff --git a/src/fat_adv.c b/src/fat_adv.c
index 55076fa..cd06579 100644
--- a/src/fat_adv.c
+++ b/src/fat_adv.c
@@ -1774,13 +1774,13 @@ static upart_type_t select_fat_info(const info_offset_t *info_offset, const unsi
{ 'Q', "Proceed","Set FAT table location"},
{ 0, NULL, NULL }
};
- aff_buffer(BUFFER_RESET,"Q");
- aff_buffer(BUFFER_ADD,"Potential FAT location\n");
- aff_buffer(BUFFER_ADD,"FAT - sector - score\n");
+ screen_buffer_to_log();
+ screen_buffer_add("Potential FAT location\n");
+ screen_buffer_add("FAT - sector - score\n");
for(i=0;i<nbr_offset;i++)
{
if(nbr_offset<30 || info_offset[i].nbr>1)
- aff_buffer(BUFFER_ADD," %02d %8lu %u\n",info_offset[i].fat_type,info_offset[i].offset,info_offset[i].nbr);
+ screen_buffer_add(" %02d %8lu %u\n",info_offset[i].fat_type,info_offset[i].offset,info_offset[i].nbr);
if(info_offset[i].fat_type<32)
{
reserved_can_be_one=1;
diff --git a/src/godmode.c b/src/godmode.c
index 94b88b2..ed6cb21 100644
--- a/src/godmode.c
+++ b/src/godmode.c
@@ -407,7 +407,7 @@ static list_part_t *search_part(disk_t *disk_car, const list_part_t *list_part_o
wattroff(stdscr, A_REVERSE);
}
#endif
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
log_info("\nsearch_part()\n");
log_info("%s\n",disk_car->description(disk_car));
if(disk_car->arch==&arch_gpt)
@@ -666,7 +666,7 @@ static list_part_t *search_part(disk_t *disk_car, const list_part_t *list_part_o
aff_part_buffer(AFF_PART_BASE, disk_car,partition);
if(interface)
{
- aff_buffer(BUFFER_SHOW,"Q");
+ screen_buffer_to_interface();
}
if(disk_car->arch->is_part_known(partition)!=0 &&
partition->part_size>1 &&
diff --git a/src/intrf.c b/src/intrf.c
index 1974791..6303f24 100644
--- a/src/intrf.c
+++ b/src/intrf.c
@@ -93,86 +93,80 @@ struct file_info {
struct stat stat;
};
-
-int aff_buffer(const buffer_cmd_t cmd, const char *_format, ...)
+int screen_buffer_add(const char *_format, ...)
{
- switch(cmd)
+ char tmp_line[BUFFER_LINE_LENGTH+1];
+ char *pos_in_tmp_line=tmp_line;
+ va_list ap;
+ va_start(ap,_format);
+ memset(tmp_line,'\0',sizeof(tmp_line));
+ vsnprintf(tmp_line,BUFFER_LINE_LENGTH,_format,ap);
+ va_end(ap);
+ while(pos_in_tmp_line!=NULL && (intr_nbr_line<MAX_LINES))
{
- case BUFFER_RESET:
- {
- int i;
- intr_nbr_line=0;
- for(i=0;i<MAX_LINES;i++)
- memset(intr_buffer_screen[i],0,LINE_LENGTH+1);
- }
- break;
- case BUFFER_ADD:
- {
- char tmp_line[BUFFER_LINE_LENGTH+1];
- char *pos_in_tmp_line=tmp_line;
- va_list ap;
- va_start(ap,_format);
- memset(tmp_line,'\0',sizeof(tmp_line));
- vsnprintf(tmp_line,BUFFER_LINE_LENGTH,_format,ap);
- va_end(ap);
- while(pos_in_tmp_line!=NULL && (intr_nbr_line<MAX_LINES))
- {
- unsigned int len=strlen(intr_buffer_screen[intr_nbr_line]);
- unsigned int nbr=LINE_LENGTH-len;
- char *ret_ligne= strchr(pos_in_tmp_line,'\n');
- if(ret_ligne!=NULL && ret_ligne-pos_in_tmp_line < nbr)
- nbr=ret_ligne-pos_in_tmp_line;
- memcpy(&intr_buffer_screen[intr_nbr_line][len], pos_in_tmp_line, nbr);
- intr_buffer_screen[intr_nbr_line][len+nbr]='\0';
- if(ret_ligne!=NULL)
- {
- if(++intr_nbr_line<MAX_LINES)
- intr_buffer_screen[intr_nbr_line][0]='\0';
- ret_ligne++;
- }
- pos_in_tmp_line=ret_ligne;
- }
- /* log_trace("aff_intr_buffer_screen %d =>%s<=\n",intr_nbr_line,tmp_line); */
- if(intr_nbr_line==MAX_LINES)
- {
- log_warning("Buffer can't store more than %u lines.\n", MAX_LINES);
- intr_nbr_line++;
- }
- }
- break;
- case BUFFER_SHOW:
+ unsigned int len=strlen(intr_buffer_screen[intr_nbr_line]);
+ unsigned int nbr=LINE_LENGTH-len;
+ char *ret_ligne= strchr(pos_in_tmp_line,'\n');
+ if(ret_ligne!=NULL && ret_ligne-pos_in_tmp_line < nbr)
+ nbr=ret_ligne-pos_in_tmp_line;
+ memcpy(&intr_buffer_screen[intr_nbr_line][len], pos_in_tmp_line, nbr);
+ intr_buffer_screen[intr_nbr_line][len+nbr]='\0';
+ if(ret_ligne!=NULL)
+ {
+ if(++intr_nbr_line<MAX_LINES)
+ intr_buffer_screen[intr_nbr_line][0]='\0';
+ ret_ligne++;
+ }
+ pos_in_tmp_line=ret_ligne;
+ }
+ /* log_trace("aff_intr_buffer_screen %d =>%s<=\n",intr_nbr_line,tmp_line); */
+ if(intr_nbr_line==MAX_LINES)
+ {
+ log_warning("Buffer can't store more than %u lines.\n", MAX_LINES);
+ intr_nbr_line++;
+ }
+ return 0;
+}
+
+void screen_buffer_to_interface()
+{
#ifdef HAVE_NCURSES
- {
- int i;
- int pos=intr_nbr_line-DUMP_MAX_LINES<0?0:intr_nbr_line-DUMP_MAX_LINES;
- if(intr_nbr_line<MAX_LINES && intr_buffer_screen[intr_nbr_line][0]!='\0')
- intr_nbr_line++;
- /* curses interface */
- for (i=pos; i<intr_nbr_line && i<MAX_LINES && (i-pos)<DUMP_MAX_LINES; i++)
- {
- wmove(stdscr,DUMP_Y+1+i-pos,DUMP_X);
- wclrtoeol(stdscr);
- wprintw(stdscr,"%s",intr_buffer_screen[i]);
- }
- wrefresh(stdscr);
- }
+ {
+ int i;
+ int pos=intr_nbr_line-DUMP_MAX_LINES<0?0:intr_nbr_line-DUMP_MAX_LINES;
+ if(intr_nbr_line<MAX_LINES && intr_buffer_screen[intr_nbr_line][0]!='\0')
+ intr_nbr_line++;
+ /* curses interface */
+ for (i=pos; i<intr_nbr_line && i<MAX_LINES && (i-pos)<DUMP_MAX_LINES; i++)
+ {
+ wmove(stdscr,DUMP_Y+1+i-pos,DUMP_X);
+ wclrtoeol(stdscr);
+ wprintw(stdscr,"%s",intr_buffer_screen[i]);
+ }
+ wrefresh(stdscr);
+ }
#endif
- break;
- case BUFFER_WRITE:
- {
- int i;
- if(intr_nbr_line<MAX_LINES && intr_buffer_screen[intr_nbr_line][0]!='\0')
- intr_nbr_line++;
- /* to log file and stdout */
- for(i=0;i<intr_nbr_line && i<MAX_LINES;i++)
- {
- printf("%s\n",intr_buffer_screen[i]);
- log_info("%s\n",intr_buffer_screen[i]);
- }
- }
- break;
+}
+
+void screen_buffer_to_stdout()
+{
+ int i;
+ if(intr_nbr_line<MAX_LINES && intr_buffer_screen[intr_nbr_line][0]!='\0')
+ intr_nbr_line++;
+ /* to log file and stdout */
+ for(i=0;i<intr_nbr_line && i<MAX_LINES;i++)
+ {
+ printf("%s\n",intr_buffer_screen[i]);
+ log_info("%s\n",intr_buffer_screen[i]);
}
- return 0;
+}
+
+void screen_buffer_reset()
+{
+ int i;
+ intr_nbr_line=0;
+ for(i=0;i<MAX_LINES;i++)
+ memset(intr_buffer_screen[i],0,LINE_LENGTH+1);
}
void screen_buffer_to_log()
@@ -1042,7 +1036,7 @@ void aff_CHS(const CHS_t * CHS)
void aff_CHS_buffer(const CHS_t * CHS)
{
- aff_buffer(BUFFER_ADD,"%5u %3u %2u ", CHS->cylinder, CHS->head, CHS->sector);
+ screen_buffer_add("%5u %3u %2u ", CHS->cylinder, CHS->head, CHS->sector);
}
void aff_part(WINDOW *window,const unsigned int newline,const disk_t *disk_car,const partition_t *partition)
@@ -1286,10 +1280,13 @@ int end_ncurses()
wrefresh(stdscr);
nl();
endwin();
+#if defined(DJGPP) || defined(__MINGW32__)
+#else
#ifdef HAVE_DELSCREEN
if(screenp!=NULL)
delscreen(screenp);
#endif
+#endif
return 0;
}
@@ -1916,7 +1913,7 @@ void aff_part_buffer(const unsigned int newline,const disk_t *disk_car,const par
{
const char *msg;
msg=aff_part_aux(newline, disk_car, partition);
- aff_buffer(BUFFER_ADD,"%s\n", msg);
+ screen_buffer_add("%s\n", msg);
}
void log_CHS_from_LBA(const disk_t *disk_car, const unsigned long int pos_LBA)
diff --git a/src/intrf.h b/src/intrf.h
index 0559817..56e500e 100644
--- a/src/intrf.h
+++ b/src/intrf.h
@@ -2,7 +2,7 @@
File: intrf.h
- Copyright (C) 1998-2007 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 1998-2008 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
@@ -20,7 +20,6 @@
*/
-enum buffer_cmd {BUFFER_RESET, BUFFER_ADD, BUFFER_WRITE,BUFFER_SHOW};
typedef enum buffer_cmd buffer_cmd_t;
struct MenuItem
@@ -73,9 +72,6 @@ struct MenuItem
/* '\014' == ^L */
#define key_REDRAWKEY '\014'
-
-/* int aff_buffer(const int cmd, const char *_format, ...) __attribute__ ((format (printf, 2, 3))); */
-int aff_buffer(const buffer_cmd_t cmd, const char *_format, ...);
void aff_CHS(const CHS_t * CHS);
void aff_CHS_buffer(const CHS_t * CHS);
void aff_LBA2CHS(const disk_t *disk_car, const unsigned long int pos_LBA);
@@ -90,7 +86,11 @@ int display_message_aux(const char*_format,...) __attribute__ ((format (printf,
int display_message(const char*msg);
int get_string(char *str, int len, char *def);
void not_implemented(const char *msg);
+void screen_buffer_reset(void);
+int screen_buffer_add(const char *_format, ...) __attribute__ ((format (printf, 1, 2)));
void screen_buffer_to_log(void);
+void screen_buffer_to_interface(void);
+void screen_buffer_to_stdout(void);
int interface_partition_type(disk_t *disk_car, const int verbose, char**current_cmd);
int intrf_no_disk(const char *prog_name);
char *ask_log_location(const char*filename);
diff --git a/src/intrface.c b/src/intrface.c
index c0384f6..211f611 100644
--- a/src/intrface.c
+++ b/src/intrface.c
@@ -91,7 +91,7 @@ void interface_list(disk_t *disk_car, const int verbose, const int saveheader, c
printf("%s\n",disk_car->description(disk_car));
printf(msg_PART_HEADER_LONG);
list_part=disk_car->arch->read_part(disk_car,verbose,saveheader);
- aff_buffer(BUFFER_WRITE,"Q");
+ screen_buffer_to_stdout();
if(backup>0)
{
partition_save(disk_car,list_part,verbose);
@@ -707,7 +707,7 @@ static list_part_t *interface_analyse_ncurses(disk_t *disk_car, const int verbos
{ 'B', "Backup","Save current partition list to backup.log file and proceed"},
{ 0, NULL, NULL }
};
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
/* ncurses interface */
#ifdef HAVE_NCURSES
aff_copy(stdscr);
@@ -782,7 +782,7 @@ int interface_write(disk_t *disk_car,list_part_t *list_part,const int can_search
};
int command;
log_info("\ninterface_write()\n");
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
#ifdef HAVE_NCURSES
aff_copy(stdscr);
wmove(stdscr,4,0);
@@ -799,7 +799,7 @@ int interface_write(disk_t *disk_car,list_part_t *list_part,const int can_search
command='Q';
if(list_part==NULL)
{
- aff_buffer(BUFFER_ADD," \nNo partition found or selected for recovery");
+ screen_buffer_add(" \nNo partition found or selected for recovery");
screen_buffer_to_log();
if(*current_cmd!=NULL)
{
@@ -858,7 +858,7 @@ int interface_write(disk_t *disk_car,list_part_t *list_part,const int can_search
if(disk_car->arch->write_part!=NULL)
strcat(options,"W");
else
- aff_buffer(BUFFER_ADD," \nWrite isn't available because the partition table type \"%s\" has been selected.",
+ screen_buffer_add(" \nWrite isn't available because the partition table type \"%s\" has been selected.",
disk_car->arch->part_name);
if(can_ask_minmax_ext)
strcat(options,"E");
@@ -1494,7 +1494,7 @@ int interface_superblock(disk_t *disk_car,list_part_t *list_part, char**current_
{ 'Q',"Quit","Return to Advanced menu"},
{ 0, NULL, NULL }
};
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
#ifdef HAVE_NCURSES
aff_copy(stdscr);
wmove(stdscr,4,0);
@@ -1518,7 +1518,7 @@ int interface_superblock(disk_t *disk_car,list_part_t *list_part, char**current_
old_part=partition;
}
if(partition->blocksize!=0)
- aff_buffer(BUFFER_ADD,"superblock %lu, blocksize=%u\n",
+ screen_buffer_add("superblock %lu, blocksize=%u\n",
(long unsigned)(partition->sb_offset/partition->blocksize),
partition->blocksize);
}
diff --git a/src/ntfs.c b/src/ntfs.c
index 8b6be40..2e2fcc7 100644
--- a/src/ntfs.c
+++ b/src/ntfs.c
@@ -142,17 +142,17 @@ int test_NTFS(const disk_t *disk_car,const struct ntfs_boot_sector*ntfs_header,
}
if(le16(ntfs_header->heads)!=disk_car->CHS.head+1)
{
- aff_buffer(BUFFER_ADD,"Warning: Incorrect number of heads/cylinder %u (NTFS) != %u (HD)\n",le16(ntfs_header->heads),disk_car->CHS.head+1);
+ screen_buffer_add("Warning: Incorrect number of heads/cylinder %u (NTFS) != %u (HD)\n",le16(ntfs_header->heads),disk_car->CHS.head+1);
log_warning("heads/cylinder %u (NTFS) != %u (HD)\n",le16(ntfs_header->heads),disk_car->CHS.head+1);
}
if(le16(ntfs_header->secs_track)!=disk_car->CHS.sector)
{
- aff_buffer(BUFFER_ADD,"Warning: Incorrect number of sectors per track %u (NTFS) != %u (HD)\n",le16(ntfs_header->secs_track),disk_car->CHS.sector);
+ screen_buffer_add("Warning: Incorrect number of sectors per track %u (NTFS) != %u (HD)\n",le16(ntfs_header->secs_track),disk_car->CHS.sector);
log_warning("sect/track %u (NTFS) != %u (HD)\n",le16(ntfs_header->secs_track),disk_car->CHS.sector);
}
if(ntfs_sector_size(ntfs_header)!=disk_car->sector_size)
{
- aff_buffer(BUFFER_ADD,"Warning: Incorrect number of bytes per sector %u (NTFS) != %u (HD)\n",ntfs_sector_size(ntfs_header),disk_car->sector_size);
+ screen_buffer_add("Warning: Incorrect number of bytes per sector %u (NTFS) != %u (HD)\n",ntfs_sector_size(ntfs_header),disk_car->sector_size);
log_warning("Warning: Incorrect number of bytes per sector %u (NTFS) != %u (HD)\n",ntfs_sector_size(ntfs_header),disk_car->sector_size);
}
@@ -163,7 +163,7 @@ int test_NTFS(const disk_t *disk_car,const struct ntfs_boot_sector*ntfs_header,
if(part_size*ntfs_sector_size(ntfs_header)>partition->part_size)
{
- aff_buffer(BUFFER_ADD,"Error: size boot_sector %lu > partition %lu\n",(long unsigned)part_size,(long unsigned)(partition->part_size/disk_car->sector_size));
+ screen_buffer_add("Error: size boot_sector %lu > partition %lu\n",(long unsigned)part_size,(long unsigned)(partition->part_size/disk_car->sector_size));
log_error("Error: size boot_sector %lu > partition %lu\n",(long unsigned)part_size,(long unsigned)(partition->part_size/disk_car->sector_size));
return 1;
}
@@ -186,9 +186,9 @@ int ntfs_get_attr(const char *mft_record, const int my_type, partition_t *partit
return 2;
if(NTFS_GETU16(mft_record + 0x14)<42) /* sizeof(MFT_RECORD)>=42 */
return 2;
- /* aff_buffer(BUFFER_ADD,"FILE\n"); */
- /* aff_buffer(BUFFER_ADD,"seq nbr %lu ",NTFS_GETU16(mft_record+0x10)); */
- /* aff_buffer(BUFFER_ADD,"main MFT record %lu ",NTFS_GETU64(mft_record+0x20)); */
+ /* screen_buffer_add("FILE\n"); */
+ /* screen_buffer_add("seq nbr %lu ",NTFS_GETU16(mft_record+0x10)); */
+ /* screen_buffer_add("main MFT record %lu ",NTFS_GETU64(mft_record+0x20)); */
/* location of first attribute */
attr_record= mft_record + NTFS_GETU16(mft_record + 0x14);
return ntfs_get_attr_aux(attr_record, my_type, partition, end, verbose, dump_ind, file_name_to_find);
@@ -270,7 +270,7 @@ static int ntfs_get_attr_aux(const char *attr_record, const int my_type, partiti
{
char file_name[256+1]; /* used size is file_name_length+1 */
unsigned int i;
- /* aff_buffer(BUFFER_ADD,"MFT record nbr %lu ",NTFS_GETU64(file_name_attr)); */
+ /* screen_buffer_add("MFT record nbr %lu ",NTFS_GETU64(file_name_attr)); */
for(name_it=file_name_attr+0x42,i=0;i<file_name_length; name_it+=2,i++)
file_name[i]=*name_it;
file_name[i]='\0';
@@ -288,7 +288,7 @@ static int ntfs_get_attr_aux(const char *attr_record, const int my_type, partiti
return 2;
}
} else
- aff_buffer(BUFFER_ADD,"%s\n",file_name);
+ screen_buffer_add("%s\n",file_name);
}
}
break;
diff --git a/src/ntfsp.c b/src/ntfsp.c
index 4366f93..7652ff1 100644
--- a/src/ntfsp.c
+++ b/src/ntfsp.c
@@ -2,7 +2,7 @@
File: ntfsp.c
- Copyright (C) 2007 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 2007-2008 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
@@ -60,7 +60,7 @@ unsigned int ntfs_remove_used_space(disk_t *disk_car,const partition_t *partitio
{
case -2:
case -1:
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
{
#ifdef HAVE_NCURSES
WINDOW *window;
@@ -70,7 +70,7 @@ unsigned int ntfs_remove_used_space(disk_t *disk_car,const partition_t *partitio
aff_part(window,AFF_PART_ORDER|AFF_PART_STATUS,disk_car,partition);
#endif
log_partition(disk_car,partition);
- aff_buffer(BUFFER_ADD,"Can't open filesystem. Filesystem seems damaged.\n");
+ screen_buffer_add("Can't open filesystem. Filesystem seems damaged.\n");
screen_buffer_to_log();
#ifdef HAVE_NCURSES
screen_buffer_display(window,"",NULL);
diff --git a/src/partgpt.c b/src/partgpt.c
index 59e9161..c94ac13 100644
--- a/src/partgpt.c
+++ b/src/partgpt.c
@@ -171,7 +171,7 @@ list_part_t *read_part_gpt(disk_t *disk_car, const int verbose, const int savehe
uint64_t gpt_entries_offset;
gpt=(struct gpt_hdr*)MALLOC(disk_car->sector_size);
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
if(disk_car->read(disk_car, disk_car->sector_size, gpt, disk_car->sector_size)!=0)
{
free(gpt);
@@ -179,7 +179,7 @@ list_part_t *read_part_gpt(disk_t *disk_car, const int verbose, const int savehe
}
if(memcmp(gpt->hdr_sig, GPT_HDR_SIG, 8)!=0)
{
- aff_buffer(BUFFER_ADD,"Bad GPT partition, invalid signature.\n");
+ screen_buffer_add("Bad GPT partition, invalid signature.\n");
free(gpt);
return NULL;
}
@@ -197,7 +197,7 @@ list_part_t *read_part_gpt(disk_t *disk_car, const int verbose, const int savehe
/* Check header size */
if(le32(gpt->hdr_size)<92 || le32(gpt->hdr_size) > disk_car->sector_size)
{
- aff_buffer(BUFFER_ADD,"GPT: invalid header size.\n");
+ screen_buffer_add("GPT: invalid header size.\n");
free(gpt);
return NULL;
}
@@ -209,7 +209,7 @@ list_part_t *read_part_gpt(disk_t *disk_car, const int verbose, const int savehe
crc=get_crc32(gpt, le32(gpt->hdr_size), 0xFFFFFFFF)^0xFFFFFFFF;
if(crc!=origcrc)
{
- aff_buffer(BUFFER_ADD,"Bad GPT partition, invalid header checksum.\n");
+ screen_buffer_add("Bad GPT partition, invalid header checksum.\n");
free(gpt);
return NULL;
}
@@ -217,27 +217,27 @@ list_part_t *read_part_gpt(disk_t *disk_car, const int verbose, const int savehe
}
if(le64(gpt->hdr_lba_self)!=1)
{
- aff_buffer(BUFFER_ADD,"Bad GPT partition, invalid LBA self location.\n");
+ screen_buffer_add("Bad GPT partition, invalid LBA self location.\n");
free(gpt);
return NULL;
}
if(le64(gpt->hdr_lba_start) >= le64(gpt->hdr_lba_end))
{
- aff_buffer(BUFFER_ADD,"Bad GPT partition, invalid LBA start/end location.\n");
+ screen_buffer_add("Bad GPT partition, invalid LBA start/end location.\n");
free(gpt);
return NULL;
}
if(le32(gpt->hdr_revision)!=GPT_HDR_REVISION)
{
- aff_buffer(BUFFER_ADD,"GPT: Warning - not revision 1.0\n");
+ screen_buffer_add("GPT: Warning - not revision 1.0\n");
}
if(le32(gpt->__reserved)!=0)
{
- aff_buffer(BUFFER_ADD,"GPT: Warning - __reserved!=0\n");
+ screen_buffer_add("GPT: Warning - __reserved!=0\n");
}
if(le32(gpt->hdr_entries)==0 || le32(gpt->hdr_entries)>4096)
{
- aff_buffer(BUFFER_ADD,"GPT: invalid number (%u) of partition entries.\n",
+ screen_buffer_add("GPT: invalid number (%u) of partition entries.\n",
(unsigned int)le32(gpt->hdr_entries));
free(gpt);
return NULL;
@@ -245,7 +245,7 @@ list_part_t *read_part_gpt(disk_t *disk_car, const int verbose, const int savehe
/* le32(gpt->hdr_entsz)==128 */
if(le32(gpt->hdr_entsz)%8!=0 || le32(gpt->hdr_entsz)<128 || le32(gpt->hdr_entsz)>4096)
{
- aff_buffer(BUFFER_ADD,"GPT: invalid partition entry size.\n");
+ screen_buffer_add("GPT: invalid partition entry size.\n");
free(gpt);
return NULL;
}
@@ -253,7 +253,7 @@ list_part_t *read_part_gpt(disk_t *disk_car, const int verbose, const int savehe
gpt_entries_size=le32(gpt->hdr_entries) * le32(gpt->hdr_entsz);
if(gpt_entries_size<16384)
{
- aff_buffer(BUFFER_ADD,"GPT: A minimum of 16,384 bytes of space must be reserved for the GUID Partition Entry array.\n");
+ screen_buffer_add("GPT: A minimum of 16,384 bytes of space must be reserved for the GUID Partition Entry array.\n");
free(gpt);
return NULL;
}
@@ -261,7 +261,7 @@ list_part_t *read_part_gpt(disk_t *disk_car, const int verbose, const int savehe
if((uint64_t) le64(gpt->hdr_lba_self) + le32(gpt->hdr_size) - 1 >= gpt_entries_offset ||
gpt_entries_offset >= le64(gpt->hdr_lba_start) * disk_car->sector_size)
{
- aff_buffer(BUFFER_ADD, "GPT: The primary GUID Partition Entry array must be located after the primary GUID Partition Table Header and end before the FirstUsableLBA.\n");
+ screen_buffer_add( "GPT: The primary GUID Partition Entry array must be located after the primary GUID Partition Table Header and end before the FirstUsableLBA.\n");
free(gpt);
return NULL;
}
@@ -278,7 +278,7 @@ list_part_t *read_part_gpt(disk_t *disk_car, const int verbose, const int savehe
crc=get_crc32(gpt_entries, gpt_entries_size, 0xFFFFFFFF)^0xFFFFFFFF;
if(crc!=le32(gpt->hdr_crc_table))
{
- aff_buffer(BUFFER_ADD,"Bad GPT partition entries, invalid checksum.\n");
+ screen_buffer_add("Bad GPT partition entries, invalid checksum.\n");
free(gpt_entries);
free(gpt);
return NULL;
@@ -791,7 +791,7 @@ static int check_part_gpt(disk_t *disk_car,const int verbose,partition_t *partit
ret=check_xfs(disk_car,partition,verbose);
if(ret!=0)
{
- aff_buffer(BUFFER_ADD,"No FAT, NTFS, EXT2, JFS, Reiser, cramfs or XFS marker\n");
+ screen_buffer_add("No FAT, NTFS, EXT2, JFS, Reiser, cramfs or XFS marker\n");
}
}
/* TODO: complete me */
diff --git a/src/parti386.c b/src/parti386.c
index 8c721e2..f7f96ac 100644
--- a/src/parti386.c
+++ b/src/parti386.c
@@ -348,10 +348,10 @@ static list_part_t *read_part_i386(disk_t *disk_car, const int verbose, const in
CHS_t geometry;
list_part_t *new_list_part=NULL;
unsigned char *buffer=MALLOC(disk_car->sector_size);
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
if(disk_car->read(disk_car,disk_car->sector_size, buffer, (uint64_t)0))
{
- aff_buffer(BUFFER_ADD, msg_PART_RD_ERR);
+ screen_buffer_add( msg_PART_RD_ERR);
free(buffer);
return NULL;
}
@@ -360,7 +360,7 @@ static list_part_t *read_part_i386(disk_t *disk_car, const int verbose, const in
geometry.sector=0;
if(get_geometry_from_i386mbr(buffer,verbose,&geometry)!=0)
{
- aff_buffer(BUFFER_ADD,msg_TBL_NMARK);
+ screen_buffer_add(msg_TBL_NMARK);
free(buffer);
return NULL;
}
@@ -387,7 +387,7 @@ static list_part_t *read_part_i386(disk_t *disk_car, const int verbose, const in
aff_part_buffer(AFF_PART_ORDER|AFF_PART_STATUS,disk_car,new_partition);
if(new_partition->errcode!=BAD_NOERR)
{
- aff_buffer(BUFFER_ADD,"%s\n",errmsg_i386_entry2partition(new_partition->errcode));
+ screen_buffer_add("%s\n",errmsg_i386_entry2partition(new_partition->errcode));
res|=1;
}
new_list_part=insert_new_partition(new_list_part,new_partition, 0, &insert_error);
@@ -443,20 +443,20 @@ static void test_MBR_data(list_part_t *list_part)
}
}
if(nb_dos>1)
- aff_buffer(BUFFER_ADD,msg_ONLY_ONE_DOS);
+ screen_buffer_add(msg_ONLY_ONE_DOS);
if(nb_ext>1)
- aff_buffer(BUFFER_ADD,msg_ONLY_ONE_EXT);
+ screen_buffer_add(msg_ONLY_ONE_EXT);
/* S'il y a des partitions caches, il faut un MB */
/* Obsolete
if(nb_hidden>0 && nb_mb==0)
- aff_buffer(BUFFER_ADD,msg_NO_OS2MB);
+ screen_buffer_add(msg_NO_OS2MB);
*/
/* Nombre de partition bootable */
if(nb_boot==0)
- aff_buffer(BUFFER_ADD,msg_NO_BOOTABLE);
+ screen_buffer_add(msg_NO_BOOTABLE);
else
if(nb_boot>1)
- aff_buffer(BUFFER_ADD,msg_ONLY1MUSTBOOT);
+ screen_buffer_add(msg_ONLY1MUSTBOOT);
}
static list_part_t *get_ext_data_i386(disk_t *disk_car, list_part_t *list_part, const int verbose, const int saveheader)
@@ -483,7 +483,7 @@ static list_part_t *get_ext_data_i386(disk_t *disk_car, list_part_t *list_part,
return list_part;
if((buffer[0x1FE]!=(unsigned char)0x55)||(buffer[0x1FF]!=(unsigned char)0xAA))
{
- aff_buffer(BUFFER_ADD,"\ntest_logical: " msg_TBL_NMARK);
+ screen_buffer_add("\ntest_logical: " msg_TBL_NMARK);
return list_part;
}
for(i=0;i<4;i++)
@@ -513,15 +513,15 @@ static list_part_t *get_ext_data_i386(disk_t *disk_car, list_part_t *list_part,
}
}
if(nb_hidden>0)
- aff_buffer(BUFFER_ADD,"Partition must not be hidden\n");
+ screen_buffer_add("Partition must not be hidden\n");
if(nb_mb>0)
- aff_buffer(BUFFER_ADD,"Multiboot must be a primary partition, not a logical\n");
+ screen_buffer_add("Multiboot must be a primary partition, not a logical\n");
if(nb_ext>1)
- aff_buffer(BUFFER_ADD,"A logical partition must not have more than one link to another logical partition\n");
+ screen_buffer_add("A logical partition must not have more than one link to another logical partition\n");
if(nb_part>1)
- aff_buffer(BUFFER_ADD,"A logical partition must contain only one partition\n");
+ screen_buffer_add("A logical partition must contain only one partition\n");
if(nb_boot>0)
- aff_buffer(BUFFER_ADD,"Logical partition must not be bootable\n");
+ screen_buffer_add("Logical partition must not be bootable\n");
partition_next_ext=NULL;
for(i=0;i<4;i++)
{
@@ -540,7 +540,7 @@ static list_part_t *get_ext_data_i386(disk_t *disk_car, list_part_t *list_part,
aff_part_buffer(AFF_PART_ORDER|AFF_PART_STATUS,disk_car,new_partition);
if(new_partition->errcode!=BAD_NOERR)
{
- aff_buffer(BUFFER_ADD,"%s\n",errmsg_i386_entry2partition(new_partition->errcode));
+ screen_buffer_add("%s\n",errmsg_i386_entry2partition(new_partition->errcode));
res=1;
}
{
@@ -548,7 +548,7 @@ static list_part_t *get_ext_data_i386(disk_t *disk_car, list_part_t *list_part,
(new_partition->part_offset+new_partition->part_size-1 > partition_main_ext->part_offset+partition_main_ext->part_size-1))
{ /* Must be IN partition_main_ext */
res=1;
- aff_buffer(BUFFER_ADD,"Must be in extended partition\n");
+ screen_buffer_add("Must be in extended partition\n");
aff_part_buffer(AFF_PART_ORDER|AFF_PART_STATUS,disk_car,partition_main_ext);
aff_part_buffer(AFF_PART_ORDER|AFF_PART_STATUS,disk_car,new_partition);
}
@@ -563,7 +563,7 @@ static list_part_t *get_ext_data_i386(disk_t *disk_car, list_part_t *list_part,
((partition->part_offset+partition->part_size-1>=new_partition->part_offset) && (partition->part_offset+partition->part_size-1<=new_partition->part_offset+partition->part_size-1)))
{ /* New Partition start or end mustn't been in partition */
res=1;
- aff_buffer(BUFFER_ADD, "Logical partition must be in its own extended partition\n");
+ screen_buffer_add( "Logical partition must be in its own extended partition\n");
aff_part_buffer(AFF_PART_ORDER|AFF_PART_STATUS,disk_car,partition);
aff_part_buffer(AFF_PART_ORDER|AFF_PART_STATUS,disk_car,new_partition);
}
@@ -581,7 +581,7 @@ static list_part_t *get_ext_data_i386(disk_t *disk_car, list_part_t *list_part,
aff_part_buffer(AFF_PART_ORDER|AFF_PART_STATUS,disk_car,new_partition);
if(new_partition->errcode!=BAD_NOERR)
{
- aff_buffer(BUFFER_ADD,"%s\n",errmsg_i386_entry2partition(new_partition->errcode));
+ screen_buffer_add("%s\n",errmsg_i386_entry2partition(new_partition->errcode));
res=1;
}
{
@@ -589,7 +589,7 @@ static list_part_t *get_ext_data_i386(disk_t *disk_car, list_part_t *list_part,
(new_partition->part_offset+new_partition->part_size-1 > partition_main_ext->part_offset+partition_main_ext->part_size-1))
{ /* Must be IN partition_main_ext */
res=1;
- aff_buffer(BUFFER_ADD, msg_SAME_SPACE);
+ screen_buffer_add( msg_SAME_SPACE);
aff_part_buffer(AFF_PART_ORDER|AFF_PART_STATUS,disk_car,partition_main_ext);
aff_part_buffer(AFF_PART_ORDER|AFF_PART_STATUS,disk_car,new_partition);
}
@@ -615,7 +615,7 @@ static int test_MBR_over(disk_t *disk_car,list_part_t *list_part)
element->part->part_offset + element->part->part_size - 1 >= element->next->part->part_offset)
{
res=1;
- aff_buffer(BUFFER_ADD, msg_SAME_SPACE);
+ screen_buffer_add( msg_SAME_SPACE);
aff_part_buffer(AFF_PART_ORDER|AFF_PART_STATUS,disk_car,element->part);
aff_part_buffer(AFF_PART_ORDER|AFF_PART_STATUS,disk_car,element->next->part);
}
@@ -1594,12 +1594,12 @@ static int check_part_i386(disk_t *disk_car,const int verbose,partition_t *parti
case P_16FATBD_LBAH:
ret=check_FAT(disk_car,partition,verbose);
if(ret!=0)
- { aff_buffer(BUFFER_ADD,"Invalid FAT boot sector\n"); }
+ { screen_buffer_add("Invalid FAT boot sector\n"); }
break;
case P_FREEBSD:
ret=check_BSD(disk_car,partition,verbose,BSD_MAXPARTITIONS);
if(ret!=0)
- { aff_buffer(BUFFER_ADD,"Invalid BSD disklabel\n"); }
+ { screen_buffer_add("Invalid BSD disklabel\n"); }
break;
case P_HFS:
ret=check_HFS(disk_car,partition,verbose);
@@ -1627,7 +1627,7 @@ static int check_part_i386(disk_t *disk_car,const int verbose,partition_t *parti
ret=check_xfs(disk_car,partition,verbose);
}
if(ret!=0)
- { aff_buffer(BUFFER_ADD,"No EXT2, JFS, Reiser, cramfs or XFS marker\n"); }
+ { screen_buffer_add("No EXT2, JFS, Reiser, cramfs or XFS marker\n"); }
break;
case P_LINSWAP:
ret=check_Linux_SWAP(disk_car,partition,verbose);
@@ -1646,7 +1646,7 @@ static int check_part_i386(disk_t *disk_car,const int verbose,partition_t *parti
case P_NTFSH:
ret=check_NTFS(disk_car,partition,verbose,0);
if(ret!=0)
- { aff_buffer(BUFFER_ADD,"Invalid NTFS boot\n"); }
+ { screen_buffer_add("Invalid NTFS boot\n"); }
break;
case P_OPENBSD:
ret=check_BSD(disk_car,partition,verbose,OPENBSD_MAXPARTITIONS);
@@ -1654,7 +1654,7 @@ static int check_part_i386(disk_t *disk_car,const int verbose,partition_t *parti
case P_RAID:
ret=check_MD(disk_car,partition,verbose);
if(ret!=0)
- { aff_buffer(BUFFER_ADD,"Invalid RAID superblock\n"); }
+ { screen_buffer_add("Invalid RAID superblock\n"); }
break;
case P_SUN:
ret=check_sun_i386(disk_car,partition,verbose);
diff --git a/src/partmac.c b/src/partmac.c
index 1d4f13e..cea0236 100644
--- a/src/partmac.c
+++ b/src/partmac.c
@@ -2,7 +2,7 @@
File: partmac.c
- Copyright (C) 1998-2007 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 1998-2008 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
@@ -120,14 +120,14 @@ list_part_t *read_part_mac(disk_t *disk_car, const int verbose, const int savehe
list_part_t *new_list_part=NULL;
unsigned int i;
unsigned int limit=1;
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
if(disk_car->read(disk_car,sizeof(buffer), &buffer, 0)!=0)
return NULL;
{
mac_Block0 *maclabel=(mac_Block0*)&buffer;
if (be16(maclabel->sbSig) != BLOCK0_SIGNATURE)
{
- aff_buffer(BUFFER_ADD,"Bad MAC partition, invalid block0 signature\n");
+ screen_buffer_add("Bad MAC partition, invalid block0 signature\n");
/* continue, even if the first sector have been overwritten by an Intel
partition, the following sectors may be intact */
}
@@ -139,7 +139,7 @@ list_part_t *read_part_mac(disk_t *disk_car, const int verbose, const int savehe
return new_list_part;
if(be16(dpme->dpme_signature) != DPME_SIGNATURE)
{
- aff_buffer(BUFFER_ADD,"read_part_mac: bad DPME signature\n");
+ screen_buffer_add("read_part_mac: bad DPME signature\n");
return new_list_part;
}
else
@@ -520,7 +520,7 @@ static int check_part_mac(disk_t *disk_car,const int verbose,partition_t *partit
ret=check_xfs(disk_car,partition,verbose);
}
if(ret!=0)
- { aff_buffer(BUFFER_ADD,"No EXT2, JFS, Reiser, cramfs or XFS marker\n"); }
+ { screen_buffer_add("No EXT2, JFS, Reiser, cramfs or XFS marker\n"); }
break;
case PMAC_HFS:
ret=check_HFSP(disk_car,partition,verbose);
diff --git a/src/partnone.c b/src/partnone.c
index 1a9a97f..f695f53 100644
--- a/src/partnone.c
+++ b/src/partnone.c
@@ -2,7 +2,7 @@
File: partnone.c
- Copyright (C) 1998-2007 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 1998-2008 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
@@ -196,7 +196,7 @@ list_part_t *read_part_none(disk_t *disk_car, const int verbose, const int saveh
partition->part_size=disk_car->disk_size;
partition->order=NO_ORDER;
partition->status=STATUS_PRIM;
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
disk_car->arch->check_part(disk_car,verbose,partition,saveheader);
aff_part_buffer(AFF_PART_ORDER|AFF_PART_STATUS,disk_car,partition);
list_part=insert_new_partition(NULL, partition, 0, &insert_error);
@@ -297,7 +297,7 @@ static int check_part_none(disk_t *disk_car,const int verbose,partition_t *parti
case UP_NTFS:
ret=check_NTFS(disk_car,partition,verbose,0);
if(ret!=0)
- { aff_buffer(BUFFER_ADD,"Invalid NTFS boot\n"); }
+ { screen_buffer_add("Invalid NTFS boot\n"); }
break;
case UP_OPENBSD:
ret=check_BSD(disk_car,partition,verbose,OPENBSD_MAXPARTITIONS);
@@ -309,7 +309,7 @@ static int check_part_none(disk_t *disk_car,const int verbose,partition_t *parti
case UP_MD1:
ret=check_MD(disk_car,partition,verbose);
if(ret!=0)
- { aff_buffer(BUFFER_ADD,"Invalid RAID superblock\n"); }
+ { screen_buffer_add("Invalid RAID superblock\n"); }
break;
case UP_RFS:
case UP_RFS2:
diff --git a/src/partsun.c b/src/partsun.c
index 006b246..ff93bb8 100644
--- a/src/partsun.c
+++ b/src/partsun.c
@@ -2,7 +2,7 @@
File: partsun.c
- Copyright (C) 1998-2007 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 1998-2008 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
@@ -143,17 +143,17 @@ list_part_t *read_part_sun(disk_t *disk_car, const int verbose, const int savehe
sun_partition *sunlabel;
list_part_t *new_list_part=NULL;
unsigned char *buffer=MALLOC(disk_car->sector_size);
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
sunlabel=(sun_partition*)buffer;
if(disk_car->read(disk_car,DEFAULT_SECTOR_SIZE, buffer, (uint64_t)0))
{
- aff_buffer(BUFFER_ADD, msg_PART_RD_ERR);
+ screen_buffer_add( msg_PART_RD_ERR);
free(buffer);
return NULL;
}
if (be16(sunlabel->magic) != SUN_LABEL_MAGIC)
{
- aff_buffer(BUFFER_ADD,"Bad SUN partition\n");
+ screen_buffer_add("Bad SUN partition\n");
free(buffer);
return NULL;
}
@@ -474,7 +474,7 @@ static int check_part_sun(disk_t *disk_car,const int verbose,partition_t *partit
ret=check_xfs(disk_car,partition,verbose);
}
if(ret!=0)
- { aff_buffer(BUFFER_ADD,"No EXT2, JFS, Reiser, cramfs or XFS marker\n"); }
+ { screen_buffer_add("No EXT2, JFS, Reiser, cramfs or XFS marker\n"); }
break;
case PSUN_LINSWAP:
diff --git a/src/partxbox.c b/src/partxbox.c
index 3821603..f89b9c0 100644
--- a/src/partxbox.c
+++ b/src/partxbox.c
@@ -2,7 +2,7 @@
File: partxbox.c
- Copyright (C) 2005-2007 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 2005-2008 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
@@ -97,7 +97,7 @@ list_part_t *read_part_xbox(disk_t *disk_car, const int verbose, const int saveh
{
unsigned char buffer[0x800];
list_part_t *new_list_part=NULL;
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
if(disk_car->read(disk_car,sizeof(buffer), &buffer, 0)!=0)
return new_list_part;
{
@@ -106,7 +106,7 @@ list_part_t *read_part_xbox(disk_t *disk_car, const int verbose, const int saveh
struct xbox_partition *xboxlabel=(struct xbox_partition*)&buffer;
if (memcmp(xboxlabel->magic,"BRFR",4))
{
- aff_buffer(BUFFER_ADD,"\nBad XBOX partition, invalid signature\n");
+ screen_buffer_add("\nBad XBOX partition, invalid signature\n");
return NULL;
}
for(i=0;i<sizeof(offsets)/sizeof(uint64_t);i++)
@@ -391,7 +391,7 @@ static int check_part_xbox(disk_t *disk_car,const int verbose,partition_t *parti
case PXBOX_FATX:
ret=check_FATX(disk_car,partition,verbose);
if(ret!=0)
- { aff_buffer(BUFFER_ADD,"Invalid FATX signature\n"); }
+ { screen_buffer_add("Invalid FATX signature\n"); }
break;
default:
if(verbose>0)
diff --git a/src/photorec.c b/src/photorec.c
index 51af716..16c6375 100644
--- a/src/photorec.c
+++ b/src/photorec.c
@@ -990,7 +990,7 @@ int main( int argc, char **argv )
"If you have problems with PhotoRec or bug reports, please contact me.\n");
return 0;
}
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
#ifdef HAVE_SETLOCALE
if(run_setlocale>0)
{
diff --git a/src/phrecn.c b/src/phrecn.c
index 7529e87..ac34609 100644
--- a/src/phrecn.c
+++ b/src/phrecn.c
@@ -66,7 +66,7 @@
/* #define DEBUG */
/* #define DEBUG_GET_NEXT_SECTOR */
/* #define DEBUG_BF */
-#define READ_SIZE 256*512
+#define READ_SIZE 1024*512
#define INTER_MENU_DISK 10
extern const file_hint_t file_hint_tar;
@@ -823,7 +823,6 @@ static int photorec_aux(disk_t *disk_car, partition_t *partition, const int verb
static list_cluster_t list_cluster= {
.list = TD_LIST_HEAD_INIT(list_cluster.list)
};
-#define READ_SIZE 1024*512
buffer_size=(*blocksize)+READ_SIZE;
buffer_start=MALLOC(buffer_size);
buffer_olddata=buffer_start;
@@ -1188,7 +1187,7 @@ static int photorec(disk_t *disk_car, partition_t *partition, const int verbose,
unsigned int pass;
unsigned int blocksize_is_known=0;
photorec_status_t status;
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
log_info("\nAnalyse\n");
log_partition(disk_car,partition);
if(blocksize==0 || td_list_empty(&list_search_space->list))
diff --git a/src/rfs_dir.c b/src/rfs_dir.c
index 9b1f39c..2947bfa 100644
--- a/src/rfs_dir.c
+++ b/src/rfs_dir.c
@@ -419,7 +419,7 @@ static file_data_t *reiser_dir(disk_t *disk_car, const partition_t *partition, d
ls->dir_list=NULL;
ls->current_file=NULL;
if (!(dir = reiserfs_dir_open(ls->current_fs, dir_data->current_directory))) {
- aff_buffer(BUFFER_ADD,"Couldn't open dir\n");
+ screen_buffer_add("Couldn't open dir\n");
log_error("Couldn't open dir\n");
return NULL;
}
diff --git a/src/testdisk.c b/src/testdisk.c
index aa3a13c..059ffe2 100644
--- a/src/testdisk.c
+++ b/src/testdisk.c
@@ -227,7 +227,7 @@ int main( int argc, char **argv )
"If you have problems with TestDisk or bug reports, please contact me.\n");
return 0;
}
- aff_buffer(BUFFER_RESET,"Q");
+ screen_buffer_to_log();
if(do_list!=0)
{
printf("Please wait...\n");