mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-04-29 18:27:48 +02:00
Added TreeID parameter to OpenFileObject
This commit is contained in:
parent
241e06c38d
commit
2c1b59973b
6 changed files with 12 additions and 10 deletions
|
@ -13,11 +13,13 @@ namespace SMBLibrary.Server
|
|||
{
|
||||
internal class OpenFileObject
|
||||
{
|
||||
public uint TreeID;
|
||||
public string Path;
|
||||
public object Handle;
|
||||
|
||||
public OpenFileObject(string path, object handle)
|
||||
public OpenFileObject(uint treeID, string path, object handle)
|
||||
{
|
||||
TreeID = treeID;
|
||||
Path = path;
|
||||
Handle = handle;
|
||||
}
|
||||
|
|
|
@ -69,17 +69,17 @@ namespace SMBLibrary.Server
|
|||
|
||||
/// <param name="relativePath">Should include the path relative to the share</param>
|
||||
/// <returns>FileID</returns>
|
||||
public ushort? AddOpenFile(string relativePath)
|
||||
public ushort? AddOpenFile(ushort treeID, string relativePath)
|
||||
{
|
||||
return AddOpenFile(relativePath, null);
|
||||
return AddOpenFile(treeID, relativePath, null);
|
||||
}
|
||||
|
||||
public ushort? AddOpenFile(string relativePath, object handle)
|
||||
public ushort? AddOpenFile(ushort treeID, string relativePath, object handle)
|
||||
{
|
||||
ushort? fileID = m_connection.AllocateFileID();
|
||||
if (fileID.HasValue)
|
||||
{
|
||||
m_openFiles.Add(fileID.Value, new OpenFileObject(relativePath, handle));
|
||||
m_openFiles.Add(fileID.Value, new OpenFileObject(treeID, relativePath, handle));
|
||||
}
|
||||
return fileID;
|
||||
}
|
||||
|
|
|
@ -95,12 +95,12 @@ namespace SMBLibrary.Server
|
|||
}
|
||||
|
||||
/// <returns>The persistent portion of the FileID</returns>
|
||||
public ulong? AddOpenFile(string relativePath, object handle)
|
||||
public ulong? AddOpenFile(uint treeID, string relativePath, object handle)
|
||||
{
|
||||
ulong? persistentID = m_connection.AllocatePersistentFileID();
|
||||
if (persistentID.HasValue)
|
||||
{
|
||||
m_openFiles.Add(persistentID.Value, new OpenFileObject(relativePath, handle));
|
||||
m_openFiles.Add(persistentID.Value, new OpenFileObject(treeID, relativePath, handle));
|
||||
}
|
||||
return persistentID;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace SMBLibrary.Server.SMB1
|
|||
return new ErrorResponse(request.CommandName);
|
||||
}
|
||||
|
||||
ushort? fileID = session.AddOpenFile(path, handle);
|
||||
ushort? fileID = session.AddOpenFile(header.TID, path, handle);
|
||||
if (!fileID.HasValue)
|
||||
{
|
||||
share.FileStore.CloseFile(handle);
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace SMBLibrary.Server.SMB1
|
|||
return new ErrorResponse(request.CommandName);
|
||||
}
|
||||
|
||||
ushort? fileID = session.AddOpenFile(path, handle);
|
||||
ushort? fileID = session.AddOpenFile(header.TID, path, handle);
|
||||
if (!fileID.HasValue)
|
||||
{
|
||||
share.FileStore.CloseFile(handle);
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace SMBLibrary.Server.SMB2
|
|||
return new ErrorResponse(request.CommandName, createStatus);
|
||||
}
|
||||
|
||||
ulong? persistentFileID = session.AddOpenFile(path, handle);
|
||||
ulong? persistentFileID = session.AddOpenFile(request.Header.TreeID, path, handle);
|
||||
if (!persistentFileID.HasValue)
|
||||
{
|
||||
share.FileStore.CloseFile(handle);
|
||||
|
|
Loading…
Add table
Reference in a new issue