From 985a3a9191a07b8def58315afa5a88e71cf9f1d4 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Fri, 26 Apr 2013 23:23:11 -0500 Subject: [PATCH 1/1] win32_set_special_attributes(): Skip compression IOCTL on encrypted files --- src/win32.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/win32.c b/src/win32.c index e9bdeeb8..a591dd60 100644 --- a/src/win32.c +++ b/src/win32.c @@ -1663,24 +1663,26 @@ win32_set_special_attributes(HANDLE hFile, const struct wim_inode *inode, { int ret; - if (vol_flags & FILE_FILE_COMPRESSION) { - - USHORT format; - if (inode->i_attributes & FILE_ATTRIBUTE_COMPRESSED) { - format = COMPRESSION_FORMAT_DEFAULT; - DEBUG("Setting compression flag on \"%ls\"", path); + /* Encrypted files cannot be [de]compressed. */ + if (!(inode->i_attributes & FILE_ATTRIBUTE_ENCRYPTED)) { + if (vol_flags & FILE_FILE_COMPRESSION) { + USHORT format; + if (inode->i_attributes & FILE_ATTRIBUTE_COMPRESSED) { + format = COMPRESSION_FORMAT_DEFAULT; + DEBUG("Setting compression flag on \"%ls\"", path); + } else { + format = COMPRESSION_FORMAT_NONE; + DEBUG("Clearing compression flag on \"%ls\"", path); + } + ret = win32_set_compression_state(hFile, format, path); + if (ret) + return ret; } else { - format = COMPRESSION_FORMAT_NONE; - DEBUG("Clearing compression flag on \"%ls\"", path); - } - ret = win32_set_compression_state(hFile, format, path); - if (ret) - return ret; - } else { - if (inode->i_attributes & FILE_ATTRIBUTE_COMPRESSED) { - DEBUG("Cannot set compression attribute on \"%ls\": " - "volume does not support transparent compression", - path); + if (inode->i_attributes & FILE_ATTRIBUTE_COMPRESSED) { + DEBUG("Cannot set compression attribute on \"%ls\": " + "volume does not support transparent compression", + path); + } } } -- 2.43.0