Eric Biggers [Wed, 13 Nov 2013 02:48:43 +0000 (20:48 -0600)]
Add ADS entry workaround
Some versions of Microsoft's WIM software (the boot driver(s) in WinPE
3.0, for example) contain a bug where they assume the first alternate
data stream (ADS) entry of a dentry with a nonzero ADS count specifies
the unnamed stream, even if it has a name and the unnamed stream is
already specified in the hash field of the dentry itself.
wimlib now works around this behavior by carefully emulating the behavior
of (most versions of) ImageX/WIMGAPI, which move the unnamed stream
reference into the alternate stream entries whenever there are named data
streams, even though there is already a field in the dentry itself for
the unnamed stream reference, which then goes to waste.
Eric Biggers [Sun, 3 Nov 2013 05:01:23 +0000 (00:01 -0500)]
write.c: Fix two minor bugs in error paths
- Ensure that overwrite_wim_inplace() restores the original header if it
is unable to complete successfully.
- If overwrite_wim_inplace() fails after having set
WIM_HDR_FLAG_WRITE_IN_PROGRESS in the physical file's header, attempt
to clear it.
According to C99 6.5.6.8, calculating a pointer that points before the
allocated object has undefined behavior. However, this was done by
lzx_decode_match() and xpress_decode_match() if they received a match
pointing before the end of the window (invalid match offset). This
commit fixes this check to be fully defined.
This change likely has no visible effect in actual builds, e.g. with gcc.
Eric Biggers [Sat, 12 Oct 2013 00:11:41 +0000 (19:11 -0500)]
lzx-decompress.c: Fix alignment bug
The pretree decode table was not declared to be 16 byte aligned, as
expected by make_huffman_decode_table().
This bug had no effect if the compiler aligned this table on a 16 byte
boundary anyway, but if not it caused a segmentation fault on x86 platforms
where the SSE2 instructions were available, since in that case stores
requiring 16 byte alignment are used to fill in table entries.
Eric Biggers [Mon, 2 Sep 2013 14:03:55 +0000 (09:03 -0500)]
dentry_extract_skeleton(): Fix bug with DOS name reordering
When choosing a different dentry for an inode being extracted, the code didn't
check if it was actually in the tree being extracted.
This bug could cause an infinite loop in extraction backends that required DOS
name reordering and also allowed extracting only a subset of an image---
currently, just the Windows backend.
Eric Biggers [Sun, 1 Sep 2013 06:23:44 +0000 (01:23 -0500)]
Replace WIMLIB_OPEN_FLAG_SPLIT_OK with WIMLIB_OPEN_FLAG_ERROR_IF_SPLIT
Having to specify a special flag to open split WIM parts is no longer very
useful, since error codes will be automatically be issued when needed metadata
or file resources are not found, and this flag wouldn't affect delta WIMs which
resemble split WIMs anyway, and clients could just check themselves whether a
WIM is split. Therefore, make the default be like WIMLIB_OPEN_FLAG_SPLIT_OK,
but for completeness offer a flag WIMLIB_OPEN_FLAG_ERROR_IF_SPLIT to get
behavior like the old default.
Eric Biggers [Sun, 1 Sep 2013 00:02:33 +0000 (19:02 -0500)]
win32_capture_streams(): Handle not implemented/supported
If NtQueryInformationFile() returns STATUS_NOT_IMPLEMENTED,
STATUS_NOT_SUPPORTED, or STATUS_INVALID_INFO_CLASS when
FileStreamInformation is requested, fall back to FindFirstStream() and
FindNextStream() instead (which themselves have a fallback behavior).
Eric Biggers [Sat, 31 Aug 2013 23:29:41 +0000 (18:29 -0500)]
Win32: Define _CRT_NON_CONFORMING_SWPRINTFS
To get the "old" swprintf() declaration with all versions of MinGW, at
least until the code is fixed to use the standard form, define
_CRT_NON_CONFORMING_SWPRINTFS.
Eric Biggers [Tue, 20 Aug 2013 00:17:36 +0000 (19:17 -0500)]
Generalized support for referencing resources in external WIMs
In preparation for supporting "delta" WIMs, this commit generalizes the library
interface for handling split WIMs.
Instead of cluttering up various functions with additional split WIM parameters,
there is now a function wimlib_reference_resource_files() available that can
load additional resources (e.g. from a split WIM part) into a WIMStruct that has
metadata available (e.g. the first part of a split WIM, or a standalone WIM).
wimlib_reference_resource_files() can handle file globbing by itself, so it
actually makes it easier for library users to process split WIMs.
Lower-level APIs wimlib_reference_resources() and wimlib_unreference_resources()
are also provided, but not yet used directly by `wimlib-imagex'.
Some instances of WIMLIB_ERR_SPLIT_UNSUPPORTED error returns were changed to
the new error code WIMLIB_ERR_METADATA_NOT_FOUND.
This commit also re-writes wimlib_export_image() to correctly roll back changes
on multi-image exports and better handle resources in the source WIM being
missing, as well as add a flag to make all destination image(s) unnamed.
Eric Biggers [Sun, 18 Aug 2013 19:25:10 +0000 (14:25 -0500)]
extract.c: Fix extraction of streams of hard-linked files
Due to the re-ordering of dentries in a directory to extract correct DOS names,
was_hardlinked could be set on the dentry referenced by a stream, thereby
causing the stream not to be extracted. Fix by having each stream reference all
possible dentries.