本文整理汇总了C#中Microsoft.Protocols.TestTools.StackSdk.FileAccessService.Cifs.CifsServerPerConnection.GenerateFID方法的典型用法代码示例。如果您正苦于以下问题:C# CifsServerPerConnection.GenerateFID方法的具体用法?C# CifsServerPerConnection.GenerateFID怎么用?C# CifsServerPerConnection.GenerateFID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Protocols.TestTools.StackSdk.FileAccessService.Cifs.CifsServerPerConnection
的用法示例。
在下文中一共展示了CifsServerPerConnection.GenerateFID方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCreateResponse
public SmbCreateResponsePacket CreateCreateResponse(
CifsServerPerConnection connection,
SmbCreateRequestPacket request)
{
SmbCreateResponsePacket response = new SmbCreateResponsePacket();
response.SmbHeader = CifsMessageUtils.CreateSmbHeader(connection, request);
SMB_COM_CREATE_Response_SMB_Parameters smbParameters = response.SmbParameters;
smbParameters.FID = (ushort)connection.GenerateFID();
smbParameters.WordCount = (byte)(TypeMarshal.GetBlockMemorySize(smbParameters) / 2);
response.SmbParameters = smbParameters;
return response;
}
示例2: CreateCreateTemporaryResponse
public SmbCreateTemporaryResponsePacket CreateCreateTemporaryResponse(
CifsServerPerConnection connection,
SmbCreateTemporaryRequestPacket request,
string temporaryFileName)
{
SmbCreateTemporaryResponsePacket response = new SmbCreateTemporaryResponsePacket();
response.SmbHeader = CifsMessageUtils.CreateSmbHeader(connection, request);
SMB_COM_CREATE_TEMPORARY_Response_SMB_Parameters smbParameters = response.SmbParameters;
smbParameters.WordCount = 0x01; // should be 0x1; But it reads 0x02 in TD.
smbParameters.FID = (ushort)connection.GenerateFID();
response.SmbParameters = smbParameters;
SMB_COM_CREATE_TEMPORARY_Response_SMB_Data smbData = response.SmbData;
smbData.BufferFormat = 0x04;
smbData.TemporaryFileName = CifsMessageUtils.ToSmbStringBytes(temporaryFileName,
(response.SmbHeader.Flags2 & SmbFlags2.SMB_FLAGS2_UNICODE) == SmbFlags2.SMB_FLAGS2_UNICODE);
smbData.ByteCount = (ushort)(smbData.TemporaryFileName.Length + Marshal.SizeOf(smbData.BufferFormat));
response.SmbData = smbData;
return response;
}
示例3: CreateTrans2Open2FinalResponse
public SmbTrans2Open2FinalResponsePacket CreateTrans2Open2FinalResponse(
CifsServerPerConnection connection,
SmbTrans2Open2RequestPacket request,
uint fileDataSize,
FileTypeValue resourceType,
SMB_NMPIPE_STATUS nmPipeStatus,
OpenResultsValues actionTaken)
{
SmbTrans2Open2FinalResponsePacket response = new SmbTrans2Open2FinalResponsePacket();
response.SmbHeader = CifsMessageUtils.CreateSmbHeader(connection, request);
TRANS2_OPEN2_Response_Trans2_Parameters trans2Parameters = response.Trans2Parameters;
trans2Parameters.Fid = (ushort)connection.GenerateFID();
trans2Parameters.FileAttributes = request.Trans2Parameters.FileAttributes;
trans2Parameters.CreationTime = (uint)DateTime.Now.Millisecond;
trans2Parameters.FileDataSize = fileDataSize;
trans2Parameters.AccessMode = request.Trans2Parameters.AccessMode;
trans2Parameters.ResourceType = resourceType;
trans2Parameters.NMPipeStatus = nmPipeStatus;
trans2Parameters.OpenResults = actionTaken;
trans2Parameters.Reserved = 0x00000000;
trans2Parameters.ExtendedAttributeErrorOffset = 0;
trans2Parameters.ExtendedAttributeLength = request.Trans2Data.ExtendedAttributeList.SizeOfListInBytes;
response.Trans2Parameters = trans2Parameters;
response.UpdateCountAndOffset();
return response;
}
示例4: CreateOpenResponse
public SmbOpenResponsePacket CreateOpenResponse(
CifsServerPerConnection connection,
SmbOpenRequestPacket request,
uint fileSize,
UTime lastModified)
{
SmbOpenResponsePacket response = new SmbOpenResponsePacket();
response.SmbHeader = CifsMessageUtils.CreateSmbHeader(connection, request);
SMB_COM_OPEN_Response_SMB_Parameters smbParameters = response.SmbParameters;
smbParameters.AccessMode = request.SmbParameters.AccessMode;
smbParameters.FID = (ushort)connection.GenerateFID();
smbParameters.FileAttrs = request.SmbParameters.SearchAttributes;
smbParameters.FileSize = fileSize;
smbParameters.LastModified = lastModified;
smbParameters.WordCount = (byte)(TypeMarshal.GetBlockMemorySize(smbParameters) / 2);
response.SmbParameters = smbParameters;
return response;
}
示例5: CreateOpenAndxResponse
public SmbOpenAndxResponsePacket CreateOpenAndxResponse(
CifsServerPerConnection connection,
SmbOpenAndxRequestPacket request,
UTime lastWriteTime,
uint fileDataSize,
AccessRightsValue accessRights,
ResourceTypeValue resourceType,
SMB_NMPIPE_STATUS nmPipeStatus,
OpenResultsValues openResults,
SmbPacket andxPacket)
{
SmbOpenAndxResponsePacket response = new SmbOpenAndxResponsePacket();
response.SmbHeader = CifsMessageUtils.CreateSmbHeader(connection, request);
SMB_COM_OPEN_ANDX_Response_SMB_Parameters smbParameters = response.SmbParameters;
smbParameters.AndXCommand =
andxPacket != null ? andxPacket.SmbHeader.Command : SmbCommand.SMB_COM_NO_ANDX_COMMAND;
smbParameters.AndXReserved = 0x00;
smbParameters.FID = (ushort)(connection.GenerateFID());
smbParameters.FileAttrs = request.SmbParameters.FileAttrs;
smbParameters.LastWriteTime = lastWriteTime;
smbParameters.FileDataSize = fileDataSize;
smbParameters.AccessRights = accessRights;
smbParameters.ResourceType = resourceType;
smbParameters.NMPipeStatus = nmPipeStatus;
smbParameters.OpenResults = openResults;
smbParameters.Reserved = new ushort[3];
smbParameters.AndXOffset = (ushort)(response.HeaderSize + Marshal.SizeOf(response.SmbParameters)
+ Marshal.SizeOf(response.SmbData));
smbParameters.WordCount = (byte)(TypeMarshal.GetBlockMemorySize(smbParameters) / 2);
response.SmbParameters = smbParameters;
response.AndxPacket = andxPacket;
response.UpdateHeader();
return response;
}
示例6: CreateNtTransactCreateResponse
public SmbNtTransactCreateResponsePacket CreateNtTransactCreateResponse(
CifsServerPerConnection connection,
SmbNtTransactCreateRequestPacket request,
ulong allocationSize,
ulong endOfFile,
FileTypeValue resourceType,
SMB_NMPIPE_STATUS nmPipeStatus,
byte directory)
{
SmbNtTransactCreateResponsePacket response = new SmbNtTransactCreateResponsePacket();
response.SmbHeader = CifsMessageUtils.CreateSmbHeader(connection, request);
NT_TRANSACT_CREATE_Response_NT_Trans_Parameters ntTransParameters = response.NtTransParameters;
ntTransParameters.OpLockLevel = OplockLevelValue.None;
ntTransParameters.Reserved = 0x00;
ntTransParameters.FID = (ushort)connection.GenerateFID();
ntTransParameters.CreateAction = NtTransactCreateActionValues.FILE_CREATED;
FileTime fileTime = new FileTime();
fileTime.Time = (ulong)DateTime.Now.ToFileTime();
ntTransParameters.CreationTime = fileTime;
ntTransParameters.LastAccessTime = fileTime;
ntTransParameters.LastWriteTime = fileTime;
ntTransParameters.LastChangeTime = fileTime;
ntTransParameters.ExtFileAttributes = request.NtTransParameters.ExtFileAttributes;
ntTransParameters.AllocationSize = allocationSize;
ntTransParameters.EndOfFile = endOfFile;
ntTransParameters.ResourceType = resourceType;
ntTransParameters.NMPipeStatus = nmPipeStatus;
ntTransParameters.Directory = directory;
response.NtTransParameters = ntTransParameters;
response.UpdateCountAndOffset();
return response;
}
示例7: CreateNtCreateAndxResponse
public SmbNtCreateAndxResponsePacket CreateNtCreateAndxResponse(
CifsServerPerConnection connection,
SmbNtCreateAndxRequestPacket request,
OplockLevelValue opLockLevel,
ulong allocationSize,
ulong endOfFile,
FileTypeValue resourceType,
SMB_NMPIPE_STATUS nmPipeStatus,
byte directory,
SmbPacket andxPacket)
{
SmbNtCreateAndxResponsePacket response = new SmbNtCreateAndxResponsePacket();
response.SmbHeader = CifsMessageUtils.CreateSmbHeader(connection, request);
SMB_COM_NT_CREATE_ANDX_Response_SMB_Parameters smbParameters = response.SmbParameters;
smbParameters.AndXCommand =
andxPacket != null ? andxPacket.SmbHeader.Command : SmbCommand.SMB_COM_NO_ANDX_COMMAND;
smbParameters.AndXReserved = 0x00;
smbParameters.AndXOffset = (ushort)(response.HeaderSize + Marshal.SizeOf(response.SmbParameters)
+ Marshal.SizeOf(response.SmbData));
smbParameters.OplockLevel = opLockLevel;
smbParameters.FID = (ushort)connection.GenerateFID();
smbParameters.CreateDisposition = NtTransactCreateDisposition.FILE_CREATE;
FileTime fileTime = new FileTime();
fileTime.Time = (ulong)DateTime.Now.ToFileTime();
smbParameters.CreateTime = fileTime;
smbParameters.LastAccessTime = fileTime;
smbParameters.LastChangeTime = fileTime;
smbParameters.ExtFileAttributes = (SMB_EXT_FILE_ATTR)request.SmbParameters.ExtFileAttributes;
smbParameters.AllocationSize = allocationSize;
smbParameters.EndOfFile = endOfFile;
smbParameters.ResourceType = resourceType;
smbParameters.NMPipeStatus = nmPipeStatus;
smbParameters.Directory = directory;
smbParameters.WordCount = (byte)(TypeMarshal.GetBlockMemorySize(smbParameters) / 2);
response.SmbParameters = smbParameters;
response.AndxPacket = andxPacket;
response.UpdateHeader();
return response;
}