mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-21 16:55:54 +02:00
NTFileSystemAdapter: Added support for alternate data streams
This commit is contained in:
parent
73b6c288a4
commit
1e40ac4cde
2 changed files with 11 additions and 6 deletions
|
@ -125,11 +125,16 @@ namespace SMBLibrary
|
||||||
// This information class is used to enumerate the data streams of a file or a directory.
|
// This information class is used to enumerate the data streams of a file or a directory.
|
||||||
// A buffer of FileStreamInformation data elements is returned by the server.
|
// A buffer of FileStreamInformation data elements is returned by the server.
|
||||||
FileStreamInformation information = new FileStreamInformation();
|
FileStreamInformation information = new FileStreamInformation();
|
||||||
FileStreamEntry streamEntry = new FileStreamEntry();
|
List<KeyValuePair<string, ulong>> dataStreams = m_fileSystem.ListDataStreams(fileHandle.Path);
|
||||||
streamEntry.StreamSize = (long)entry.Size;
|
foreach (KeyValuePair<string, ulong> dataStream in dataStreams)
|
||||||
streamEntry.StreamAllocationSize = (long)GetAllocationSize(entry.Size);
|
{
|
||||||
streamEntry.StreamName = "::$DATA";
|
FileStreamEntry streamEntry = new FileStreamEntry();
|
||||||
information.Entries.Add(streamEntry);
|
ulong streamSize = dataStream.Value;
|
||||||
|
streamEntry.StreamSize = (long)streamSize;
|
||||||
|
streamEntry.StreamAllocationSize = (long)GetAllocationSize(streamSize);
|
||||||
|
streamEntry.StreamName = dataStream.Key;
|
||||||
|
information.Entries.Add(streamEntry);
|
||||||
|
}
|
||||||
result = information;
|
result = information;
|
||||||
return NTStatus.STATUS_SUCCESS;
|
return NTStatus.STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace SMBLibrary
|
||||||
}
|
}
|
||||||
|
|
||||||
// Windows will try to access named streams (alternate data streams) regardless of the FILE_NAMED_STREAMS flag, we need to prevent this behaviour.
|
// Windows will try to access named streams (alternate data streams) regardless of the FILE_NAMED_STREAMS flag, we need to prevent this behaviour.
|
||||||
if (path.Contains(":"))
|
if (!m_fileSystem.SupportsNamedStreams && path.Contains(":"))
|
||||||
{
|
{
|
||||||
// Windows Server 2003 will return STATUS_OBJECT_NAME_NOT_FOUND
|
// Windows Server 2003 will return STATUS_OBJECT_NAME_NOT_FOUND
|
||||||
return NTStatus.STATUS_NO_SUCH_FILE;
|
return NTStatus.STATUS_NO_SUCH_FILE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue