Eric Biggers [Sun, 8 Dec 2013 06:07:37 +0000 (00:07 -0600)]
Merge LZX compressor updates
- Use a suffix array-based match-finder (construction code borrowed from
libdivsufsort). Ideal for this case because compression in WIM chunks
does not use a sliding window.
- Disable block splitting by default (no efficient and effective
algorithm is available yet)
Eric Biggers [Sat, 7 Dec 2013 00:40:57 +0000 (18:40 -0600)]
xml.c: Fix writing <WINDOWS> element
A positive return value of xmlTextWriterEndElement would be incorrectly
passed up the call chain, causing an unexpected error when writing the
XML data.
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.