Eric Biggers [Tue, 28 Aug 2012 05:24:28 +0000 (00:24 -0500)]
dentry_first_lte() -> dentry_unnamed_lte()
This probably doesn't make a difference, but when we were looking for the
"first" lookup table entry what we really wanted was to find the lookup table
for the un-named data stream, even if it's in an alternate data stream rather
than the expected location in the dentry.
Eric Biggers [Tue, 28 Aug 2012 03:12:52 +0000 (22:12 -0500)]
More ADS and dentry alignment and padding issues
So... I think that ALL the filename fields (short name, file name, stream name)
actually have a 2-byte null terminator, but NOT if that field has zero length.
This is now taken into account.
A warning is now issued if the dentry length is unexpectedly large.
We will now write all dentries with the "canonical" length regardless of what
dentry length was read in (as we are throwing out whatever junk was appended to
it anyway...).
Eric Biggers [Tue, 28 Aug 2012 01:48:00 +0000 (20:48 -0500)]
ADS entry reading: minor changes
- Make sure the length field of each ADS entry makes sense.
- Allow an ADS entry at the end of the metadata resource to contain no padding
following it (probably isn't necessary, but who knows--- best to make the code
able to handle these weird cases).
Eric Biggers [Tue, 28 Aug 2012 01:13:20 +0000 (20:13 -0500)]
Reviewed code in dentry.c and {read,write}_metadata_resource()
- Added lots of comments.
- Fix writing the metadata resource when there is security data with length that
isn't a multiple of 8 bytes.
- write_dentry_tree() is now a wrapper around write_dentry_tree_recursive(), the
latter of which does not need to treat the root dentry specially.
Eric Biggers [Mon, 27 Aug 2012 03:52:18 +0000 (22:52 -0500)]
Exclusion paths updates
- Strip drive letter if given.
- Allow paths relative to capture root to begin with a non-slash character,
provided that they contain another slash somewhere in them (otherwise they are
interpreted as a filename pattern).
Eric Biggers [Mon, 27 Aug 2012 03:32:09 +0000 (22:32 -0500)]
Image capture configuration
Support a capture configuration file like Microsoft's imagex.exe does. It lets
you specify patterns of files to exclude from capture, exclude from compression,
or align within the WIM file. Currently, only the exclusion list is
implemented. --config options have been added to `imagex capture' and `imagex
append'.
Eric Biggers [Sun, 26 Aug 2012 23:46:47 +0000 (18:46 -0500)]
Misc fixes
- Remove code pertaining to root permissions. We don't need to be root to do a
NTFS apply anymore.
- Improve comments on fields of `struct dentry'.
- Another fix to hard-link creation in the NTFS apply. We close the directory
inode before opening the target inode and re-opening the directory inode, so
that we can make sure the directory inode will not be opened twice at the same
time.
Eric Biggers [Sat, 25 Aug 2012 18:58:11 +0000 (13:58 -0500)]
NTFS apply updates
- Hard link creation code fixed and uncommented. We need to close the source
directory inode before the target inode.
- Code to set DOS filenames added but commented out due to a problem.
- New function wim_apply_dentry_timestamps() to apply timestamps to dentry, run
in a depth-first traversal of the directory tree following the main WIM
application.
Eric Biggers [Fri, 24 Aug 2012 00:44:42 +0000 (19:44 -0500)]
Code to handle some weird siutations and bad WIMs
- read_lookup_table(): It is now an error if uncompressed resources have
different compressed and uncompressed size.
- read_lookup_table(): It is now an error if two lookup table entries have the
same SHA1 message digest.
- write_metadata_resource(): Append 20 random bytes to the end of the metadata
resource to make the metadata resource unique even if we capture exactly the
same image again.
Eric Biggers [Thu, 23 Aug 2012 14:50:42 +0000 (09:50 -0500)]
Finally fixed most of the problems with the new resource code.
Also, write_wim_resource() will now verify the SHA1 message digest when writing
a WIM resource. This makes it possible to detect concurrent modifications of
the directory tree when capturing a WIM.
Eric Biggers [Wed, 22 Aug 2012 04:40:57 +0000 (23:40 -0500)]
Rewritten functions for reading and writing resources
Functions for reading and writing compressed and uncompressed resources have
been rewritten to reduce code duplication and simplify the interface to the rest
of the code.
Eric Biggers [Tue, 21 Aug 2012 22:17:36 +0000 (17:17 -0500)]
Add modified security.c from NTFS-3g
This simplifies WIM application because we can modifiy
ntfs_set_file_attributes() and ntfs_set_file_security() to take ntfs_inodes
instead of pathnodes, and we can also get rid of the SECURITY_API structure.
Eric Biggers [Sun, 19 Aug 2012 22:32:15 +0000 (17:32 -0500)]
Hard link fix
I'm noticing weird things in the Windows 7 install.wim file where WIM dentries
are marked as being in the same hard link set, but the dentries have differences
such as different file streams or different file permissions. I'm working
around the problem by splitting these offending dentries into their own hard
link groups.