Explorer does NOT copy Alternative Data Streams for folders

William 96 Reputation points
2020-11-30T06:57:01.237+00:00

While copying a file with ADS to another drive(NTFS to NTFS) works as expected (ADS are copied too)
copying a folder with ADS does not work. ADStreams are NOT copied.

It used to work on Win7. Is it a bug?
Is it related to previous bug, about attributes not being copied?
details here:
https://social.technet.microsoft.com/Forums/en-US/8ab1a753-9a63-4273-8ba4-0d0748cc9ac0/folder-attributescustomization-lost-on-copy-or-move-in-windows-10-1607-anniversary-update?forum=win10itprogeneral

Is it by design?
This brakes compatibility in a big way.
ADS are extremely useful NTFS feature, and many programs depend on it.

Please do not provide workarounds, I know there are workarounds(xcopy /k) etc
If someone informed could tell me
I need to know if this is a bug or by design.

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,674 questions
Sysinternals
Sysinternals
Advanced system utilities to manage, troubleshoot, and diagnose Windows and Linux systems and applications.
1,093 questions
{count} votes

4 additional answers

Sort by: Most helpful
  1. Gary Nebbett 5,721 Reputation points
    2020-12-09T16:05:32.763+00:00

    Hello @William ,

    When I first read your message, I missed one important point: "It used to work on Win7".

    I tested this on Windows 8.0, and it doesn't work there and probably doesn't work on any version of Windows after Windows 7.

    The IFileOperation interface (which is indeed used by explorer) makes no mention of alternate data streams (and therefore makes no guarantees about them).

    When copying plain files, IFileOperation ultimately calls CopyFile2 - which is documented as preserving alternate data streams.

    KERNELBASE!CopyFile2+0x101  
    windows_storage!CFSTransfer::_PerformCopyFileWithRetry+0xc4  
    windows_storage!CFSTransfer::CopyItem+0x105  
    windows_storage!CCopyOperation::_CreateDestinationOrCopyItemWithRetry+0xc3  
    [...]  
    windows_storage!CFileOperation::PerformOperations+0x104  
    

    When copying directories, the code in Windows.Storage.dll just calls CreateDirectory and NtSetInformationFile to implement the copy:

    KERNELBASE!CreateDirectoryW+0xe2  
    windows_storage!CFSTransfer::DestinationCreateRetryLoop+0x83  
    windows_storage!CFSTransfer::DestinationCreate+0x1b1  
    windows_storage!CFSTransfer::_CreateFileWithRetry+0x52  
    windows_storage!CFSTransfer::CopyItem+0x1edd25  
    windows_storage!CCopyOperation::_CreateDestinationOrCopyItemWithRetry+0xc3  
    [...]  
    windows_storage!CFileOperation::PerformOperations+0x104  
      
    ntdll!NtSetInformationFile+0x14  
    windows_storage!CFSTransfer::DestinationCreateRetryLoop+0x50b  
    windows_storage!CFSTransfer::DestinationCreate+0x1b1  
    windows_storage!CFSTransfer::_CreateFileWithRetry+0x52  
    windows_storage!CFSTransfer::CopyItem+0x1edd25  
    windows_storage!CCopyOperation::_CreateDestinationOrCopyItemWithRetry+0xc3  
    [...]  
    windows_storage!CFileOperation::PerformOperations+0x104  
    

    I can't verify the Windows 7 behaviour, but the majority of Windows users are running versions of Windows that do not preserve directory alternate data streams when copying them with the IFileOperation interface.

    Regardless of whether this was a "by design" choice or just an oversight during the re-factoring of the implementation of IFileOperation after Windows 7, you have no choice but to accept this state of affairs.

    Gary

    0 comments No comments

  2. William 96 Reputation points
    2020-12-11T18:30:34.313+00:00

    Regardless of whether this was a "by design" choice or just an oversight during the re-factoring of the implementation of IFileOperation after Windows 7, you have no choice but to accept this state of affairs.

    This is EXACTLY the point (but for explorer not IFileOperation, I only mentioned IFileOperation in case it was helpful)

    The question is about Explorer
    It copies ADS for files, but not for folders

    This is weird behavior.

    "Regardless of whether this was a "by design" It is either by design, or by mistake.
    If it is by mistake, someone should fix it.
    If it is by design, that's fine we will use something else.

    WHICH IS IT?
    .
    I need an answer from someone responsible.
    You did not provided an answer.
    "Regardless of whether this was a "by design" is not an answer.

    The matter is that someone responsible should make that call.
    Attributes not copied for folders, turned out to be a bug.
    If this is by design SOMEONE should step up and give an official answer.

    0 comments No comments

  3. William 96 Reputation points
    2020-12-12T06:46:29.133+00:00

    it seems that the inner call
    CFSTransfer::CopyItem
    that is called in all copies for both files and folders is ignoring the ADS just for folders

    Maybe?

    or is it _CreateFileWithRetry jobs to get ADS ?

    I don't know...
    Does anyone?


  4. q z 1 Reputation point
    2022-10-05T15:08:15.083+00:00

    hello , do you get answer from official ?
    the ADS in folder is useful too!
    do you know whether this was a "by design" It is either by design, or by mistake. now ?
    thanks !

    0 comments No comments