mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-05-02 03:47: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
|
internal class OpenFileObject
|
||||||
{
|
{
|
||||||
|
public uint TreeID;
|
||||||
public string Path;
|
public string Path;
|
||||||
public object Handle;
|
public object Handle;
|
||||||
|
|
||||||
public OpenFileObject(string path, object handle)
|
public OpenFileObject(uint treeID, string path, object handle)
|
||||||
{
|
{
|
||||||
|
TreeID = treeID;
|
||||||
Path = path;
|
Path = path;
|
||||||
Handle = handle;
|
Handle = handle;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,17 +69,17 @@ namespace SMBLibrary.Server
|
||||||
|
|
||||||
/// <param name="relativePath">Should include the path relative to the share</param>
|
/// <param name="relativePath">Should include the path relative to the share</param>
|
||||||
/// <returns>FileID</returns>
|
/// <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();
|
ushort? fileID = m_connection.AllocateFileID();
|
||||||
if (fileID.HasValue)
|
if (fileID.HasValue)
|
||||||
{
|
{
|
||||||
m_openFiles.Add(fileID.Value, new OpenFileObject(relativePath, handle));
|
m_openFiles.Add(fileID.Value, new OpenFileObject(treeID, relativePath, handle));
|
||||||
}
|
}
|
||||||
return fileID;
|
return fileID;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,12 +95,12 @@ namespace SMBLibrary.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <returns>The persistent portion of the FileID</returns>
|
/// <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();
|
ulong? persistentID = m_connection.AllocatePersistentFileID();
|
||||||
if (persistentID.HasValue)
|
if (persistentID.HasValue)
|
||||||
{
|
{
|
||||||
m_openFiles.Add(persistentID.Value, new OpenFileObject(relativePath, handle));
|
m_openFiles.Add(persistentID.Value, new OpenFileObject(treeID, relativePath, handle));
|
||||||
}
|
}
|
||||||
return persistentID;
|
return persistentID;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace SMBLibrary.Server.SMB1
|
||||||
return new ErrorResponse(request.CommandName);
|
return new ErrorResponse(request.CommandName);
|
||||||
}
|
}
|
||||||
|
|
||||||
ushort? fileID = session.AddOpenFile(path, handle);
|
ushort? fileID = session.AddOpenFile(header.TID, path, handle);
|
||||||
if (!fileID.HasValue)
|
if (!fileID.HasValue)
|
||||||
{
|
{
|
||||||
share.FileStore.CloseFile(handle);
|
share.FileStore.CloseFile(handle);
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace SMBLibrary.Server.SMB1
|
||||||
return new ErrorResponse(request.CommandName);
|
return new ErrorResponse(request.CommandName);
|
||||||
}
|
}
|
||||||
|
|
||||||
ushort? fileID = session.AddOpenFile(path, handle);
|
ushort? fileID = session.AddOpenFile(header.TID, path, handle);
|
||||||
if (!fileID.HasValue)
|
if (!fileID.HasValue)
|
||||||
{
|
{
|
||||||
share.FileStore.CloseFile(handle);
|
share.FileStore.CloseFile(handle);
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace SMBLibrary.Server.SMB2
|
||||||
return new ErrorResponse(request.CommandName, createStatus);
|
return new ErrorResponse(request.CommandName, createStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
ulong? persistentFileID = session.AddOpenFile(path, handle);
|
ulong? persistentFileID = session.AddOpenFile(request.Header.TreeID, path, handle);
|
||||||
if (!persistentFileID.HasValue)
|
if (!persistentFileID.HasValue)
|
||||||
{
|
{
|
||||||
share.FileStore.CloseFile(handle);
|
share.FileStore.CloseFile(handle);
|
||||||
|
|
Loading…
Add table
Reference in a new issue