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 @@ -234,6 +234,31 @@ namespace Duplicati.Library.Main } } + /// + /// Expose all filesystem attributes + /// + 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 + } + } + } + /// /// Starts the process controller /// @@ -245,6 +270,8 @@ namespace Duplicati.Library.Main if (options.UseBackgroundIOPriority) ActivateBackgroundIOPriority(); + + ExposeAllFilesystemAttributes(); } /// 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 } + /// + /// Placeholder Compatibility Mode values + /// + 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 /// A handle to the process. The handle must have the PROCESS_SET_INFORMATION access right. [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern PROCESS_PRIORITY_CLASS GetPriorityClass(IntPtr handle); + + /// + /// Sets the current placeholder compatibility mode for the process. + /// + /// The previous value. + /// New value to set. + [DllImport("ntdll.dll")] + public static extern PHCM_VALUES RtlSetProcessPlaceholderCompatibilityMode(PHCM_VALUES pcm); + #endregion } }