2002-11-29 20:16:35 +08:00
|
|
|
/*
|
|
|
|
* ntfsundelete - Part of the Linux-NTFS project.
|
|
|
|
*
|
2003-01-20 06:01:18 +08:00
|
|
|
* Copyright (c) 2002 Richard Russon
|
2007-06-08 18:47:57 +08:00
|
|
|
* Copyright (c) 2007 Yura Pakhuchiy
|
2002-11-29 20:16:35 +08:00
|
|
|
*
|
|
|
|
* This utility will recover deleted files from an NTFS volume.
|
|
|
|
*
|
|
|
|
* This program 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 (in the main directory of the Linux-NTFS
|
|
|
|
* distribution in the file COPYING); if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _NTFSUNDELETE_H_
|
|
|
|
#define _NTFSUNDELETE_H_
|
|
|
|
|
2010-12-15 19:03:51 +08:00
|
|
|
#include "types.h"
|
2002-11-29 20:16:35 +08:00
|
|
|
#include "list.h"
|
2010-12-15 19:03:51 +08:00
|
|
|
#include "runlist.h"
|
2010-12-02 16:53:46 +08:00
|
|
|
#include "utils.h"
|
2002-11-29 20:16:35 +08:00
|
|
|
|
|
|
|
enum optmode {
|
|
|
|
MODE_NONE = 0,
|
|
|
|
MODE_SCAN,
|
|
|
|
MODE_UNDELETE,
|
|
|
|
MODE_COPY,
|
|
|
|
MODE_ERROR
|
|
|
|
};
|
|
|
|
|
|
|
|
struct options {
|
|
|
|
char *device; /* Device/File to work with */
|
|
|
|
enum optmode mode; /* Scan / Undelete / Copy */
|
|
|
|
int percent; /* Minimum recoverability */
|
|
|
|
int uinode; /* Undelete this inode */
|
|
|
|
char *dest; /* Save file to this directory */
|
|
|
|
char *output; /* With this filename */
|
|
|
|
char *match; /* Pattern for filename matching */
|
|
|
|
int match_case; /* Case sensitive matching */
|
2004-07-16 02:28:05 +08:00
|
|
|
int truncate; /* Truncate files to exact size. */
|
2002-11-29 20:16:35 +08:00
|
|
|
int quiet; /* Less output */
|
|
|
|
int verbose; /* Extra output */
|
|
|
|
int force; /* Override common sense */
|
2004-08-17 04:14:59 +08:00
|
|
|
int optimistic; /* Undelete in-use clusters as well */
|
2004-08-24 06:54:51 +08:00
|
|
|
int parent; /* Show parent directory */
|
2002-11-29 20:16:35 +08:00
|
|
|
time_t since; /* Since this time */
|
2004-03-09 22:47:34 +08:00
|
|
|
s64 size_begin; /* Range for file size */
|
|
|
|
s64 size_end;
|
|
|
|
s64 mft_begin; /* Range for mft copy */
|
|
|
|
s64 mft_end;
|
2004-08-20 20:01:17 +08:00
|
|
|
char fillbyte; /* Use for unrecoverable sections */
|
2002-11-29 20:16:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct filename {
|
2012-01-11 18:44:09 +08:00
|
|
|
struct ntfs_list_head list; /* Previous/Next links */
|
2004-08-20 20:01:17 +08:00
|
|
|
ntfschar *uname; /* Filename in unicode */
|
2002-11-29 20:16:35 +08:00
|
|
|
int uname_len; /* and its length */
|
|
|
|
long long size_alloc; /* Allocated size (multiple of cluster size) */
|
|
|
|
long long size_data; /* Actual size of data */
|
|
|
|
FILE_ATTR_FLAGS flags;
|
2002-12-05 22:22:26 +08:00
|
|
|
time_t date_c; /* Time created */
|
|
|
|
time_t date_a; /* altered */
|
|
|
|
time_t date_m; /* mft record changed */
|
|
|
|
time_t date_r; /* read */
|
2004-08-20 20:01:17 +08:00
|
|
|
char *name; /* Filename in current locale */
|
|
|
|
FILE_NAME_TYPE_FLAGS name_space;
|
2007-06-08 18:47:57 +08:00
|
|
|
leMFT_REF parent_mref;
|
2004-08-24 06:54:51 +08:00
|
|
|
char *parent_name;
|
2002-11-29 20:16:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct data {
|
2012-01-11 18:44:09 +08:00
|
|
|
struct ntfs_list_head list; /* Previous/Next links */
|
2002-11-29 20:16:35 +08:00
|
|
|
char *name; /* Stream name in current locale */
|
2004-05-14 21:02:33 +08:00
|
|
|
ntfschar *uname; /* Unicode stream name */
|
2002-11-29 20:16:35 +08:00
|
|
|
int uname_len; /* and its length */
|
|
|
|
int resident; /* Stream is resident */
|
|
|
|
int compressed; /* Stream is compressed */
|
|
|
|
int encrypted; /* Stream is encrypted */
|
|
|
|
long long size_alloc; /* Allocated size (multiple of cluster size) */
|
|
|
|
long long size_data; /* Actual size of data */
|
|
|
|
long long size_init; /* Initialised size, may be less than data size */
|
|
|
|
long long size_vcn; /* Highest VCN in the data runs */
|
2002-12-09 04:36:02 +08:00
|
|
|
runlist_element *runlist; /* Decoded data runs */
|
2005-07-07 06:47:01 +08:00
|
|
|
int percent; /* Amount potentially recoverable */
|
2002-11-29 20:16:35 +08:00
|
|
|
void *data; /* If resident, a pointer to the data */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ufile {
|
|
|
|
long long inode; /* MFT record number */
|
|
|
|
time_t date; /* Last modification date/time */
|
2012-01-11 18:44:09 +08:00
|
|
|
struct ntfs_list_head name; /* A list of filenames */
|
|
|
|
struct ntfs_list_head data; /* A list of data streams */
|
2002-11-29 20:16:35 +08:00
|
|
|
char *pref_name; /* Preferred filename */
|
2005-10-22 02:05:13 +08:00
|
|
|
char *pref_pname; /* parent filename */
|
2002-11-29 20:16:35 +08:00
|
|
|
long long max_size; /* Largest size we find */
|
|
|
|
int attr_list; /* MFT record may be one of many */
|
|
|
|
int directory; /* MFT record represents a directory */
|
|
|
|
MFT_RECORD *mft; /* Raw MFT record */
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _NTFSUNDELETE_H_ */
|
|
|
|
|