win32_apply.c: don't clear directory attributes in NO_ATTRIBUTES mode
authorEric Biggers <ebiggers3@gmail.com>
Wed, 25 Nov 2015 04:18:48 +0000 (22:18 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 19 Dec 2015 16:31:10 +0000 (10:31 -0600)
src/win32_apply.c

index 3474073..4c2f97d 100644 (file)
@@ -1661,9 +1661,13 @@ retry:
                 * directory, even though this contradicts Microsoft's
                 * documentation for FILE_ATTRIBUTE_READONLY which states it is
                 * not honored for directories!  */
-               FILE_BASIC_INFORMATION basic_info = { .FileAttributes = FILE_ATTRIBUTE_NORMAL };
-               (*func_NtSetInformationFile)(h, &ctx->iosb, &basic_info,
-                                            sizeof(basic_info), FileBasicInformation);
+               if (!(ctx->common.extract_flags & WIMLIB_EXTRACT_FLAG_NO_ATTRIBUTES)) {
+                       FILE_BASIC_INFORMATION basic_info =
+                               { .FileAttributes = FILE_ATTRIBUTE_NORMAL };
+                       (*func_NtSetInformationFile)(h, &ctx->iosb, &basic_info,
+                                                    sizeof(basic_info),
+                                                    FileBasicInformation);
+               }
 
                /* Also try to remove the directory's DACL.  This isn't supposed
                 * to be necessary because we *always* use backup semantics.