[PATCH] Fix stat.st_blocks for files compressed with CompactOS method
Corinna Vinschen
corinna-cygwin@cygwin.com
Sat Apr 22 13:59:00 GMT 2017
Hi Christian,
On Apr 22 14:50, Christian Franke wrote:
> Cygwin 2.8.0 returns stat.st_blocks = 0 if a file is compressed with
> CompactOS method (at least on Win10 1607):
> [...]
> This is because StandardInformation.AllocationSize is always 0 for theses
> files. CompressedFileSize returns the correct value.
>
> This is likely related to the interesting method how these files are encoded
> in the MFT:
> The default $DATA stream is a sparse stream with original size but no
> allocated blocks.
> An alternate $DATA stream WofCompressedData contains the compressed data.
> An additional $REPARSE_POINT possibly marks this file a special and lets
> accesses fail on older Windows releases (and on Linux, most current forensic
> tools, ...).
>
> With the attached patch, stat.st_blocks work as expected:
> [...]
> - else if (::has_attribute (attributes, FILE_ATTRIBUTE_COMPRESSED
> - | FILE_ATTRIBUTE_SPARSE_FILE)
> + else if ((pfai->StandardInformation.AllocationSize.QuadPart == 0LL
> + || ::has_attribute (attributes, FILE_ATTRIBUTE_COMPRESSED
> + | FILE_ATTRIBUTE_SPARSE_FILE))
Are you saying these files actually have no FILE_ATTRIBUTE_COMPRESSED
bit set???
Thanks,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20170422/3604ceb2/attachment.sig>
More information about the Cygwin-patches
mailing list