Fix Windows Timestamps for Alternate Data Streams #837
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Should this target
develop
ormaster
?Summary
This PR changes
mz_os_get_file_date
to useGetFileAttributesExW
instead ofFindFirstFileW
, becauseFindFirstFileW
fails on Windows Alternate Data Streams.Description
mz_os_get_file_date
usesFindFirstFileW
, which doesn't support Windows Alternate Data Streams (ADS). The failed return value ofmz_os_get_file_date
is not checked bymz_zip_writer_add_file
. When an ADS is compressed withmz_zip_writer_add_file
, the resulting entry has all-zero timestamps. When we attempted to extract this file using various applications (Windows Explorer, 7-Zip, Python), the CRC check would fail. In python, the failure was here. When we commented out that check, the file extracted correctly.Testing
The old implementation fails the new gtest:
The new implementation passes: