Marus Gradinaru
Marus Gradinaru

Reputation: 3022

How to check if a file has Alternate Data Streams?

Is there a way in Delphi to check if a file has any Alternate Data Streams?

Upvotes: 3

Views: 3262

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 596497

Have a look at the Win32 API FindFirstStreamW() and FindNextStreamW() functions:

Enumerates the first stream with a ::$DATA stream type in the specified file or directory.

Continues a stream search started by a previous call to the FindFirstStreamW function.

However, a file or directory may have other stream types besides ::$DATA, which are not enumerable in the Win32 API, they are internal to NTFS itself.

See MSDN for more details.

Using Streams

File Streams

To enumerate non-$DATA streams, you would have to read the filesystem directly, such as with BackupRead() and BackupSeek(). See Enumerating Alternate Data Streams on CodeProject for details on that.

Upvotes: 6

Related Questions