Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/duplicati/duplicati.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik <30193551+verhoek@users.noreply.github.com>2019-11-27 13:38:27 +0300
committerGitHub <noreply@github.com>2019-11-27 13:38:27 +0300
commit057a0122774dcc4e77556514b8ade510cc124f1f (patch)
tree7ee57c164da8342a35b6986d879ae30b6e864b3d
parentc37eb1680dab0c81e35853987e013989dd58dbb3 (diff)
parent942d8b820df66c8d0c81a35e13323a28c25e54c8 (diff)
Merge pull request #3998 from drwtsn32x/fix-attribute-masking
Disable file attribute masking on Windows 10
-rwxr-xr-xDuplicati/Library/Main/ProcessController.cs27
-rw-r--r--Duplicati/Library/Utility/Win32.cs22
2 files changed, 49 insertions, 0 deletions
diff --git a/Duplicati/Library/Main/ProcessController.cs b/Duplicati/Library/Main/ProcessController.cs
index acbba2fc6..dd7c2f794 100755
--- a/Duplicati/Library/Main/ProcessController.cs
+++ b/Duplicati/Library/Main/ProcessController.cs
@@ -235,6 +235,31 @@ namespace Duplicati.Library.Main
}
/// <summary>
+ /// Expose all filesystem attributes
+ /// </summary>
+ private static void ExposeAllFilesystemAttributes()
+ {
+ // Starting with Windows 10 1803, the operating system may mask the process's view of some
+ // file attributes such as reparse, offline, and sparse.
+ //
+ // This function will turn off such masking.
+ //
+ // See https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-rtlqueryprocessplaceholdercompatibilitymode
+
+ if (Platform.IsClientWindows)
+ {
+ try
+ {
+ Win32.RtlSetProcessPlaceholderCompatibilityMode(Win32.PHCM_VALUES.PHCM_EXPOSE_PLACEHOLDERS);
+ }
+ catch
+ {
+ // Ignore exceptions - not applicable on this version of Windows
+ }
+ }
+ }
+
+ /// <summary>
/// Starts the process controller
/// </summary>
/// <param name="options">The options to use</param>
@@ -245,6 +270,8 @@ namespace Duplicati.Library.Main
if (options.UseBackgroundIOPriority)
ActivateBackgroundIOPriority();
+
+ ExposeAllFilesystemAttributes();
}
/// <summary>
diff --git a/Duplicati/Library/Utility/Win32.cs b/Duplicati/Library/Utility/Win32.cs
index 1c1f4a331..8b56a7e2a 100644
--- a/Duplicati/Library/Utility/Win32.cs
+++ b/Duplicati/Library/Utility/Win32.cs
@@ -170,6 +170,19 @@ namespace Duplicati.Library.Utility
MaxProcessInfoClass
}
+ /// <summary>
+ /// Placeholder Compatibility Mode values
+ /// </summary>
+ public enum PHCM_VALUES : sbyte
+ {
+ PHCM_APPLICATION_DEFAULT = 0,
+ PHCM_DISGUISE_PLACEHOLDER = 1,
+ PHCM_EXPOSE_PLACEHOLDERS = 2,
+ PHCM_MAX = 2,
+ PHCM_ERROR_INVALID_PARAMETER = -1,
+ PHCM_ERROR_NO_TEB = -2,
+ }
+
#endregion
#region Function calls
@@ -227,6 +240,15 @@ namespace Duplicati.Library.Utility
/// <param name="handle">A handle to the process. The handle must have the PROCESS_SET_INFORMATION access right.</param>
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern PROCESS_PRIORITY_CLASS GetPriorityClass(IntPtr handle);
+
+ /// <summary>
+ /// Sets the current placeholder compatibility mode for the process.
+ /// </summary>
+ /// <returns>The previous <see cref="PHCM_VALUES"/> value.</returns>
+ /// <param name="pcm">New value to set.</param>
+ [DllImport("ntdll.dll")]
+ public static extern PHCM_VALUES RtlSetProcessPlaceholderCompatibilityMode(PHCM_VALUES pcm);
+
#endregion
}
}