Files: Add support for View Alternate Data Streams

Created on 19 Jul 2019  路  25Comments  路  Source: files-community/Files

I have been looking for ways to view Alternate Data Streams of NTFS in Explorer. I have used Streams from Sysinternals for CLI and AlternateStreamView from NirSoft for UI. But I could not manage to do it in a proper way.

I'd like to have an alternative like "Show Hidden Files" but a "Show Alternate Data Streams" so that I can view them as casual files.

Although hidden files are shown with some transparency, alternate data streams can be shown as semitransparent like them but with some tricks like a different color in titles or any icon identifier like shortcuts does. That would be awesome.

enhancement help wanted triage approved

All 25 comments

Unfortunately the current Windows.Storage APIs don't support displaying these yet. Keeping open for now while I investigate ways to work around this limitation.

I believe AlphaFS would suit better for all file system needs instead of System.IO and Windows.Storage in many cases. For future releases, that would probably accelerate your features.

@zbalkan does AlphaFS work with UWP applications?

@yaichenbaum It's a drop in replacement for System.IO, so it won't be a problem, I assume. I have never used it with a UWP project.

It looks promising, @duke7553 can you investigate if this will work in a UWP app? If it does then we can solve many open issues by switching to this.

At this point, I believe "developing things that work" is better than "developing thing that does more". My feature suggestion may not be a must, but using AlphaFS might be helpful. I hope it would accelerate your efforts.

If it's not supported in UWP, we can use the full trust component similar to other features that aren't possible in UWP.

AlphaFS "works" in UWP but has all the same limitations as System.IO functions (AccessDenied everywhere).
For Alternate Data Streams we could use FindFirstStreamW in the fulltrust process to enumerate streams and than CreateFileFromApp from uwp may work to open them if it's needed.
For shortcut files we can use ShellLinkObject to get the link destination (also in the fulltrust process) or perhaps read the .lnk file as a binary file and extract the path from there.

@gave92 Do you mean CreateFileFromApp?

We should use CreateFile2 not CreateFileFromApp. According to the documentation, CreateFileFromApp is only available for Desktop apps that needs the security of UWP (eg: Packaged desktop apps.)

@Jaiganeshkumaran CreateFileFromApp should be available to UWP apps together with FindFirstFileExFromApp (which we're using), DeleteFileFromApp, MoveFileFromApp and others.
So once you get the list of ads using the fulltrust process you can do everything else in uwp maybe.

@gave92 The documentation is a little weird. The list of support Win32 APIs contains CreateFileFromApp but the API documentation says that it's desktop only. Maybe they haven't updated it.

@Jaiganeshkumaran Indeed. I noticed with a lot of the FromApp APIs, they never categorized them as usable from a UWP app inside the doc page itself. They certainly are though.

@Jaiganeshkumaran you're right. I found those functions mentioned in the "APIs available to all Windows 10 devices" page so I assumed they were, but the docs for each function says otherwise. Also we should be aware of potential differences between the FromApp method and the "normal" one, e.g. I'm not fully sure if CreateFileFromApp can actually open ADS.

Regarding support for shortcut files I think it's worth mentioning an alternative to using the fulltrust process which is using this library to directly parse the lnk file as binary in uwp -> https://github.com/EricZimmerman/Lnk
Since this is not "official" I would be more in favour of using the Win32 api in fulltrust process, but this is also viable

I'm a bit in doubt on how to implement hidden files..

  • should we enumerate all files in the fulltrust process and pass them to the uwp app for display? If folder is big this might be slow and hit memory limits in AppService communication
  • should we only pass the hidden files? but with FindFirstFile you can't filter for hidden files

Regarding shortcuts, we can actually don鈥檛 need the full trust component since the Win32 APIs that we use do work for shortcut.

I was thinking about shortcuts to folders, we need to know the destination to navigate to it

@gave92 We can use the library you mentioned but everything can be done from UWP. No need to use the Full Trust component for enumerating shortcuts.

Is anyone already working on this? If not I can start adding support for .lnk and .url shortcuts

Edit
StorageFile.GetFileFromPathAsync() will throw Access Denied on shortcut files: moving, renaming, deleting shortcuts can't be done in uwp using the storage api :/ MoveFileFromApp and similar methods will work though.

@duke7553 could you remove my assignment on this issue? Support for shortcuts was introduced but I'm not currently working on the other features mentioned here. Thanks!

@duke7553 could you remove my assignment on this issue? Support for shortcuts was introduced but I'm not currently working on the other features mentioned here. Thanks!

@gave92 Done. Thank you so much for your help with adding support for shortcuts.

If I get it right, the shortcuts can be used as of now. But accessing the Alternate Data Streams feature of NTFS is missing. Is it correct?

@zbalkan Yeah, Alternate Data Streams hasn't been implemented yet.

@gave92 Can you confirm if all that's left to this issue is hidden items?

Alternate Data Streams as well
@yaichenbaum not sure if this will solve #2104 which is about folder access permissions

Support for shortcuts and hidden items have been added to Files, we are still exploring ways to add support for alternate data streams.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alialix2 picture alialix2  路  3Comments

xpirad picture xpirad  路  3Comments

jbvc97 picture jbvc97  路  3Comments

szaimen picture szaimen  路  4Comments

Cyberdroid1 picture Cyberdroid1  路  3Comments