summaryrefslogtreecommitdiffstats
path: root/src/file_png.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2009-04-27 08:54:06 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2009-04-27 08:54:06 +0200
commit5c5a566c2a92214e1691e4d269375d46ce531301 (patch)
tree8e8f56b974a3e924835e6c3c7968e64f30d1cbc9 /src/file_png.c
parentf2ca5ca1e1e7ef9b641c43b2ca4896fc2eaa2a2b (diff)
PhotoRec: recover SolidWorks .sldprt
Diffstat (limited to 'src/file_png.c')
-rw-r--r--src/file_png.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/file_png.c b/src/file_png.c
index 2f477d0..070f608 100644
--- a/src/file_png.c
+++ b/src/file_png.c
@@ -2,7 +2,7 @@
File: file_png.c
- Copyright (C) 1998-2007 Christophe GRENIER <grenier@cgsecurity.org>
+ Copyright (C) 1998-2009 Christophe GRENIER <grenier@cgsecurity.org>
Thanks to Holger Klemm for JNG (JPEG Network Graphics) and
MNG (Multiple-Image Network Graphics) support (2006)
@@ -36,6 +36,7 @@
#include "types.h"
#include "filegen.h"
+extern const file_hint_t file_hint_doc;
static void register_header_check_png(file_stat_t *file_stat);
static int header_check_png(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);
@@ -64,28 +65,34 @@ static void register_header_check_png(file_stat_t *file_stat)
static int header_check_png(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,png_header,sizeof(png_header))==0)
+ if(memcmp(buffer,jng_header,sizeof(jng_header))==0)
{
reset_file_recovery(file_recovery_new);
file_recovery_new->min_filesize=92;
file_recovery_new->file_check=file_check_png;
- file_recovery_new->extension=file_hint_png.extension;
+ file_recovery_new->extension="jng";
return 1;
}
- if(memcmp(buffer,jng_header,sizeof(jng_header))==0)
+ if(memcmp(buffer,mng_header,sizeof(mng_header))==0)
{
reset_file_recovery(file_recovery_new);
file_recovery_new->min_filesize=92;
file_recovery_new->file_check=file_check_png;
- file_recovery_new->extension="jng";
+ file_recovery_new->extension="mng";
return 1;
}
- if(memcmp(buffer,mng_header,sizeof(mng_header))==0)
+ /* SolidWorks files contains a png */
+ if(file_recovery!=NULL && file_recovery->file_stat!=NULL &&
+ file_recovery->file_stat->file_hint==&file_hint_doc &&
+ (strcmp(file_recovery->extension,"sld")==0 ||
+ strcmp(file_recovery->extension,"sldprt")==0))
+ return 0;
+ if(memcmp(buffer,png_header,sizeof(png_header))==0)
{
reset_file_recovery(file_recovery_new);
file_recovery_new->min_filesize=92;
file_recovery_new->file_check=file_check_png;
- file_recovery_new->extension="mng";
+ file_recovery_new->extension=file_hint_png.extension;
return 1;
}
return 0;