本文整理汇总了C#中Smb2FunctionalClient.BeforeSendingPacket方法的典型用法代码示例。如果您正苦于以下问题:C# Smb2FunctionalClient.BeforeSendingPacket方法的具体用法?C# Smb2FunctionalClient.BeforeSendingPacket怎么用?C# Smb2FunctionalClient.BeforeSendingPacket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smb2FunctionalClient
的用法示例。
在下文中一共展示了Smb2FunctionalClient.BeforeSendingPacket方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InvalidCreateRequestStructureSize
public void InvalidCreateRequestStructureSize()
{
uint status;
client1 = new Smb2FunctionalClient(TestConfig.Timeout, TestConfig, this.Site);
client1.ConnectToServer(TestConfig.UnderlyingTransport, TestConfig.SutComputerName, TestConfig.SutIPAddress);
status = client1.Negotiate(
TestConfig.RequestDialects,
TestConfig.IsSMB1NegotiateEnabled);
status = client1.SessionSetup(
TestConfig.DefaultSecurityPackage,
TestConfig.SutComputerName,
TestConfig.AccountCredential,
TestConfig.UseServerGssToken);
uint treeId;
status = client1.TreeConnect(uncSharePath, out treeId);
string fileName = "BVT_SMB2Basic_InvalidCreateRequestStructureSize" + Guid.NewGuid();
FILEID fileID;
Smb2CreateContextResponse[] serverCreateContexts;
// [MS-SMB2] Section 2.2.13 SMB2 CREATE Request
// StructureSize (2 bytes): The client MUST set this field to 57, indicating the size of the request structure, not including the header.
// The client MUST set it to this value regardless of how long Buffer[] actually is in the request being sent.
// So set the StuctureSize to 58 here to make "the size of the SMB2 CREATE Request is less than specified in the StructureSize field".
client1.BeforeSendingPacket(ReplacePacketByStructureSize);
status = client1.Create(
treeId,
fileName,
CreateOptions_Values.FILE_NON_DIRECTORY_FILE,
out fileID,
out serverCreateContexts,
checker: (header, response) => { });
BaseTestSite.Assert.AreEqual(
Smb2Status.STATUS_INVALID_PARAMETER,
status,
"The size of the SMB2 CREATE Request (excluding the SMB2 header) is less than specified in the StructureSize field, then the request MUST be failed with STATUS_ INVALID_PARAMETER");
client1.TreeDisconnect(treeId);
client1.LogOff();
}