mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-04-30 10:47:48 +02:00
Better handling of FILE_OPEN_REPARSE_POINT flag
This commit is contained in:
parent
2da05e979b
commit
6cb61ca63e
1 changed files with 7 additions and 3 deletions
|
@ -246,14 +246,18 @@ namespace SMBLibrary.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream stream;
|
Stream stream;
|
||||||
if ((request.CreateOptions & CreateOptions.FILE_OPEN_REPARSE_POINT) > 0 || fileAccess == (FileAccess)0 || entry.IsDirectory)
|
if (fileAccess == (FileAccess)0 || entry.IsDirectory)
|
||||||
{
|
{
|
||||||
// FILE_OPEN_REPARSE_POINT is a hint that the caller does not intend to actually read the file
|
|
||||||
stream = null;
|
stream = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool buffered = (request.CreateOptions & CreateOptions.FILE_SEQUENTIAL_ONLY) > 0 && (request.CreateOptions & CreateOptions.FILE_NO_INTERMEDIATE_BUFFERING) == 0;
|
// When FILE_OPEN_REPARSE_POINT is specified, the operation should continue normally if the file is not a reparse point.
|
||||||
|
// FILE_OPEN_REPARSE_POINT is a hint that the caller does not intend to actually read the file, with the exception
|
||||||
|
// of a file copy operation (where the caller will attempt to simply copy the reparse point).
|
||||||
|
bool openReparsePoint = (request.CreateOptions & CreateOptions.FILE_OPEN_REPARSE_POINT) > 0;
|
||||||
|
bool disableBuffering = (request.CreateOptions & CreateOptions.FILE_NO_INTERMEDIATE_BUFFERING) > 0;
|
||||||
|
bool buffered = (request.CreateOptions & CreateOptions.FILE_SEQUENTIAL_ONLY) > 0 && !disableBuffering && !openReparsePoint;
|
||||||
System.Diagnostics.Debug.Print("[{0}] NTCreate: Opening '{1}', Access={2}, Share={3}, Buffered={4}", DateTime.Now.ToString("HH:mm:ss:ffff"), path, fileAccess, fileShare, buffered);
|
System.Diagnostics.Debug.Print("[{0}] NTCreate: Opening '{1}', Access={2}, Share={3}, Buffered={4}", DateTime.Now.ToString("HH:mm:ss:ffff"), path, fileAccess, fileShare, buffered);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue