mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-21 16:55:54 +02:00
NTTransactHelper: Minor code refactoring
This commit is contained in:
parent
d74a478db8
commit
7a0b0b4a15
1 changed files with 20 additions and 21 deletions
|
@ -132,15 +132,20 @@ namespace SMBLibrary.Server.SMB1
|
||||||
private static NTTransactIOCTLResponse GetSubcommandResponse(SMB1Header header, uint maxDataCount, NTTransactIOCTLRequest subcommand, ISMBShare share, SMB1ConnectionState state)
|
private static NTTransactIOCTLResponse GetSubcommandResponse(SMB1Header header, uint maxDataCount, NTTransactIOCTLRequest subcommand, ISMBShare share, SMB1ConnectionState state)
|
||||||
{
|
{
|
||||||
SMB1Session session = state.GetSession(header.UID);
|
SMB1Session session = state.GetSession(header.UID);
|
||||||
NTTransactIOCTLResponse response = new NTTransactIOCTLResponse();
|
if (!subcommand.IsFsctl)
|
||||||
if (subcommand.IsFsctl)
|
|
||||||
{
|
{
|
||||||
|
// [MS-SMB] If the IsFsctl field is set to zero, the server SHOULD fail the request with STATUS_NOT_SUPPORTED
|
||||||
|
header.Status = NTStatus.STATUS_NOT_SUPPORTED;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
OpenFileObject openFile = session.GetOpenFileObject(subcommand.FID);
|
OpenFileObject openFile = session.GetOpenFileObject(subcommand.FID);
|
||||||
if (openFile == null)
|
if (openFile == null)
|
||||||
{
|
{
|
||||||
header.Status = NTStatus.STATUS_INVALID_HANDLE;
|
header.Status = NTStatus.STATUS_INVALID_HANDLE;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxOutputLength = (int)maxDataCount;
|
int maxOutputLength = (int)maxDataCount;
|
||||||
byte[] output;
|
byte[] output;
|
||||||
header.Status = share.FileStore.DeviceIOControl(openFile.Handle, subcommand.FunctionCode, subcommand.Data, out output, maxOutputLength);
|
header.Status = share.FileStore.DeviceIOControl(openFile.Handle, subcommand.FunctionCode, subcommand.Data, out output, maxOutputLength);
|
||||||
|
@ -149,16 +154,10 @@ namespace SMBLibrary.Server.SMB1
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTTransactIOCTLResponse response = new NTTransactIOCTLResponse();
|
||||||
response.Data = output;
|
response.Data = output;
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// [MS-SMB] If the IsFsctl field is set to zero, the server SHOULD fail the request with STATUS_NOT_SUPPORTED
|
|
||||||
header.Status = NTStatus.STATUS_NOT_SUPPORTED;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static List<SMB1Command> GetNTTransactResponse(byte[] responseSetup, byte[] responseParameters, byte[] responseData, int maxBufferSize)
|
internal static List<SMB1Command> GetNTTransactResponse(byte[] responseSetup, byte[] responseParameters, byte[] responseData, int maxBufferSize)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue