Changes by: flatcap
Update of /cvsroot/linux-ntfs/linux-ntfs/ntfstools
In directory usw-pr-cvs1:/tmp/cvs-serv1443/ntfstools
Modified Files:
Makefile.am Makefile.in ntfsinfo.c
Added Files:
undelete.8.in undelete.c undelete.h
Log Message:
a working undelete program, still very alpha
--- NEW FILE ---
.\" -*- nroff -*-
.\" Copyright (c) 2002 Anton Altaparmakov. All Rights Reserved.
.\" This file may be copied under the terms of the GNU Public License.
.\"
.TH UNDELETE 8 "June 2002" "Linux-NTFS version @VERSION@"
.SH NAME
undelete \- recover a deleted file from an NTFS volume.
.SH SYNOPSIS
.B undelete
.I [options]
.I device
.SH DESCRIPTION
.B undelete
will try to recover a deleted file from an NTFS volume.
.SH AUTHOR
.B undelete
was written by Richard Russon (FlatCap) <nt...@fl...>
.SH AVAILABILITY
.B undelete
is part of the linux-ntfs package and is available from
http://linux-ntfs.sourceforge.net/.
--- NEW FILE ---
/**
* undelete - Part of the Linux-NTFS project.
*
* Copyright (c) 2002 Richard Russon <nt...@fl...>
*
* 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
[...985 lines suppressed...]
if (!locale) {
locale = setlocale (LC_ALL, NULL);
printf ("Failed to set locale, using default '%s'.\n", locale);
} else {
//printf ("Using locale '%s'.\n", locale);
}
vol = ntfs_mount (opts.device, 0);
if (opts.uinode >= 0)
undelete_file (vol, opts.uinode);
else
scan_disk (vol);
ntfs_umount (vol, FALSE);
return 0;
}
--- NEW FILE ---
#ifndef _UNDELETE_H_
#define _UNDELETE_H_
/**
* undelete - Part of the Linux-NTFS project.
*
* Copyright (c) 2002 Richard Russon <nt...@fl...>
*
* 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
*/
#include "types.h"
#include "list.h"
#include "layout.h"
struct options {
int scan;
int uinode;
int percent;
int verbose;
char *dest;
char *device;
};
struct filename {
struct list_head list;
char *name;
FILE_NAME_TYPE_FLAGS name_space;
uchar_t *uname;
int uname_len;
long long size_alloc;
long long size_data;
FILE_ATTR_FLAGS flags;
};
struct data {
struct list_head list;
char *name;
uchar_t *uname;
int uname_len;
int resident;
int compressed;
int encrypted;
long long size_alloc;
long long size_data;
long long size_init;
long long size_vcn;
run_list_element*run_list;
int percent;
void *data;
};
struct ufile {
long long inode;
time_t date;
struct list_head name;
struct list_head data;
int attr_list;
int directory;
MFT_RECORD *mft;
};
#endif /* _UNDELETE_H_ */
Index: Makefile.am
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/Makefile.am,v
retrieving revision 1.19
retrieving revision 1.20
diff -U2 -r1.19 -r1.20
--- Makefile.am 1 Jun 2002 00:41:45 -0000 1.19
+++ Makefile.am 30 Jun 2002 21:22:51 -0000 1.20
@@ -6,7 +6,7 @@
endif
-bin_PROGRAMS = ntfsfix ntfsinfo #ntfsdump_logfile dumplog
+bin_PROGRAMS = ntfsfix ntfsinfo undelete #ntfsdump_logfile dumplog
sbin_PROGRAMS = mkntfs ntfslabel
-man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8
+man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 undelete.8
linux_ntfsincludedir = -I$(top_srcdir)/include
@@ -30,4 +30,8 @@
ntfsinfo_LDADD = $(top_srcdir)/libntfs/libntfs.la
ntfsinfo_LDFLAGS = $(all_libraries)
+
+undelete_SOURCES = undelete.c
+undelete_LDADD = $(top_srcdir)/libntfs/libntfs.la
+undelete_LDFLAGS = $(all_libraries)
# We don't distribute these as they are not really of any use to anyone except
Index: Makefile.in
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/Makefile.in,v
retrieving revision 1.25
retrieving revision 1.26
diff -U2 -r1.25 -r1.26
--- Makefile.in 1 Jun 2002 00:41:45 -0000 1.25
+++ Makefile.in 30 Jun 2002 21:22:52 -0000 1.26
@@ -92,7 +92,7 @@
@DEBUG_FALSE@AM_CFLAGS = @DEBUG_FALSE@-D_FILE_OFFSET_BITS=64
-bin_PROGRAMS = ntfsfix ntfsinfo #ntfsdump_logfile dumplog
+bin_PROGRAMS = ntfsfix ntfsinfo undelete #ntfsdump_logfile dumplog
sbin_PROGRAMS = mkntfs ntfslabel
-man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8
+man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 undelete.8
linux_ntfsincludedir = -I$(top_srcdir)/include
@@ -116,9 +116,15 @@
ntfsinfo_LDADD = $(top_srcdir)/libntfs/libntfs.la
ntfsinfo_LDFLAGS = $(all_libraries)
+
+undelete_SOURCES = undelete.c
+undelete_HEADERS = undelete.h
+undelete_LDADD = $(top_srcdir)/libntfs/libntfs.la
+undelete_LDFLAGS = $(all_libraries)
+
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
-CONFIG_CLEAN_FILES = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8
+CONFIG_CLEAN_FILES = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 undelete.8
bin_PROGRAMS = ntfsfix$(EXEEXT) ntfsinfo$(EXEEXT)
-sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT)
+sbin_PROGRAMS = mkntfs$(EXEEXT) ntfslabel$(EXEEXT) undelete$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS)
@@ -130,4 +136,6 @@
ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT)
ntfsinfo_DEPENDENCIES = $(top_srcdir)/libntfs/libntfs.la
+undelete_OBJECTS = undelete.$(OBJEXT)
+undelete_DEPENDENCIES = $(top_srcdir)/libntfs/libntfs.la
mkntfs_OBJECTS = attrdef.$(OBJEXT) upcase.$(OBJEXT) boot.$(OBJEXT) \
sd.$(OBJEXT) mkntfs.$(OBJEXT)
@@ -144,5 +152,5 @@
NROFF = nroff
DIST_COMMON = Makefile.am Makefile.in mkntfs.8.in ntfsfix.8.in \
-ntfsinfo.8.in ntfslabel.8.in
+ntfsinfo.8.in ntfslabel.8.in undelete.8.in
@@ -152,7 +160,8 @@
GZIP_ENV = --best
DEP_FILES = .deps/attrdef.P .deps/boot.P .deps/mkntfs.P .deps/ntfsfix.P \
-.deps/ntfsinfo.P .deps/ntfslabel.P .deps/sd.P .deps/upcase.P
-SOURCES = $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(mkntfs_SOURCES) $(ntfslabel_SOURCES)
-OBJECTS = $(ntfsfix_OBJECTS) $(ntfsinfo_OBJECTS) $(mkntfs_OBJECTS) $(ntfslabel_OBJECTS)
+.deps/ntfsinfo.P .deps/ntfslabel.P .deps/sd.P .deps/upcase.P .deps/undelete.P
+SOURCES = $(ntfsfix_SOURCES) $(ntfsinfo_SOURCES) $(mkntfs_SOURCES) $(ntfslabel_SOURCES) $(undelete_SOURCES)
+OBJECTS = $(ntfsfix_OBJECTS) $(ntfsinfo_OBJECTS) $(mkntfs_OBJECTS) $(ntfslabel_OBJECTS) $(undelete_OBJECTS)
+HEADERS = $(undelete_HEADERS)
all: all-redirect
@@ -174,4 +183,6 @@
ntfsinfo.8: $(top_builddir)/config.status ntfsinfo.8.in
cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+undelete.8: $(top_builddir)/config.status undelete.8.in
+ cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-binPROGRAMS:
@@ -270,4 +281,8 @@
@rm -f ntfsinfo$(EXEEXT)
$(LINK) $(ntfsinfo_LDFLAGS) $(ntfsinfo_OBJECTS) $(ntfsinfo_LDADD) $(LIBS)
+
+undelete$(EXEEXT): $(undelete_OBJECTS) $(undelete_DEPENDENCIES)
+ @rm -f undelete$(EXEEXT)
+ $(LINK) $(undelete_LDFLAGS) $(undelete_OBJECTS) $(undelete_LDADD) $(LIBS)
mkntfs$(EXEEXT): $(mkntfs_OBJECTS) $(mkntfs_DEPENDENCIES)
Index: ntfsinfo.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/ntfsinfo.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -U2 -r1.7 -r1.8
--- ntfsinfo.c 25 Jun 2002 23:35:49 -0000 1.7
+++ ntfsinfo.c 30 Jun 2002 21:22:52 -0000 1.8
@@ -110,5 +110,6 @@
printf("%s\n",file_name);
- free (ctx);
+ free (file_name);
+ ntfs_put_attr_search_ctx (ctx);
ntfs_close_inode (inode);
ntfs_umount (vol, FALSE);
|