+ /* DELETE access is needed for SetFileShortNameW(), for some reason.
+ * But don't request it for the extraction root, for the following
+ * reasons:
+ *
+ * - Requesting DELETE access on the extraction root will cause a
+ * sharing violation if the extraction root is the current working
+ * directory (".").
+ * - The extraction root may be extracted to a different name than given
+ * in the WIM file, in which case the DOS name, if given, would not be
+ * meaningful.
+ * - For full-image extractions, the root dentry is supposed to be
+ * unnamed anyway.
+ * - Microsoft's ImageX does not extract the root directory.
+ */
+ if (dentry != args->extract_root)
+ requestedAccess |= DELETE;