Changes by: flatcap
Update of /cvsroot/linux-ntfs/linux-ntfs/ntfstools
In directory usw-pr-cvs1:/tmp/cvs-serv32764
Modified Files:
ntfsundelete.c
Log Message:
it was missing the very end of the mft, misplaced ) was losing stream names
Index: ntfsundelete.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/ntfsundelete.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -U2 -r1.16 -r1.17
--- ntfsundelete.c 17 Jul 2002 10:54:53 -0000 1.16
+++ ntfsundelete.c 17 Jul 2002 12:27:27 -0000 1.17
@@ -897,9 +897,10 @@
if (rec->name_length) {
- data->uname = (uchar_t *) ((char *) rec) + rec->name_offset;
+ data->uname = (uchar_t *) ((char *) rec + rec->name_offset);
data->uname_len = rec->name_length;
if (ntfs_ucstombs (data->uname, data->uname_len, &data->name,
data->uname_len) < 0) {
+ Eprintf ("Cannot translate name into current locale.\n");
}
}
@@ -1417,4 +1418,5 @@
int scan_disk (ntfs_volume *vol)
{
+ const int BUFSIZE = 8192;
char *buffer = NULL;
int results = 0;
@@ -1422,4 +1424,5 @@
long long size;
long long read;
+ long long bmpsize;
int i, j, k, b;
int percent;
@@ -1435,6 +1438,7 @@
return -1;
}
+ bmpsize = attr->initialized_size;
- buffer = malloc (vol->mft_record_size);
+ buffer = malloc (BUFSIZE);
if (!buffer) {
Eprintf ("Couldn't allocate memory in scan_disk()\n");
@@ -1456,6 +1460,6 @@
Iprintf ("Inode Flags %%age Date Size Filename\n");
Iprintf ("---------------------------------------------------------------\n");
- for (i = 0; i < (vol->nr_mft_records>>3); i += sizeof (buffer)) {
- read = min (((vol->nr_mft_records>>3) - i), sizeof (buffer));
+ for (i = 0; i < bmpsize; i += BUFSIZE) {
+ read = min ((bmpsize - i), BUFSIZE);
size = ntfs_attr_pread (attr, i, read, buffer);
if (size < 0)
@@ -1465,4 +1469,6 @@
b = buffer[j];
for (k = 0; k < 8; k++, b>>=1) {
+ if (((i+j)*8+k) >= vol->nr_mft_records)
+ goto done;
if (b & 1)
continue;
@@ -1500,4 +1506,5 @@
}
}
+done:
Iprintf ("\nFiles with potentially recoverable content: %d\n", results);
out:
|