diff --git a/configure.ac b/configure.ac index 4bc098b4..88733eb5 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ # Autoconf AC_PREREQ(2.59) -AC_INIT([ntfs-3g],[2017.2.15],[ntfs-3g-devel@lists.sf.net]) +AC_INIT([ntfs-3g],[2017.3.23],[ntfs-3g-devel@lists.sf.net]) LIBNTFS_3G_VERSION="88" AC_CONFIG_SRCDIR([src/ntfs-3g.c]) diff --git a/ntfsprogs/boot.c b/ntfsprogs/boot.c index 9272be9f..fe8d6ac3 100644 --- a/ntfsprogs/boot.c +++ b/ntfsprogs/boot.c @@ -1,268 +1,103 @@ +/* + * NTFS bootsector, adapted from the vfat one. + */ + +/* mkfs.fat.c - utility to create FAT/MS-DOS filesystems + * Copyright (C) 1991 Linus Torvalds + * Copyright (C) 1992-1993 Remy Card + * Copyright (C) 1993-1994 David Hudson + * Copyright (C) 1998 H. Peter Anvin + * Copyright (C) 1998-2005 Roman Hodek + * Copyright (C) 2008-2014 Daniel Baumann + * Copyright (C) 2015 Andreas Bombe + * + * 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 3 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, see . + * The complete text of the GNU General Public License + * can be found in /usr/share/common-licenses/GPL-3 file. + */ + #include "boot.h" -/** - * boot_array - the first 4136 bytes of $Boot - * - * The first 4136 bytes of $Boot. The rest is just zero. Total 8192 bytes. - */ -const unsigned char boot_array[4136] = { -235, 82, 144, 78, 84, 70, 83, 32, 32, 32, 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 250, 51, 192, 142, 208, 188, 0, 124, 251, 104, 192, 7, - 31, 30, 104, 102, 0, 203, 136, 22, 14, 0, 102, 129, 62, 3, 0, 78, - 84, 70, 83, 117, 21, 180, 65, 187, 170, 85, 205, 19, 114, 12, 129, 251, - 85, 170, 117, 6, 247, 193, 1, 0, 117, 3, 233, 210, 0, 30, 131, 236, - 24, 104, 26, 0, 180, 72, 138, 22, 14, 0, 139, 244, 22, 31, 205, 19, -159, 131, 196, 24, 158, 88, 31, 114, 225, 59, 6, 11, 0, 117, 219, 163, - 15, 0, 193, 46, 15, 0, 4, 30, 90, 51, 219, 185, 0, 32, 43, 200, -102, 255, 6, 17, 0, 3, 22, 15, 0, 142, 194, 255, 6, 22, 0, 232, - 64, 0, 43, 200, 119, 239, 184, 0, 187, 205, 26, 102, 35, 192, 117, 45, -102, 129, 251, 84, 67, 80, 65, 117, 36, 129, 249, 2, 1, 114, 30, 22, -104, 7, 187, 22, 104, 112, 14, 22, 104, 9, 0, 102, 83, 102, 83, 102, - 85, 22, 22, 22, 104, 184, 1, 102, 97, 14, 7, 205, 26, 233, 106, 1, -144, 144, 102, 96, 30, 6, 102, 161, 17, 0, 102, 3, 6, 28, 0, 30, -102, 104, 0, 0, 0, 0, 102, 80, 6, 83, 104, 1, 0, 104, 16, 0, -180, 66, 138, 22, 14, 0, 22, 31, 139, 244, 205, 19, 102, 89, 91, 90, -102, 89, 102, 89, 31, 15, 130, 22, 0, 102, 255, 6, 17, 0, 3, 22, - 15, 0, 142, 194, 255, 14, 22, 0, 117, 188, 7, 31, 102, 97, 195, 160, -248, 1, 232, 8, 0, 160, 251, 1, 232, 2, 0, 235, 254, 180, 1, 139, -240, 172, 60, 0, 116, 9, 180, 14, 187, 7, 0, 205, 16, 235, 242, 195, - 13, 10, 65, 32, 100, 105, 115, 107, 32, 114, 101, 97, 100, 32, 101, 114, -114, 111, 114, 32, 111, 99, 99, 117, 114, 114, 101, 100, 0, 13, 10, 66, - 79, 79, 84, 77, 71, 82, 32, 105, 115, 32, 109, 105, 115, 115, 105, 110, -103, 0, 13, 10, 66, 79, 79, 84, 77, 71, 82, 32, 105, 115, 32, 99, -111, 109, 112, 114, 101, 115, 115, 101, 100, 0, 13, 10, 80, 114, 101, 115, -115, 32, 67, 116, 114, 108, 43, 65, 108, 116, 43, 68, 101, 108, 32, 116, -111, 32, 114, 101, 115, 116, 97, 114, 116, 13, 10, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 128, 157, 178, 202, 0, 0, 85, 170, - 7, 0, 66, 0, 79, 0, 79, 0, 84, 0, 77, 0, 71, 0, 82, 0, - 4, 0, 36, 0, 73, 0, 51, 0, 48, 0, 0, 224, 0, 0, 0, 48, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 235, 34, 144, 144, 5, 0, 78, 0, 84, 0, - 76, 0, 68, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 102, 15, 183, 6, 11, 0, -102, 15, 182, 30, 13, 0, 102, 247, 227, 102, 163, 82, 2, 102, 139, 14, - 64, 0, 128, 249, 0, 15, 143, 14, 0, 246, 217, 102, 184, 1, 0, 0, - 0, 102, 211, 224, 235, 8, 144, 102, 161, 82, 2, 102, 247, 225, 102, 163, -102, 2, 102, 15, 183, 30, 11, 0, 102, 51, 210, 102, 247, 243, 102, 163, - 86, 2, 232, 149, 4, 102, 139, 14, 78, 2, 102, 137, 14, 38, 2, 102, - 3, 14, 102, 2, 102, 137, 14, 42, 2, 102, 3, 14, 102, 2, 102, 137, - 14, 46, 2, 102, 3, 14, 102, 2, 102, 137, 14, 62, 2, 102, 3, 14, -102, 2, 102, 137, 14, 70, 2, 102, 184, 144, 0, 0, 0, 102, 139, 14, - 38, 2, 232, 131, 9, 102, 11, 192, 15, 132, 83, 254, 102, 163, 50, 2, -102, 184, 160, 0, 0, 0, 102, 139, 14, 42, 2, 232, 106, 9, 102, 163, - 54, 2, 102, 184, 176, 0, 0, 0, 102, 139, 14, 46, 2, 232, 88, 9, -102, 163, 58, 2, 102, 161, 50, 2, 102, 11, 192, 15, 132, 32, 254, 103, -128, 120, 8, 0, 15, 133, 23, 254, 103, 102, 141, 80, 16, 103, 3, 66, - 4, 103, 102, 15, 182, 72, 12, 102, 137, 14, 114, 2, 103, 102, 139, 72, - 8, 102, 137, 14, 110, 2, 102, 161, 110, 2, 102, 15, 183, 14, 11, 0, -102, 51, 210, 102, 247, 241, 102, 163, 118, 2, 102, 161, 70, 2, 102, 3, - 6, 110, 2, 102, 163, 74, 2, 102, 131, 62, 54, 2, 0, 15, 132, 29, - 0, 102, 131, 62, 58, 2, 0, 15, 132, 196, 253, 102, 139, 30, 58, 2, - 30, 7, 102, 139, 62, 74, 2, 102, 161, 46, 2, 232, 224, 1, 102, 15, -183, 14, 0, 2, 102, 184, 2, 2, 0, 0, 232, 34, 8, 102, 11, 192, - 15, 133, 22, 0, 102, 15, 183, 14, 90, 2, 102, 184, 92, 2, 0, 0, -232, 12, 8, 102, 11, 192, 15, 132, 66, 12, 103, 102, 139, 0, 30, 7, -102, 139, 62, 62, 2, 232, 63, 6, 102, 161, 62, 2, 102, 187, 32, 0, - 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, 0, 0, 0, 0, 232, 228, - 0, 102, 133, 192, 15, 133, 35, 0, 102, 161, 62, 2, 102, 187, 128, 0, - 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, 0, 0, 0, 0, 232, 196, - 0, 102, 11, 192, 15, 133, 68, 0, 233, 241, 11, 102, 51, 210, 102, 185, -128, 0, 0, 0, 102, 161, 62, 2, 232, 202, 8, 102, 11, 192, 15, 132, -218, 11, 30, 7, 102, 139, 62, 62, 2, 232, 219, 5, 102, 161, 62, 2, -102, 187, 128, 0, 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, 0, 0, - 0, 0, 232, 128, 0, 102, 11, 192, 15, 132, 176, 11, 103, 102, 15, 183, - 88, 12, 102, 129, 227, 255, 0, 0, 0, 15, 133, 165, 11, 102, 139, 216, -104, 0, 32, 7, 102, 43, 255, 102, 161, 62, 2, 232, 0, 1, 104, 0, - 32, 7, 102, 43, 255, 102, 161, 62, 2, 232, 172, 10, 138, 22, 14, 0, -184, 232, 3, 142, 192, 141, 54, 11, 0, 43, 192, 104, 0, 32, 80, 203, - 6, 30, 102, 96, 102, 139, 218, 102, 15, 182, 14, 13, 0, 102, 247, 225, -102, 163, 17, 0, 102, 139, 195, 102, 247, 225, 163, 22, 0, 139, 223, 131, -227, 15, 140, 192, 102, 193, 239, 4, 3, 199, 80, 7, 232, 51, 252, 102, - 97, 144, 31, 7, 195, 103, 3, 64, 20, 103, 102, 131, 56, 255, 15, 132, - 76, 0, 103, 102, 57, 24, 15, 133, 51, 0, 102, 11, 201, 15, 133, 10, - 0, 103, 128, 120, 9, 0, 15, 133, 35, 0, 195, 103, 58, 72, 9, 15, -133, 26, 0, 102, 139, 240, 103, 3, 112, 10, 232, 151, 6, 102, 81, 30, - 7, 102, 139, 250, 243, 167, 102, 89, 15, 133, 1, 0, 195, 103, 102, 131, -120, 4, 0, 15, 132, 7, 0, 103, 102, 3, 64, 4, 235, 171, 102, 43, -192, 195, 102, 139, 243, 232, 108, 6, 103, 102, 3, 0, 103, 247, 64, 12, - 2, 0, 15, 133, 52, 0, 103, 102, 141, 80, 16, 103, 58, 74, 64, 15, -133, 24, 0, 103, 102, 141, 114, 66, 232, 73, 6, 102, 81, 30, 7, 102, -139, 251, 243, 167, 102, 89, 15, 133, 1, 0, 195, 103, 131, 120, 8, 0, - 15, 132, 6, 0, 103, 3, 64, 8, 235, 194, 102, 51, 192, 195, 103, 128, -123, 8, 0, 15, 133, 28, 0, 6, 30, 102, 96, 103, 102, 141, 83, 16, -103, 102, 139, 10, 102, 139, 243, 103, 3, 114, 4, 243, 164, 102, 97, 144, - 31, 7, 195, 102, 80, 103, 102, 141, 83, 16, 102, 133, 192, 15, 133, 10, - 0, 103, 102, 139, 74, 8, 102, 65, 235, 17, 144, 103, 102, 139, 66, 24, -102, 51, 210, 102, 247, 54, 82, 2, 102, 139, 200, 102, 43, 192, 102, 94, -232, 1, 0, 195, 6, 30, 102, 96, 103, 128, 123, 8, 1, 15, 132, 3, - 0, 233, 107, 251, 102, 131, 249, 0, 15, 133, 6, 0, 102, 97, 144, 31, - 7, 195, 102, 83, 102, 80, 102, 81, 102, 86, 102, 87, 6, 232, 145, 4, -102, 139, 209, 7, 102, 95, 102, 94, 102, 89, 102, 133, 192, 15, 132, 52, - 0, 102, 59, 202, 15, 141, 3, 0, 102, 139, 209, 232, 130, 254, 102, 43, -202, 102, 139, 218, 102, 139, 194, 102, 15, 182, 22, 13, 0, 102, 247, 226, -102, 15, 183, 22, 11, 0, 102, 247, 226, 102, 3, 248, 102, 88, 102, 3, -195, 102, 91, 235, 159, 102, 133, 246, 15, 132, 3, 251, 102, 81, 102, 87, - 6, 103, 102, 15, 182, 67, 9, 102, 133, 192, 15, 132, 32, 0, 102, 209, -224, 102, 43, 224, 102, 139, 252, 102, 84, 102, 86, 103, 102, 15, 183, 115, - 10, 102, 3, 243, 102, 139, 200, 243, 164, 102, 94, 235, 3, 144, 102, 80, -102, 80, 103, 102, 139, 3, 102, 80, 103, 102, 139, 67, 24, 102, 80, 103, -102, 139, 86, 32, 102, 133, 210, 15, 132, 11, 0, 102, 139, 254, 30, 7, -102, 139, 194, 232, 113, 3, 102, 139, 198, 102, 90, 102, 89, 102, 66, 102, - 81, 102, 86, 232, 63, 6, 102, 133, 192, 15, 132, 146, 250, 102, 94, 102, - 89, 102, 139, 254, 30, 7, 232, 78, 3, 102, 139, 198, 102, 139, 217, 102, - 89, 102, 90, 102, 81, 102, 86, 102, 209, 233, 232, 248, 253, 102, 133, 192, - 15, 132, 107, 250, 102, 94, 102, 89, 102, 3, 225, 7, 102, 95, 102, 89, -102, 139, 208, 102, 88, 102, 91, 102, 139, 218, 233, 245, 254, 6, 30, 102, - 96, 38, 103, 102, 15, 183, 95, 4, 38, 103, 102, 15, 183, 79, 6, 102, - 11, 201, 15, 132, 57, 250, 102, 3, 223, 102, 131, 195, 2, 102, 129, 199, -254, 1, 0, 0, 102, 73, 102, 11, 201, 15, 132, 23, 0, 38, 103, 139, - 3, 38, 103, 137, 7, 102, 131, 195, 2, 102, 129, 199, 0, 2, 0, 0, -102, 73, 235, 226, 102, 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 184, - 1, 0, 0, 0, 102, 163, 34, 2, 102, 161, 30, 2, 102, 3, 6, 102, - 2, 102, 163, 106, 2, 102, 3, 6, 102, 2, 102, 163, 78, 2, 102, 161, - 48, 0, 102, 15, 182, 30, 13, 0, 102, 247, 227, 102, 139, 30, 78, 2, -102, 137, 7, 102, 163, 17, 0, 131, 195, 4, 102, 161, 86, 2, 102, 137, - 7, 163, 22, 0, 131, 195, 4, 102, 137, 30, 78, 2, 102, 139, 30, 30, - 2, 30, 7, 232, 92, 249, 102, 139, 251, 232, 81, 255, 102, 161, 30, 2, -102, 187, 32, 0, 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, 0, 0, - 0, 0, 232, 16, 253, 102, 11, 192, 15, 132, 25, 1, 102, 139, 216, 30, - 7, 102, 139, 62, 26, 2, 102, 51, 192, 232, 162, 253, 102, 139, 30, 26, - 2, 102, 129, 63, 128, 0, 0, 0, 15, 132, 235, 0, 3, 95, 4, 235, -240, 102, 83, 102, 139, 71, 16, 102, 247, 38, 86, 2, 102, 80, 102, 51, -210, 102, 15, 182, 30, 13, 0, 102, 247, 243, 102, 82, 232, 220, 0, 102, - 11, 192, 15, 132, 57, 249, 102, 139, 14, 86, 2, 102, 15, 182, 30, 13, - 0, 102, 247, 227, 102, 90, 102, 3, 194, 102, 139, 30, 78, 2, 102, 137, - 7, 131, 195, 4, 102, 15, 182, 6, 13, 0, 102, 43, 194, 102, 59, 193, - 15, 134, 3, 0, 102, 139, 193, 102, 137, 7, 102, 43, 200, 102, 90, 15, -132, 117, 0, 102, 3, 194, 102, 80, 102, 51, 210, 102, 15, 182, 30, 13, - 0, 102, 247, 243, 102, 81, 232, 130, 0, 102, 89, 102, 11, 192, 15, 132, -221, 248, 102, 15, 182, 30, 13, 0, 102, 247, 227, 102, 139, 30, 78, 2, -102, 139, 23, 131, 195, 4, 102, 3, 23, 102, 59, 208, 15, 133, 21, 0, -102, 15, 182, 6, 13, 0, 102, 59, 193, 15, 134, 3, 0, 102, 139, 193, -102, 1, 7, 235, 165, 131, 195, 4, 102, 137, 30, 78, 2, 102, 137, 7, -131, 195, 4, 102, 15, 182, 6, 13, 0, 102, 59, 193, 15, 134, 3, 0, -102, 139, 193, 102, 137, 7, 235, 130, 131, 195, 4, 102, 255, 6, 34, 2, -102, 137, 30, 78, 2, 102, 91, 3, 95, 4, 102, 129, 63, 128, 0, 0, - 0, 15, 132, 12, 255, 102, 97, 144, 31, 7, 195, 102, 139, 208, 102, 139, - 14, 34, 2, 102, 139, 54, 106, 2, 102, 3, 54, 102, 2, 102, 82, 102, - 81, 102, 82, 102, 139, 30, 106, 2, 102, 139, 62, 86, 2, 102, 139, 4, -102, 163, 17, 0, 131, 198, 4, 102, 139, 4, 163, 22, 0, 131, 198, 4, - 30, 7, 232, 221, 247, 102, 43, 248, 15, 132, 8, 0, 247, 38, 11, 0, - 3, 216, 235, 217, 102, 139, 62, 106, 2, 30, 7, 232, 191, 253, 102, 161, -106, 2, 102, 187, 128, 0, 0, 0, 102, 185, 0, 0, 0, 0, 102, 139, -209, 232, 129, 251, 102, 11, 192, 15, 132, 244, 247, 102, 139, 216, 102, 88, -102, 86, 232, 44, 1, 102, 94, 102, 11, 192, 15, 132, 5, 0, 102, 91, -102, 91, 195, 102, 89, 102, 90, 226, 132, 102, 51, 192, 195, 6, 30, 102, - 96, 102, 80, 102, 81, 102, 51, 210, 102, 15, 182, 30, 13, 0, 102, 247, -243, 102, 82, 102, 87, 232, 83, 255, 102, 95, 102, 11, 192, 15, 132, 174, -247, 102, 15, 182, 30, 13, 0, 102, 247, 227, 102, 90, 102, 3, 194, 102, -163, 17, 0, 102, 89, 102, 15, 182, 30, 13, 0, 102, 59, 203, 15, 142, - 19, 0, 137, 30, 22, 0, 102, 43, 203, 102, 88, 102, 3, 195, 102, 80, -102, 81, 235, 20, 144, 102, 88, 102, 3, 193, 102, 80, 137, 14, 22, 0, -102, 185, 0, 0, 0, 0, 102, 81, 6, 102, 87, 139, 223, 131, 227, 15, -140, 192, 102, 193, 239, 4, 3, 199, 80, 7, 232, 5, 247, 102, 95, 7, -102, 3, 62, 82, 2, 102, 89, 102, 88, 102, 131, 249, 0, 15, 143, 112, -255, 102, 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 247, 38, 86, 2, -102, 139, 14, 86, 2, 232, 85, 255, 232, 210, 252, 102, 97, 144, 31, 7, -195, 6, 30, 102, 96, 102, 247, 38, 114, 2, 102, 139, 30, 54, 2, 102, -139, 14, 114, 2, 102, 139, 54, 42, 2, 30, 7, 102, 139, 62, 70, 2, -232, 129, 251, 232, 167, 252, 102, 97, 144, 31, 7, 195, 102, 80, 102, 83, -102, 81, 102, 139, 30, 74, 2, 102, 139, 200, 102, 193, 232, 3, 102, 131, -225, 7, 102, 3, 216, 102, 184, 1, 0, 0, 0, 102, 211, 224, 103, 132, - 3, 15, 132, 4, 0, 248, 235, 2, 144, 249, 102, 89, 102, 91, 102, 88, -195, 103, 128, 123, 8, 1, 15, 132, 4, 0, 102, 43, 192, 195, 103, 102, -141, 115, 16, 103, 102, 139, 86, 8, 102, 59, 194, 15, 135, 11, 0, 103, -102, 139, 22, 102, 59, 194, 15, 131, 4, 0, 102, 43, 192, 195, 103, 3, - 94, 16, 102, 43, 246, 103, 128, 59, 0, 15, 132, 62, 0, 232, 129, 0, -102, 3, 241, 232, 57, 0, 102, 3, 202, 102, 59, 193, 15, 140, 33, 0, -102, 139, 209, 102, 80, 103, 102, 15, 182, 11, 102, 139, 193, 102, 131, 224, - 15, 102, 193, 233, 4, 102, 3, 217, 102, 3, 216, 102, 67, 102, 88, 235, -196, 102, 43, 200, 102, 43, 194, 102, 3, 198, 195, 102, 43, 192, 195, 102, - 43, 201, 103, 138, 11, 128, 225, 15, 102, 131, 249, 0, 15, 133, 4, 0, -102, 43, 201, 195, 102, 83, 102, 82, 102, 3, 217, 103, 102, 15, 190, 19, -102, 73, 102, 75, 102, 131, 249, 0, 15, 132, 13, 0, 102, 193, 226, 8, -103, 138, 19, 102, 75, 102, 73, 235, 235, 102, 139, 202, 102, 90, 102, 91, -195, 102, 83, 102, 82, 102, 43, 210, 103, 138, 19, 102, 131, 226, 15, 102, - 43, 201, 103, 138, 11, 192, 233, 4, 102, 131, 249, 0, 15, 133, 8, 0, -102, 43, 201, 102, 90, 102, 91, 195, 102, 3, 218, 102, 3, 217, 103, 102, - 15, 190, 19, 102, 73, 102, 75, 102, 131, 249, 0, 15, 132, 13, 0, 102, -193, 226, 8, 103, 138, 19, 102, 75, 102, 73, 235, 235, 102, 139, 202, 102, - 90, 102, 91, 195, 102, 11, 201, 15, 133, 1, 0, 195, 102, 81, 102, 86, -103, 131, 62, 97, 15, 140, 12, 0, 103, 131, 62, 122, 15, 143, 4, 0, -103, 131, 46, 32, 102, 131, 198, 2, 226, 230, 102, 94, 102, 89, 195, 102, - 80, 102, 81, 102, 139, 208, 102, 161, 50, 2, 103, 102, 141, 88, 16, 103, - 3, 67, 4, 103, 102, 141, 64, 16, 102, 139, 218, 232, 68, 249, 102, 11, -192, 15, 132, 5, 0, 102, 89, 102, 89, 195, 102, 161, 54, 2, 102, 11, -192, 15, 133, 8, 0, 102, 89, 102, 89, 102, 51, 192, 195, 102, 139, 22, - 54, 2, 103, 102, 141, 82, 16, 103, 102, 139, 66, 24, 102, 51, 210, 102, -247, 54, 110, 2, 102, 51, 246, 102, 80, 102, 86, 102, 88, 102, 94, 102, - 59, 198, 15, 132, 58, 0, 102, 86, 102, 64, 102, 80, 102, 72, 232, 27, -254, 114, 232, 232, 235, 253, 102, 90, 102, 94, 102, 89, 102, 91, 102, 83, -102, 81, 102, 86, 102, 82, 102, 161, 70, 2, 103, 102, 141, 64, 24, 232, -208, 248, 102, 11, 192, 116, 196, 102, 89, 102, 89, 102, 89, 102, 89, 195, -102, 89, 102, 89, 102, 51, 192, 195, 102, 81, 102, 80, 102, 184, 5, 0, - 0, 0, 30, 7, 102, 139, 249, 232, 141, 253, 102, 139, 193, 102, 187, 32, - 0, 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, 0, 0, 0, 0, 232, - 51, 248, 102, 91, 102, 89, 102, 133, 192, 15, 133, 21, 0, 102, 139, 193, -102, 15, 183, 14, 16, 2, 102, 186, 18, 2, 0, 0, 232, 22, 248, 235, - 51, 144, 102, 51, 210, 102, 139, 193, 102, 139, 203, 102, 80, 102, 83, 232, - 35, 0, 102, 91, 102, 95, 102, 11, 192, 15, 132, 23, 0, 30, 7, 232, - 53, 253, 102, 139, 199, 102, 15, 183, 14, 16, 2, 102, 186, 18, 2, 0, - 0, 232, 225, 247, 195, 102, 82, 102, 81, 102, 187, 32, 0, 0, 0, 102, -185, 0, 0, 0, 0, 102, 186, 0, 0, 0, 0, 232, 199, 247, 102, 11, -192, 15, 132, 99, 0, 102, 139, 216, 30, 7, 102, 139, 62, 26, 2, 102, - 51, 192, 232, 89, 248, 30, 7, 102, 139, 30, 26, 2, 102, 89, 102, 90, - 38, 102, 57, 15, 15, 133, 12, 0, 38, 102, 57, 87, 8, 15, 132, 49, - 0, 235, 19, 144, 38, 102, 131, 63, 255, 15, 132, 47, 0, 38, 131, 127, - 4, 0, 15, 132, 38, 0, 38, 102, 15, 183, 71, 4, 3, 216, 139, 195, - 37, 0, 128, 116, 203, 140, 192, 5, 0, 8, 142, 192, 129, 227, 255, 127, -235, 190, 38, 102, 139, 71, 16, 195, 102, 89, 102, 90, 102, 51, 192, 195, -102, 80, 102, 81, 102, 139, 199, 102, 193, 232, 4, 6, 89, 3, 200, 81, - 7, 102, 131, 231, 15, 102, 89, 102, 88, 195, 96, 6, 190, 189, 13, 191, - 0, 32, 30, 7, 185, 13, 0, 144, 243, 165, 7, 97, 195, 1, 35, 69, -103, 137, 171, 205, 239, 254, 220, 186, 152, 118, 84, 50, 16, 240, 225, 210, -195, 0, 0, 0, 0, 32, 32, 96, 139, 54, 24, 32, 38, 138, 5, 136, - 4, 71, 70, 102, 255, 6, 20, 32, 129, 254, 96, 32, 117, 6, 232, 91, - 0, 190, 32, 32, 226, 230, 137, 54, 24, 32, 97, 195, 102, 96, 139, 54, - 24, 32, 176, 128, 136, 4, 70, 50, 192, 129, 254, 96, 32, 117, 6, 232, - 58, 0, 190, 32, 32, 129, 254, 88, 32, 117, 233, 102, 51, 192, 102, 163, - 88, 32, 102, 161, 20, 32, 102, 193, 224, 3, 102, 15, 200, 102, 163, 92, - 32, 232, 24, 0, 187, 0, 32, 102, 139, 7, 102, 15, 200, 102, 137, 7, -131, 195, 4, 129, 251, 52, 32, 117, 238, 102, 97, 195, 102, 96, 187, 32, - 32, 102, 139, 7, 102, 15, 200, 102, 137, 7, 131, 195, 4, 129, 251, 96, - 32, 117, 238, 187, 0, 32, 102, 139, 15, 102, 139, 87, 4, 102, 139, 119, - 8, 102, 139, 127, 12, 102, 139, 111, 16, 187, 32, 32, 199, 6, 26, 32, - 48, 15, 198, 6, 28, 32, 20, 144, 83, 139, 30, 26, 32, 255, 23, 102, - 3, 71, 2, 91, 102, 3, 232, 102, 3, 47, 102, 139, 193, 102, 193, 192, - 5, 102, 3, 197, 102, 139, 239, 102, 139, 254, 102, 139, 242, 102, 193, 198, - 30, 102, 139, 209, 102, 139, 200, 102, 139, 7, 102, 51, 71, 8, 102, 51, - 71, 32, 102, 51, 71, 52, 102, 209, 192, 102, 137, 71, 64, 131, 195, 4, -254, 14, 28, 32, 117, 178, 131, 6, 26, 32, 6, 129, 62, 26, 32, 72, - 15, 117, 159, 187, 0, 32, 102, 1, 15, 102, 1, 87, 4, 102, 1, 119, - 8, 102, 1, 127, 12, 102, 1, 111, 16, 102, 97, 195, 102, 139, 198, 102, - 51, 199, 102, 35, 194, 102, 51, 199, 195, 102, 139, 194, 102, 51, 198, 102, - 51, 199, 195, 102, 83, 102, 139, 194, 102, 35, 198, 102, 139, 218, 102, 35, -223, 102, 11, 195, 102, 139, 222, 102, 35, 223, 102, 11, 195, 102, 91, 195, -252, 14, 153, 121, 130, 90, 9, 15, 161, 235, 217, 110, 19, 15, 220, 188, - 27, 143, 9, 15, 214, 193, 98, 202, 6, 30, 102, 96, 102, 51, 219, 184, - 0, 187, 205, 26, 102, 35, 192, 15, 133, 187, 0, 102, 129, 251, 84, 67, - 80, 65, 15, 133, 176, 0, 129, 249, 2, 1, 15, 130, 168, 0, 102, 97, -144, 31, 7, 6, 30, 102, 96, 103, 128, 123, 8, 0, 15, 133, 12, 0, -103, 102, 141, 83, 16, 103, 102, 139, 10, 235, 37, 144, 103, 102, 141, 83, - 16, 103, 102, 139, 74, 40, 102, 129, 249, 0, 0, 8, 0, 15, 131, 12, - 0, 103, 102, 139, 66, 44, 102, 35, 192, 15, 132, 3, 0, 102, 51, 201, - 14, 31, 232, 245, 253, 102, 35, 201, 15, 132, 50, 0, 102, 186, 0, 128, - 0, 0, 102, 59, 202, 15, 134, 31, 0, 102, 43, 202, 6, 102, 81, 102, - 87, 102, 82, 102, 139, 202, 232, 183, 253, 232, 251, 253, 102, 90, 102, 95, -102, 89, 7, 102, 3, 250, 235, 218, 232, 165, 253, 232, 233, 253, 232, 11, -254, 14, 7, 102, 187, 84, 67, 80, 65, 102, 191, 0, 32, 0, 0, 102, -185, 20, 0, 0, 0, 102, 184, 7, 187, 0, 0, 102, 186, 10, 0, 0, - 0, 102, 51, 246, 205, 26, 102, 97, 144, 31, 7, 195, 160, 249, 1, 233, - 64, 241, 160, 250, 1, 233, 58, 241 -}; +#define BOOTCODE_SIZE 4136 + +/* The "boot code" we put into the filesystem... it writes a message and + * tells the user to try again */ + +#define MSG_OFFSET_OFFSET 3 + +const unsigned char boot_array[BOOTCODE_SIZE] = + + "\xeb\x52\x90" /* jump to code at 0x54 (0x7c54) */ + "NTFS \0" /* NTFS signature */ + + "\0\0\0\0\0\0\0\0\0\0\0\0" /* 72 bytes for device parameters */ + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + /* Boot code run at location 0x7c54 */ + "\x0e" /* push cs */ + "\x1f" /* pop ds */ + "\xbe\x71\x7c" /* mov si, offset message_txt (at location 0x7c71) */ + /* write_msg: */ + "\xac" /* lodsb */ + "\x22\xc0" /* and al, al */ + "\x74\x0b" /* jz key_press */ + "\x56" /* push si */ + "\xb4\x0e" /* mov ah, 0eh */ + "\xbb\x07\x00" /* mov bx, 0007h */ + "\xcd\x10" /* int 10h */ + "\x5e" /* pop si */ + "\xeb\xf0" /* jmp write_msg */ + /* key_press: */ + "\x32\xe4" /* xor ah, ah */ + "\xcd\x16" /* int 16h */ + "\xcd\x19" /* int 19h */ + "\xeb\xfe" /* foo: jmp foo */ + /* message_txt: */ + "This is not a bootable disk. Please insert a bootable floppy and\r\n" + "press any key to try again ... \r\n" + /* At location 0xd4, 298 bytes to reach 0x1fe */ + /* 298 = 4 blocks of 72 then 10 */ + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0" + + "\0\0\0\0\0\0\0\0\0\0" + /* Boot signature at 0x1fe */ + "\x55\xaa"; diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c index 2bd6a3e5..e28ca384 100644 --- a/ntfsprogs/ntfsfix.c +++ b/ntfsprogs/ntfsfix.c @@ -359,7 +359,7 @@ static int clear_sparse(ntfs_attr *na, const char *name) ctx->attr->data_size = cpu_to_sle64(na->data_size); ctx->attr->initialized_size = cpu_to_sle64(na->initialized_size); - ctx->attr->flags = cpu_to_le16(na->data_flags); + ctx->attr->flags = na->data_flags; ctx->attr->compression_unit = 0; ntfs_inode_mark_dirty(ctx->ntfs_ino); NInoFileNameSetDirty(na->ni); diff --git a/ntfsprogs/ntfsrecover.c b/ntfsprogs/ntfsrecover.c index bab6c66a..05bd5d1e 100644 --- a/ntfsprogs/ntfsrecover.c +++ b/ntfsprogs/ntfsrecover.c @@ -1322,7 +1322,7 @@ static void fixup(CONTEXT *ctx, const LOG_RECORD *logr, const char *buf, } printf(" new base MFT record, attr 0x%x (%s)\n",attr,attrname(attr)); printf(" inode %lld\n", - (((long long)le64_to_cpu(logr->target_vcn) + (((long long)sle64_to_cpu(logr->target_vcn) << clusterbits) + (le16_to_cpu(logr->cluster_index) << 9)) >> mftrecbits); @@ -1371,7 +1371,7 @@ static void fixup(CONTEXT *ctx, const LOG_RECORD *logr, const char *buf, printf(" free base MFT record, attr 0x%x (%s)\n", attr,attrname(attr)); printf(" inode %lld\n", - (((long long)le64_to_cpu(logr->target_vcn) << clusterbits) + (((long long)sle64_to_cpu(logr->target_vcn) << clusterbits) + (le16_to_cpu(logr->cluster_index) << 9)) >> mftrecbits); break; case CreateAttribute : /* 5 */ @@ -1880,20 +1880,20 @@ static void detaillogr(CONTEXT *ctx, const LOG_RECORD *logr) (int)le16_to_cpu(logr->attribute_flags)); if (mftrecbits && onmft) printf("target_vcn %016llx (inode %lld)\n", - (long long)le64_to_cpu(logr->target_vcn), - (((long long)le64_to_cpu(logr->target_vcn) + (long long)sle64_to_cpu(logr->target_vcn), + (((long long)sle64_to_cpu(logr->target_vcn) << clusterbits) + (le16_to_cpu(logr->cluster_index) << 9)) >> mftrecbits); else printf("target_vcn %016llx\n", - (long long)le64_to_cpu(logr->target_vcn)); + (long long)sle64_to_cpu(logr->target_vcn)); /* Compute a base for the current run of mft */ - baselcn = le64_to_cpu(logr->lcn_list[0]) - - le64_to_cpu(logr->target_vcn); + baselcn = sle64_to_cpu(logr->lcn_list[0]) + - sle64_to_cpu(logr->target_vcn); for (i=0; ilcns_to_follow) && (ilcn_list[i]); + lcn = sle64_to_cpu(logr->lcn_list[i]); printf(" (%d offs 0x%x) lcn %016llx",i, (int)(8*i + sizeof(LOG_RECORD) - 8), (long long)lcn); @@ -1992,7 +1992,7 @@ static void detaillogr(CONTEXT *ctx, const LOG_RECORD *logr) off = le16_to_cpu(logr->record_offset) + le16_to_cpu(logr->attribute_offset); printf("redo data (new data) cluster 0x%llx pos 0x%x :\n", - (long long)le64_to_cpu(logr->lcn_list[off + (long long)sle64_to_cpu(logr->lcn_list[off >> clusterbits]), (int)(off & (clustersz - 1))); } @@ -2021,7 +2021,7 @@ static void detaillogr(CONTEXT *ctx, const LOG_RECORD *logr) off = le16_to_cpu(logr->record_offset) + le16_to_cpu(logr->attribute_offset); printf("undo data (old data) cluster 0x%llx pos 0x%x :\n", - (long long)le64_to_cpu(logr->lcn_list[off + (long long)sle64_to_cpu(logr->lcn_list[off >> clusterbits]), (int)(off & (clustersz - 1))); } @@ -2120,7 +2120,7 @@ BOOL within_lcn_range(const LOG_RECORD *logr) do { if (le32_eq(logr->record_type, LOG_STANDARD)) { for (i=0; ilcns_to_follow); i++) { - lcn = MREF(le64_to_cpu(logr->lcn_list[i])); + lcn = MREF(sle64_to_cpu(logr->lcn_list[i])); if ((lcn >= firstlcn) && (lcn <= lastlcn)) within = TRUE; } @@ -2709,9 +2709,9 @@ static void showrest(const RESTART_PAGE_HEADER *rest) printf("restart_area_offset %04x\n", (int)le16_to_cpu(rest->restart_area_offset)); printf("minor_vers %d\n", - (int)le16_to_cpu(rest->minor_ver)); + (int)sle16_to_cpu(rest->minor_ver)); printf("major_vers %d\n", - (int)le16_to_cpu(rest->major_ver)); + (int)sle16_to_cpu(rest->major_ver)); printf("usn %04x\n", (int)le16_to_cpu(rest->usn)); printf("\n"); @@ -2740,7 +2740,7 @@ static void showrest(const RESTART_PAGE_HEADER *rest) printf("client_array_offset %04x\n", (int)le16_to_cpu(resa->client_array_offset)); printf("file_size %016llx\n", - (long long)le64_to_cpu(resa->file_size)); + (long long)sle64_to_cpu(resa->file_size)); printf("last_lsn_data_len %08lx\n", (long)le32_to_cpu(resa->last_lsn_data_length)); printf("record_length %04x\n", @@ -2945,8 +2945,8 @@ static const struct BUFFER *read_restart(CONTEXT *ctx) } if (!bad && !ctx->vol) dorest(ctx, 0, &buf->block.restart, TRUE); - major = le16_to_cpu(buf->block.restart.major_ver); - minor = le16_to_cpu(buf->block.restart.minor_ver); + major = sle16_to_cpu(buf->block.restart.major_ver); + minor = sle16_to_cpu(buf->block.restart.minor_ver); if ((major == 2) && (minor == 0)) { if (!optk) { printf("** Fast restart mode detected," @@ -2986,8 +2986,8 @@ static int reset_logfile(CONTEXT *ctx __attribute__((unused))) restart.flags = le16_or(restart.flags, RESTART_VOLUME_IS_CLEAN); client.oldest_lsn = cpu_to_sle64(restart_lsn); /* Set $LogFile version to 1.1 so that volume can be mounted */ - log_header.major_ver = const_cpu_to_le16(1); - log_header.minor_ver = const_cpu_to_le16(1); + log_header.major_ver = const_cpu_to_sle16(1); + log_header.minor_ver = const_cpu_to_sle16(1); memcpy(buffer, &log_header, sizeof(RESTART_PAGE_HEADER)); off = le16_to_cpu(log_header.restart_area_offset); diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c index 8d1d5f96..3eb895fb 100644 --- a/ntfsprogs/ntfsresize.c +++ b/ntfsprogs/ntfsresize.c @@ -2398,7 +2398,7 @@ static void truncate_badclust_bad_attr(ntfs_resize_t *resize) ctx = resize->ctx; ctx->attr->data_size = cpu_to_sle64(na->data_size); ctx->attr->initialized_size = cpu_to_sle64(na->initialized_size); - ctx->attr->flags = cpu_to_le16(na->data_flags); + ctx->attr->flags = na->data_flags; ctx->attr->compression_unit = 0; ntfs_inode_mark_dirty(ctx->ntfs_ino); NInoFileNameSetDirty(na->ni); diff --git a/ntfsprogs/ntfsusermap.c b/ntfsprogs/ntfsusermap.c index 6e0f4203..6c1f61b8 100644 --- a/ntfsprogs/ntfsusermap.c +++ b/ntfsprogs/ntfsusermap.c @@ -237,7 +237,7 @@ static boolean close_volume(const char *volume) { boolean r; - r = ntfs_leave_file_security(ntfs_context); + r = ntfs_leave_file_security(ntfs_context) ? AGREED : DENIED; if (r) fprintf(stderr,"\"%s\" closed\n",volume); else diff --git a/ntfsprogs/ntfswipe.8.in b/ntfsprogs/ntfswipe.8.in index 375b4703..b21e8c9e 100644 --- a/ntfsprogs/ntfswipe.8.in +++ b/ntfsprogs/ntfswipe.8.in @@ -35,7 +35,9 @@ the unused space. BYTE-LIST is a comma-separated list of values in range 0-255 expressed in octal, decimal or hexadecimal base. .TP \fB\-c\fR, \fB\-\-count\fR NUM -Define the number of times the unused space is to be overwritten. +Define the number of times the unused space is to be overwritten. If both +options \fB\-\-bytes\fR and \fB\-\-count\fR are set, the space is +repeatedly overwritten this number of times by each of the values in the list. .TP \fB\-d\fR, \fB\-\-directory\fR Wipe all the directory indexes, which may contain names of deleted files. @@ -68,7 +70,9 @@ Suppress some debug/warning/error messages. .TP \fB\-s\fR, \fB\-\-undel\fR Overwrite the space which had been allocated to a file which has been deleted -recently and is still undeletable. +recently and is still undeletable. This option is not compatible with +\fB\-\-bytes\fR and the replacement bytes are random ones or taken from a +standard list. .TP \fB\-t\fR, \fB\-\-tails\fR Overwrite the space at the end of files which is unused, but allocated diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c index 73abf8b1..458cba7d 100644 --- a/ntfsprogs/ntfswipe.c +++ b/ntfsprogs/ntfswipe.c @@ -403,6 +403,10 @@ static int parse_options(int argc, char *argv[]) } } + if (opts.bytes && opts.undel) { + ntfs_log_error("Options --bytes and --undel are not compatible.\n"); + err++; + } /* Make sure we're in sync with the log levels */ levels = ntfs_log_get_levels(); if (levels & NTFS_LOG_LEVEL_VERBOSE) @@ -1661,12 +1665,12 @@ static void fill_buffer ( /* For other passes, one of the fixed patterns is selected. */ do { #if (!defined __STRICT_ANSI__) && (defined HAVE_RANDOM) - i = (size_t)(random() % NPAT); + i = (size_t)random() % NPAT; #else - i = (size_t)(rand() % NPAT); + i = (size_t)rand() % NPAT; #endif } while (selected[i] == 1); - bits = opts.bytes[i]; + bits = patterns[i]; selected[i] = 1; } @@ -2123,6 +2127,9 @@ static void print_summary(void) ntfs_log_quiet("0x%02x ", opts.bytes[i]); } ntfs_log_quiet("\n"); + if (opts.undel) + ntfs_log_quiet("(however undelete data will be overwritten" + " by random values)\n"); if (opts.count > 1) ntfs_log_quiet("%s will repeat these operations %d times.\n", EXEC_NAME, opts.count); diff --git a/ntfsprogs/playlog.c b/ntfsprogs/playlog.c index f09c8823..1d824836 100644 --- a/ntfsprogs/playlog.c +++ b/ntfsprogs/playlog.c @@ -122,7 +122,7 @@ static u64 inode_number(const LOG_RECORD *logr) { u64 offset; - offset = ((u64)le64_to_cpu(logr->target_vcn) + offset = ((u64)sle64_to_cpu(logr->target_vcn) << clusterbits) + ((u32)le16_to_cpu(logr->cluster_index) << NTFS_BLOCK_SIZE_BITS); @@ -431,7 +431,7 @@ static char *read_raw(ntfs_volume *vol, const LOG_RECORD *logr) fail = FALSE; for (i=0; (ilcn_list[i]); + lcn = sle64_to_cpu(logr->lcn_list[i]); target = buffer + clustersz*i; if (optn) { store = getclusterentry(lcn, FALSE); @@ -494,7 +494,7 @@ static int write_raw(ntfs_volume *vol, const LOG_RECORD *logr, printf("** Error : no lcn to write to\n"); if (optn) { for (i=0; (ilcn_list[i]); + lcn = sle64_to_cpu(logr->lcn_list[i]); source = buffer + clustersz*i; store = getclusterentry(lcn, TRUE); if (store) { @@ -513,7 +513,7 @@ static int write_raw(ntfs_volume *vol, const LOG_RECORD *logr, } } else { for (i=0; (ilcn_list[i]); + lcn = sle64_to_cpu(logr->lcn_list[i]); if (optv) printf("== lcn 0x%llx to device\n", (long long)lcn); @@ -549,7 +549,7 @@ static int write_mirr(ntfs_volume *vol, const LOG_RECORD *logr, if (!optn) { for (i=0; (imftmirr_na, - le64_to_cpu(logr->target_vcn) + i); + sle64_to_cpu(logr->target_vcn) + i); source = buffer + clustersz*i; if ((lcn < 0) || (ntfs_pwrite(vol->dev, lcn << clusterbits, @@ -594,7 +594,7 @@ static char *read_protected(ntfs_volume *vol, const LOG_RECORD *logr, if (buffer && (ntfs_mst_post_read_fixup_warn( (NTFS_RECORD*)buffer, size, FALSE) < 0)) { if (warn) { - lcn = le64_to_cpu(logr->lcn_list[0]); + lcn = sle64_to_cpu(logr->lcn_list[0]); printf("** Invalid protected record at 0x%llx" " index %d\n", (long long)lcn, @@ -642,14 +642,14 @@ static int write_protected(ntfs_volume *vol, const LOG_RECORD *logr, (long long)sle64_to_cpu(logr->this_lsn)); if (optv > 1) printf("mft vcn %lld index %d\n", - (long long)le64_to_cpu(logr->target_vcn), + (long long)sle64_to_cpu(logr->target_vcn), (int)le16_to_cpu(logr->cluster_index)); err = sanity_mft(buffer); /* Should set to some previous lsn for undos */ if (opts) record->lsn = logr->this_lsn; /* Duplicate on mftmirr if not overflowing its size */ - mftmirr = (((u64)le64_to_cpu(logr->target_vcn) + mftmirr = (((u64)sle64_to_cpu(logr->target_vcn) + le16_to_cpu(logr->lcns_to_follow)) << clusterbits) <= (((u64)vol->mftmirr_size) << mftrecbits); @@ -859,7 +859,7 @@ static int change_resident(ntfs_volume *vol, const struct ACTION_RECORD *action, if (!le16_eq(action->record.undo_length, action->record.redo_length)) printf("** Error size change in change_resident\n"); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -913,7 +913,7 @@ static int change_resident_expect(ntfs_volume *vol, const struct ACTION_RECORD * if (!le16_eq(action->record.undo_length, action->record.redo_length)) printf("** Error size change in change_resident\n"); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -965,7 +965,7 @@ static int change_index_value(ntfs_volume *vol, const struct ACTION_RECORD *acti err = 1; count = le16_to_cpu(action->record.lcns_to_follow); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -1010,7 +1010,7 @@ static int add_resident(ntfs_volume *vol, const struct ACTION_RECORD *action, err = 1; if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -1092,7 +1092,7 @@ static int expand_resident(ntfs_volume *vol, const struct ACTION_RECORD *action, err = 1; if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -1175,7 +1175,7 @@ static int insert_resident(ntfs_volume *vol, const struct ACTION_RECORD *action, err = 1; if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -1257,7 +1257,7 @@ static int remove_resident(ntfs_volume *vol, const struct ACTION_RECORD *action, err = 1; if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -1343,7 +1343,7 @@ static int delete_resident(ntfs_volume *vol, const struct ACTION_RECORD *action, printf("-> %s()\n",__func__); err = 1; if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -1403,7 +1403,7 @@ static int shrink_resident(ntfs_volume *vol, const struct ACTION_RECORD *action, printf("-> %s()\n",__func__); err = 1; if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -1479,7 +1479,7 @@ static int update_index(ntfs_volume *vol, const struct ACTION_RECORD *action, err = 1; if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -1787,7 +1787,7 @@ static int create_indx(ntfs_volume *vol, const struct ACTION_RECORD *action, indx->usa_ofs = const_cpu_to_le16(0x28); indx->usa_count = const_cpu_to_le16(9); indx->lsn = action->record.this_lsn; - vcn = le64_to_cpu(action->record.target_vcn); + vcn = sle64_to_cpu(action->record.target_vcn); /* beware of size change on big-endian cpus */ indx->index_block_vcn = cpu_to_sle64(vcn); /* INDEX_HEADER */ @@ -1866,7 +1866,7 @@ static int redo_add_index(ntfs_volume *vol, const struct ACTION_RECORD *action, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -1929,7 +1929,7 @@ static int redo_add_root_index(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -2007,7 +2007,7 @@ static int redo_create_file(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -2105,7 +2105,7 @@ static int redo_delete_file(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -2161,7 +2161,7 @@ static int redo_delete_index(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -2220,7 +2220,7 @@ static int redo_delete_root_index(ntfs_volume *vol, + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -2289,7 +2289,7 @@ static int redo_force_bits(ntfs_volume *vol, // TODO consistency undo_offset == redo_offset, etc. // firstbit + count < 8*clustersz (multiple clusters possible ?) if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx firstbit %d count %d wanted %d\n", (long long)lcn,(int)firstbit,(int)count,(int)wanted); } @@ -2476,7 +2476,7 @@ static int redo_update_mapping(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -2567,7 +2567,7 @@ static int redo_update_resident(ntfs_volume *vol, + le16_to_cpu(action->record.attribute_offset); if (length == oldlength) { if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x" " length %d\n", (long long)inode_number(&action->record), @@ -2688,7 +2688,7 @@ static int redo_update_value(ntfs_volume *vol, + le16_to_cpu(action->record.attribute_offset); count = le16_to_cpu(action->record.lcns_to_follow); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -2775,7 +2775,7 @@ static int redo_write_end(ntfs_volume *vol, + le16_to_cpu(action->record.attribute_offset); if (length == oldlength) { if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x" " length %d\n", (long long)inode_number(&action->record), @@ -2835,7 +2835,7 @@ static int redo_write_index(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -2924,7 +2924,7 @@ static int undo_add_index(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -2986,7 +2986,7 @@ static int undo_add_root_index(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -3094,7 +3094,7 @@ static int undo_delete_index(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -3160,7 +3160,7 @@ static int undo_delete_root_index(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -3232,7 +3232,7 @@ static int undo_create_file(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -3283,7 +3283,7 @@ static int undo_delete_file(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -3359,7 +3359,7 @@ static int undo_force_bits(ntfs_volume *vol, // TODO consistency undo_offset == redo_offset, etc. // firstbit + count < 8*clustersz (multiple clusters possible ?) if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx firstbit %d count %d wanted %d\n", (long long)lcn,(int)firstbit,(int)count,(int)wanted); } @@ -3526,7 +3526,7 @@ static int undo_update_index_value(ntfs_volume *vol, target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -3602,7 +3602,7 @@ static int undo_update_mapping(ntfs_volume *vol, const struct ACTION_RECORD *act target = le16_to_cpu(action->record.record_offset) + le16_to_cpu(action->record.attribute_offset); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x new length %d resize %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length, (int)resize); @@ -3694,7 +3694,7 @@ static int undo_update_resident(ntfs_volume *vol, + le16_to_cpu(action->record.attribute_offset); if (length == oldlength) { if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x length %d\n", (long long)inode_number(&action->record), (long long)lcn, (int)target, (int)length); @@ -3805,7 +3805,7 @@ static int undo_update_value(ntfs_volume *vol, + le16_to_cpu(action->record.attribute_offset); count = le16_to_cpu(action->record.lcns_to_follow); if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> lcn 0x%llx target 0x%x length %d\n", (long long)lcn, (int)target, (int)length); } @@ -3873,7 +3873,7 @@ static int undo_write_end(ntfs_volume *vol, + le16_to_cpu(action->record.attribute_offset); if (length == oldlength) { if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x" " length %d\n", (long long)inode_number(&action->record), @@ -3940,7 +3940,7 @@ static int undo_write_index(ntfs_volume *vol, + le16_to_cpu(action->record.attribute_offset); if (length == oldlength) { if (optv > 1) { - lcn = le64_to_cpu(action->record.lcn_list[0]); + lcn = sle64_to_cpu(action->record.lcn_list[0]); printf("-> inode %lld lcn 0x%llx target 0x%x" " length %d\n", (long long)inode_number(&action->record),