PhotoRec: Macintosh Picture.pct support
PhotoRec: SunPCI Disk Image
This commit is contained in:
parent
ea6be9bb31
commit
d8ba9e66a0
5 changed files with 150 additions and 1 deletions
|
@ -19,7 +19,7 @@ fs_H = analyse.h bfs.h bsd.h cramfs.h fat.h fatx.h ext2.h jfs_superblock.h jfs
|
|||
testdisk_SOURCES = testdisk.c $(base_C) $(base_H) $(fs_C) $(fs_H) testdisk.h adv.c adv.h dir.c dir.h dirpart.c dirpart.h edit.c edit.h ext2_dir.c ext2_dir.h ext2_inc.h fat_adv.c fat_dir.c fat_dir.h geometry.c godmode.c godmode.h intrface.c intrface.h ntfs_adv.c ntfs_dir.c ntfs_dir.h ntfs_fix.c ntfs_inc.h rfs_dir.c rfs_dir.h $(ICON_TESTDISK) next.c next.h dimage.c dimage.h
|
||||
#ntfs_udl.c ntfs_udl.h
|
||||
|
||||
photorec_SOURCES = photorec.c photorec.h phrecn.c phrecn.h dir.c dir.h ext2p.c ext2p.h ext2_dir.c ext2_dir.h ext2_inc.h fat_dir.c fat_dir.h fatp.c fatp.h filegen.c filegen.h file_7z.c file_a.c file_ab.c file_ace.c file_aif.c file_all.c file_asf.c file_au.c file_bkf.c file_bld.c file_bmp.c file_bz2.c file_cab.c file_cam.c file_cm.c file_crw.c file_ctg.c file_cwk.c file_dat.c file_dbf.c file_dir.c file_djv.c file_doc.c file_dpx.c file_dsc.c file_dss.c file_dta.c file_dv.c file_dwg.c file_elf.c file_evt.c file_exe.c pe.h file_ext.c file_fcp.c file_fh10.c file_fh5.c file_flac.c file_flv.c file_fs.c file_gif.c file_gz.c file_imb.c file_indd.c file_dump.c file_itu.c file_jpg.c file_jpg.h file_kdb.c file_lnk.c file_max.c file_mb.c file_mdb.c file_mdf.c file_mid.c file_mkv.c file_mov.c file_mp3.c file_mpg.c file_mrw.c file_mus.c file_mysql.c file_njx.c file_ogg.c file_one.c file_orf.c file_pap.c file_pcx.c file_pdf.c file_png.c file_prc.c file_ps.c file_psd.c file_pst.c file_ptb.c file_qbb.c file_qdf.c file_qxd.c file_ra.c file_raf.c file_rar.c file_raw.c file_rdc.c file_reg.c file_res.c file_riff.c file_rm.c file_rns.c file_rpm.c file_sit.c file_skp.c file_spe.c file_spss.c file_stu.c file_swf.c file_tar.c file_tar.h file_tib.c file_tiff.c file_txt.c file_vmdk.c file_wpd.c file_wmf.c file_x3f.c file_xcf.c file_xm.c file_xsv.c file_zip.c memmem.h geometry.c list.c list.h ole.h ntfs_dir.c ntfs_dir.h ntfsp.c ntfsp.h ntfs_inc.h sessionp.c sessionp.h $(base_C) $(base_H) $(fs_C) $(fs_H) $(ICON_PHOTOREC)
|
||||
photorec_SOURCES = photorec.c photorec.h phrecn.c phrecn.h dir.c dir.h ext2p.c ext2p.h ext2_dir.c ext2_dir.h ext2_inc.h fat_dir.c fat_dir.h fatp.c fatp.h filegen.c filegen.h file_7z.c file_a.c file_ab.c file_ace.c file_aif.c file_all.c file_asf.c file_au.c file_bkf.c file_bld.c file_bmp.c file_bz2.c file_cab.c file_cam.c file_cm.c file_crw.c file_ctg.c file_cwk.c file_dat.c file_dbf.c file_dim.c file_dir.c file_djv.c file_doc.c file_dpx.c file_dsc.c file_dss.c file_dta.c file_dv.c file_dwg.c file_elf.c file_evt.c file_exe.c pe.h file_ext.c file_fcp.c file_fh10.c file_fh5.c file_flac.c file_flv.c file_fs.c file_gif.c file_gz.c file_imb.c file_indd.c file_dump.c file_itu.c file_jpg.c file_jpg.h file_kdb.c file_lnk.c file_max.c file_mb.c file_mdb.c file_mdf.c file_mid.c file_mkv.c file_mov.c file_mp3.c file_mpg.c file_mrw.c file_mus.c file_mysql.c file_njx.c file_ogg.c file_one.c file_orf.c file_pap.c file_pct.c file_pcx.c file_pdf.c file_png.c file_prc.c file_ps.c file_psd.c file_pst.c file_ptb.c file_qbb.c file_qdf.c file_qxd.c file_ra.c file_raf.c file_rar.c file_raw.c file_rdc.c file_reg.c file_res.c file_riff.c file_rm.c file_rns.c file_rpm.c file_sit.c file_skp.c file_spe.c file_spss.c file_stu.c file_swf.c file_tar.c file_tar.h file_tib.c file_tiff.c file_txt.c file_vmdk.c file_wpd.c file_wmf.c file_x3f.c file_xcf.c file_xm.c file_xsv.c file_zip.c memmem.h geometry.c list.c list.h ole.h ntfs_dir.c ntfs_dir.h ntfsp.c ntfsp.h ntfs_inc.h sessionp.c sessionp.h $(base_C) $(base_H) $(fs_C) $(fs_H) $(ICON_PHOTOREC)
|
||||
|
||||
#diskcp_SOURCES = diskcp.c types.h
|
||||
|
||||
|
|
61
src/file_dim.c
Normal file
61
src/file_dim.c
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
|
||||
File: file_dim.c
|
||||
|
||||
Copyright (C) 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
|
||||
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
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include "types.h"
|
||||
#include "filegen.h"
|
||||
#include "log.h"
|
||||
|
||||
static void register_header_check_dim(file_stat_t *file_stat);
|
||||
static int header_check_dim(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new);
|
||||
|
||||
const file_hint_t file_hint_dim= {
|
||||
.extension="diskimage",
|
||||
.description="SunPCI Disk Image",
|
||||
.min_header_distance=0,
|
||||
.max_filesize=PHOTOREC_MAX_FILE_SIZE,
|
||||
.recover=1,
|
||||
.register_header_check=®ister_header_check_dim
|
||||
};
|
||||
|
||||
static const unsigned char dim_header[4]= { 'S', 'P','C','I'};
|
||||
|
||||
static void register_header_check_dim(file_stat_t *file_stat)
|
||||
{
|
||||
register_header_check(0x0c, dim_header,sizeof(dim_header), &header_check_dim, file_stat);
|
||||
}
|
||||
|
||||
static int header_check_dim(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)
|
||||
{
|
||||
if(memcmp(&buffer[0x0c],dim_header,sizeof(dim_header))==0)
|
||||
{
|
||||
reset_file_recovery(file_recovery_new);
|
||||
file_recovery_new->extension=file_hint_dim.extension;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -52,6 +52,8 @@ static const unsigned char dss_header[4]= { 0x02, 'd','s','s'};
|
|||
0x32 char complete_date[12];
|
||||
0x3e char length[6];
|
||||
0x31e char comments[100];
|
||||
|
||||
Filesize is always a multiple of 512
|
||||
*/
|
||||
|
||||
static void register_header_check_dss(file_stat_t *file_stat)
|
||||
|
|
82
src/file_pct.c
Normal file
82
src/file_pct.c
Normal file
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
|
||||
File: file_pct.c
|
||||
|
||||
Copyright (C) 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
|
||||
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
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include "types.h"
|
||||
#include "filegen.h"
|
||||
#include "log.h"
|
||||
|
||||
static void register_header_check_pct(file_stat_t *file_stat);
|
||||
static int header_check_pct(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new);
|
||||
static void file_check_pct(file_recovery_t *file_recovery);
|
||||
|
||||
const file_hint_t file_hint_pct= {
|
||||
.extension="pct",
|
||||
.description="Macintosh Picture",
|
||||
.min_header_distance=0,
|
||||
.max_filesize=PHOTOREC_MAX_FILE_SIZE,
|
||||
.recover=1,
|
||||
.register_header_check=®ister_header_check_pct
|
||||
};
|
||||
|
||||
static const unsigned char pct_header[6]= { 0x00, 0x11, 0x02, 0xff, 0x0c, 0x00};
|
||||
/* We are searching for PICTv2 files
|
||||
http://www.fileformat.info/format/macpict/
|
||||
SHORT Version operator (0x0011)
|
||||
SHORT Version number (0x02ff)
|
||||
SHORT Header opcode for Version 2 (0C00)
|
||||
*/
|
||||
static void register_header_check_pct(file_stat_t *file_stat)
|
||||
{
|
||||
register_header_check(0x20a, pct_header,sizeof(pct_header), &header_check_pct, file_stat);
|
||||
}
|
||||
|
||||
static int header_check_pct(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)
|
||||
{
|
||||
if(memcmp(&buffer[0x20a],pct_header,sizeof(pct_header))==0)
|
||||
{
|
||||
reset_file_recovery(file_recovery_new);
|
||||
file_recovery_new->extension=file_hint_pct.extension;
|
||||
/* We only have the low 16bits of the filesystem */
|
||||
file_recovery_new->min_filesize=0x200+(buffer[0x200]<<8)+buffer[0x201];
|
||||
file_recovery_new->file_check=&file_check_pct;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void file_check_pct(file_recovery_t *file_recovery)
|
||||
{
|
||||
if(file_recovery->file_size<0x210 ||
|
||||
file_recovery->file_size<file_recovery->min_filesize)
|
||||
{
|
||||
file_recovery->file_size=0;
|
||||
return ;
|
||||
}
|
||||
file_recovery->file_size-=((file_recovery->file_size-file_recovery->min_filesize)&0xFFFF);
|
||||
}
|
||||
|
|
@ -111,6 +111,7 @@ extern const file_hint_t file_hint_ctg;
|
|||
extern const file_hint_t file_hint_cwk;
|
||||
extern const file_hint_t file_hint_dat;
|
||||
extern const file_hint_t file_hint_dbf;
|
||||
extern const file_hint_t file_hint_dim;
|
||||
extern const file_hint_t file_hint_dir;
|
||||
extern const file_hint_t file_hint_djv;
|
||||
extern const file_hint_t file_hint_doc;
|
||||
|
@ -156,6 +157,7 @@ extern const file_hint_t file_hint_ogg;
|
|||
extern const file_hint_t file_hint_one;
|
||||
extern const file_hint_t file_hint_orf;
|
||||
extern const file_hint_t file_hint_pap;
|
||||
extern const file_hint_t file_hint_pct;
|
||||
extern const file_hint_t file_hint_pcx;
|
||||
extern const file_hint_t file_hint_pdf;
|
||||
extern const file_hint_t file_hint_png;
|
||||
|
@ -786,6 +788,7 @@ int main( int argc, char **argv )
|
|||
{ .enable=1, .file_hint=&file_hint_cwk },
|
||||
{ .enable=1, .file_hint=&file_hint_dat },
|
||||
{ .enable=0, .file_hint=&file_hint_dbf },
|
||||
{ .enable=1, .file_hint=&file_hint_dim },
|
||||
{ .enable=1, .file_hint=&file_hint_dir },
|
||||
{ .enable=1, .file_hint=&file_hint_djv },
|
||||
{ .enable=1, .file_hint=&file_hint_doc },
|
||||
|
@ -831,6 +834,7 @@ int main( int argc, char **argv )
|
|||
{ .enable=1, .file_hint=&file_hint_one },
|
||||
{ .enable=1, .file_hint=&file_hint_orf },
|
||||
{ .enable=1, .file_hint=&file_hint_pap },
|
||||
{ .enable=1, .file_hint=&file_hint_pct },
|
||||
{ .enable=1, .file_hint=&file_hint_pcx },
|
||||
{ .enable=1, .file_hint=&file_hint_pdf },
|
||||
{ .enable=1, .file_hint=&file_hint_png },
|
||||
|
|
Loading…
Reference in a new issue