当前位置: 首页>>代码示例>>C#>>正文


C# Smb2FunctionalClient.SetFileAttributes方法代码示例

本文整理汇总了C#中Smb2FunctionalClient.SetFileAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# Smb2FunctionalClient.SetFileAttributes方法的具体用法?C# Smb2FunctionalClient.SetFileAttributes怎么用?C# Smb2FunctionalClient.SetFileAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Smb2FunctionalClient的用法示例。


在下文中一共展示了Smb2FunctionalClient.SetFileAttributes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DirectoryLeasing_BreakReadCachingByChildRenamed

        public void DirectoryLeasing_BreakReadCachingByChildRenamed()
        {
            #region Prepare test directory and test file
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Create test directory and test file.");
            uncSharePath = Smb2Utility.GetUncPath(TestConfig.SutComputerName, TestConfig.BasicFileShare);
            testDirectory = CreateTestDirectory(TestConfig.SutComputerName, TestConfig.BasicFileShare);
            fileName = "DirectoryLeasing_BreakReadCachingByChildRenamed_" + Guid.NewGuid().ToString() + ".txt";
            sutProtocolController.CreateFile(uncSharePath + "\\" + testDirectory, fileName, string.Empty);
            #endregion

            #region Initialize test clients
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Initialize test clients.");

            Guid clientGuidRequestingLease = Guid.NewGuid();
            Smb2FunctionalClient clientRequestingLease = new Smb2FunctionalClient(TestConfig.Timeout, TestConfig, BaseTestSite);

            Guid clientGuidTriggeringBreak = Guid.NewGuid();
            Smb2FunctionalClient clientTriggeringBreak = new Smb2FunctionalClient(TestConfig.Timeout, TestConfig, BaseTestSite);

            clientRequestingLease.Smb2Client.LeaseBreakNotificationReceived +=
                new Action<Packet_Header, LEASE_BREAK_Notification_Packet>(base.OnLeaseBreakNotificationReceived);

            clientRequestingLease.ConnectToServer(TestConfig.UnderlyingTransport, TestConfig.SutComputerName, TestConfig.SutIPAddress);
            clientTriggeringBreak.ConnectToServer(TestConfig.UnderlyingTransport, TestConfig.SutComputerName, TestConfig.SutIPAddress);
            #endregion

            #region CREATE an open to request lease
            uint treeIdClientRequestingLease;
            FILEID fileIdClientRequestingLease;
            LeaseStateValues requestedLeaseState = LeaseStateValues.SMB2_LEASE_READ_CACHING;

            // Add expected NewLeaseState
            expectedNewLeaseState = LeaseStateValues.SMB2_LEASE_NONE;

            BaseTestSite.Log.Add(
                LogEntryKind.TestStep,
                "Client attempts to request lease {0} on directory {1}", requestedLeaseState, testDirectory);
            status = CreateOpenFromClient(clientRequestingLease, clientGuidRequestingLease, testDirectory, true, requestedLeaseState, AccessMask.GENERIC_READ, out treeIdClientRequestingLease, out fileIdClientRequestingLease);
            BaseTestSite.Assert.AreEqual(
                Smb2Status.STATUS_SUCCESS,
                status,
                "Create an open to {0} should succeed, actual status is {1}", testDirectory, Smb2Status.GetStatusCode(status));
            #endregion
            // Create a timer that signals the delegate to invoke CheckBreakNotification
            Timer timer = new Timer(base.CheckBreakNotification, treeIdClientRequestingLease, 0, Timeout.Infinite);
            base.clientToAckLeaseBreak = clientRequestingLease;

            #region Attempt to trigger lease break by renaming child item
            uint treeIdClientTriggeringBreak;
            FILEID fileIdClientTriggeringBreak;
            AccessMask accessMaskTrigger = AccessMask.DELETE;
            string targeName = testDirectory + "\\" + fileName;
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "A separate client attempts to access directory {0} to trigger lease break by renaming it", testDirectory);
            status = CreateOpenFromClient(clientTriggeringBreak, clientGuidTriggeringBreak, targeName, false, LeaseStateValues.SMB2_LEASE_NONE, accessMaskTrigger, out treeIdClientTriggeringBreak, out fileIdClientTriggeringBreak);
            BaseTestSite.Assert.AreEqual(
                Smb2Status.STATUS_SUCCESS,
                status,
                "Create an open to {0} should succeed, actual status is {1}", targeName, Smb2Status.GetStatusCode(status));

            #region SetFileAttributes with FileRenameInformation to rename child item
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "SetFileAttributes with FileRenameInformation to rename child item.");

            string newName = "Renamed_" + fileName;
            FileRenameInformation fileRenameInfo;
            fileRenameInfo.ReplaceIfExists = TypeMarshal.ToBytes(false)[0];
            fileRenameInfo.Reserved = new byte[7];
            fileRenameInfo.RootDirectory = FileRenameInformation_RootDirectory_Values.V1;
            fileRenameInfo.FileName = Encoding.Unicode.GetBytes(newName);
            fileRenameInfo.FileNameLength = (uint)fileRenameInfo.FileName.Length;

            byte[] inputBuffer;
            inputBuffer = TypeMarshal.ToBytes<FileRenameInformation>(fileRenameInfo);

            status = clientTriggeringBreak.SetFileAttributes(
                        treeIdClientTriggeringBreak,
                        (byte)FileInformationClasses.FileRenameInformation,
                        fileIdClientTriggeringBreak,
                        inputBuffer,
                        (header, response) => { });
            #endregion

            ClientTearDown(clientTriggeringBreak, treeIdClientTriggeringBreak, fileIdClientTriggeringBreak);
            #endregion
        }
开发者ID:XiaotianLiuMS,项目名称:WindowsProtocolTestSuites,代码行数:84,代码来源:DirectoryLeasingExtendedTest.cs

示例2: BVT_SMB2Basic_QueryAndSet_FileInfo

        public void BVT_SMB2Basic_QueryAndSet_FileInfo()
        {
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Starts a client by sending the following requests: NEGOTIATE; SESSION_SETUP; TREE_CONNECT.");
            client1 = new Smb2FunctionalClient(TestConfig.Timeout, TestConfig, BaseTestSite);
            client1.ConnectToServer(TestConfig.UnderlyingTransport, TestConfig.SutComputerName, TestConfig.SutIPAddress);
            client1.Negotiate(TestConfig.RequestDialects, TestConfig.IsSMB1NegotiateEnabled);
            client1.SessionSetup(
                TestConfig.DefaultSecurityPackage,
                TestConfig.SutComputerName,
                TestConfig.AccountCredential,
                TestConfig.UseServerGssToken);
            uint treeId1;
            client1.TreeConnect(uncSharePath, out treeId1);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Client sends CREATE request with desired access set to GENERIC_READ and GENERIC_WRITE to create a file.");
            Smb2CreateContextResponse[] serverCreateContexts;
            CREATE_Response? createResponse = null;
            string fileName = Guid.NewGuid().ToString() + ".txt";
            FILEID fileId1;
            client1.Create(
                treeId1,
                fileName,
                CreateOptions_Values.FILE_NON_DIRECTORY_FILE,
                out fileId1,
                out serverCreateContexts,
                accessMask: AccessMask.GENERIC_READ | AccessMask.GENERIC_WRITE,
                checker: (Packet_Header header, CREATE_Response response) =>
                    {
                        BaseTestSite.Assert.AreEqual(
                            Smb2Status.STATUS_SUCCESS,
                            header.Status,
                            "CREATE should succeed, actually server returns {0}.", Smb2Status.GetStatusCode(header.Status));

                        BaseTestSite.Log.Add(LogEntryKind.TestStep,
                            "FileBasicInformation in CREATE response: \r\nCreationTime: {0}\r\nLastAccessTime:{1}\r\nLastWriteTime: {2}\r\nChangeTime: {3}\r\nFileAttributes: {4}",
                            Smb2Utility.ConvertToDateTimeUtc(response.CreationTime).ToString("MM/dd/yyy hh:mm:ss.ffffff"),
                            Smb2Utility.ConvertToDateTimeUtc(response.LastAccessTime).ToString("MM/dd/yyy hh:mm:ss.ffffff"),
                            Smb2Utility.ConvertToDateTimeUtc(response.LastWriteTime).ToString("MM/dd/yyy hh:mm:ss.ffffff"),
                            Smb2Utility.ConvertToDateTimeUtc(response.ChangeTime).ToString("MM/dd/yyy hh:mm:ss.ffffff"),
                            response.FileAttributes);
                        createResponse = response;
                    });

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Client sends QUERY_INFO request to query file attributes.");
            byte[] outputBuffer;
            client1.QueryFileAttributes(
                treeId1,
                (byte)FileInformationClasses.FileBasicInformation,
                QUERY_INFO_Request_Flags_Values.SL_RESTART_SCAN,
                fileId1,
                new byte[0] { },
                out outputBuffer);

            FileBasicInformation fileBasicInfo = TypeMarshal.ToStruct<FileBasicInformation>(outputBuffer);
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "FileBasicInformation in QUERY_INFO response: \r\nCreationTime: {0}\r\nLastAccessTime:{1}\r\nLastWriteTime: {2}\r\nChangeTime: {3}\r\nFileAttributes: {4}",
                Smb2Utility.ConvertToDateTimeUtc(fileBasicInfo.CreationTime).ToString("MM/dd/yyy hh:mm:ss.ffffff"),
                Smb2Utility.ConvertToDateTimeUtc(fileBasicInfo.LastAccessTime).ToString("MM/dd/yyy hh:mm:ss.ffffff"),
                Smb2Utility.ConvertToDateTimeUtc(fileBasicInfo.LastWriteTime).ToString("MM/dd/yyy hh:mm:ss.ffffff"),
                Smb2Utility.ConvertToDateTimeUtc(fileBasicInfo.ChangeTime).ToString("MM/dd/yyy hh:mm:ss.ffffff"),
                fileBasicInfo.FileAttributes);

            BaseTestSite.Assert.AreEqual(createResponse.Value.CreationTime, fileBasicInfo.CreationTime, "CreationTime received in QUERY_INFO response should be identical with that got in CREATE response");
            BaseTestSite.Assert.AreEqual(createResponse.Value.LastAccessTime, fileBasicInfo.LastAccessTime, "LastAccessTime received in QUERY_INFO response should be identical with that got in CREATE response");
            BaseTestSite.Assert.AreEqual(createResponse.Value.LastWriteTime, fileBasicInfo.LastWriteTime, "LastWriteTime received in QUERY_INFO response should be identical with that got in CREATE response");
            BaseTestSite.Assert.AreEqual(createResponse.Value.ChangeTime, fileBasicInfo.ChangeTime, "ChangeTime received in QUERY_INFO response should be identical with that got in CREATE response");
            BaseTestSite.Assert.AreEqual(createResponse.Value.FileAttributes, fileBasicInfo.FileAttributes, "FileAttributes received in QUERY_INFO response should be identical with that got in CREATE response");

            FileBasicInformation fileBasicInfoToSet = fileBasicInfo;
            DateTime dateTimeToSet = DateTime.UtcNow;
            fileBasicInfoToSet.LastAccessTime = Smb2Utility.ConvertToFileTime(dateTimeToSet);

            byte[] inputBuffer;
            inputBuffer = TypeMarshal.ToBytes<FileBasicInformation>(fileBasicInfoToSet);
            BaseTestSite.Log.Add(
                LogEntryKind.TestStep,
                "Client sends SetFileAttributes request to set LastAccessTime for the file to {0}", dateTimeToSet.ToString("MM/dd/yyy hh:mm:ss.ffffff"));
            client1.SetFileAttributes(
                treeId1,
                (byte)FileInformationClasses.FileBasicInformation,
                fileId1,
                inputBuffer);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Client sends QUERY request to query file attributes.");
            client1.QueryFileAttributes(
                treeId1,
                (byte)FileInformationClasses.FileBasicInformation,
                QUERY_INFO_Request_Flags_Values.SL_RESTART_SCAN,
                fileId1,
                new byte[0] { },
                out outputBuffer);
            fileBasicInfo = TypeMarshal.ToStruct<FileBasicInformation>(outputBuffer);
            BaseTestSite.Log.Add(
                LogEntryKind.TestStep,
                "LastAccessTime in QUERY_INFO response after SET_INFO {0}",
                Smb2Utility.ConvertToDateTimeUtc(fileBasicInfo.LastAccessTime).ToString("MM/dd/yyy hh:mm:ss.ffffff"));

            BaseTestSite.Assert.AreNotEqual(
                createResponse.Value.LastAccessTime,
                fileBasicInfo.LastAccessTime,
                "LastAccessTime (dwHighDateTime:{0}, dwLowDateTime:{1}) after SET_INFO should not be equal to the value (dwHighDateTime:{2}, dwLowDateTime:{3}) before SET_INFO",
//.........这里部分代码省略.........
开发者ID:yazeng,项目名称:WindowsProtocolTestSuites,代码行数:101,代码来源:SMB2Basic.cs

示例3: DirectoryLeasing_BreakHandleCachingByParentDeleted

        public void DirectoryLeasing_BreakHandleCachingByParentDeleted()
        {
            #region Prepare test directory
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Create test directory.");
            uncSharePath = Smb2Utility.GetUncPath(TestConfig.SutComputerName, TestConfig.BasicFileShare);
            string parentDirectory = "ParentDirectory_" + Guid.NewGuid().ToString();
            sutProtocolController.CreateDirectory(uncSharePath, parentDirectory);
            testDirectory = CreateTestDirectory(TestConfig.SutComputerName, TestConfig.BasicFileShare + "\\" + parentDirectory);
            #endregion

            #region Initialize test clients
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Initialize test clients.");

            Guid clientGuidRequestingLease = Guid.NewGuid();
            Smb2FunctionalClient clientRequestingLease = new Smb2FunctionalClient(TestConfig.Timeout, TestConfig, BaseTestSite);

            Guid clientGuidTriggeringBreak = Guid.NewGuid();
            Smb2FunctionalClient clientTriggeringBreak = new Smb2FunctionalClient(TestConfig.Timeout, TestConfig, BaseTestSite);

            clientRequestingLease.Smb2Client.LeaseBreakNotificationReceived +=
                new Action<Packet_Header, LEASE_BREAK_Notification_Packet>(base.OnLeaseBreakNotificationReceived);

            clientRequestingLease.ConnectToServer(TestConfig.UnderlyingTransport, TestConfig.SutComputerName, TestConfig.SutIPAddress);
            clientTriggeringBreak.ConnectToServer(TestConfig.UnderlyingTransport, TestConfig.SutComputerName, TestConfig.SutIPAddress);
            #endregion

            #region CREATE an open to request lease
            uint treeIdClientRequestingLease;
            FILEID fileIdClientRequestingLease;
            string targetName = parentDirectory + "\\" + testDirectory;
            LeaseStateValues requestedLeaseState = LeaseStateValues.SMB2_LEASE_READ_CACHING | LeaseStateValues.SMB2_LEASE_HANDLE_CACHING;

            // Add expected NewLeaseState
            expectedNewLeaseState = LeaseStateValues.SMB2_LEASE_READ_CACHING;

            BaseTestSite.Log.Add(
                LogEntryKind.TestStep,
                "Client attempts to request lease {0} on directory {1}", requestedLeaseState, testDirectory);
            status = CreateOpenFromClient(clientRequestingLease, clientGuidRequestingLease, targetName, true, requestedLeaseState, AccessMask.GENERIC_READ, out treeIdClientRequestingLease, out fileIdClientRequestingLease);
            BaseTestSite.Assert.AreEqual(
                Smb2Status.STATUS_SUCCESS,
                status,
                "Create an open to {0} should succeed, actual status is {1}", testDirectory, Smb2Status.GetStatusCode(status));
            #endregion
            // Create a timer that signals the delegate to invoke CheckBreakNotification
            Timer timer = new Timer(base.CheckBreakNotification, treeIdClientRequestingLease, 0, Timeout.Infinite);
            base.clientToAckLeaseBreak = clientRequestingLease;

            #region Attempt to trigger lease break by deleting parent directory
            uint treeIdClientTriggeringBreak;
            FILEID fileIdClientTriggeringBreak;
            AccessMask accessMaskTrigger = AccessMask.DELETE;
            BaseTestSite.Log.Add(
                LogEntryKind.TestStep,
                "A separate client attempts to trigger lease break by deleting its parent directory");
            status = CreateOpenFromClient(clientTriggeringBreak, clientGuidTriggeringBreak, parentDirectory, true, LeaseStateValues.SMB2_LEASE_NONE, accessMaskTrigger, out treeIdClientTriggeringBreak, out fileIdClientTriggeringBreak);
            BaseTestSite.Assert.AreEqual(
                Smb2Status.STATUS_SUCCESS,
                status,
                "Create an open to {0} should succeed", parentDirectory);

            #region set FileDispositionInformation for deletion
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Set FileDispositionInformation for deletion.");

            FileDispositionInformation fileDispositionInfo;
            fileDispositionInfo.DeletePending = 1;  // Set 1 to indicate directory SHOULD be delted when the open closed
            byte[] inputBuffer = TypeMarshal.ToBytes<FileDispositionInformation>(fileDispositionInfo);
            status = clientTriggeringBreak.SetFileAttributes(
                        treeIdClientTriggeringBreak,
                        (byte)FileInformationClasses.FileDispositionInformation,
                        fileIdClientTriggeringBreak,
                        inputBuffer,
                        (header, response) =>
                        {
                            BaseTestSite.Assert.AreNotEqual(
                                Smb2Status.STATUS_SUCCESS,
                                header.Status,
                                "Setting FileDispositionInformation to the parent directory for deletion when child is opened by others is not expected to SUCCESS. " +
                                "Actually server returns with {0}.", Smb2Status.GetStatusCode(header.Status));
                            BaseTestSite.CaptureRequirementIfAreEqual(
                                Smb2Status.STATUS_DIRECTORY_NOT_EMPTY,
                                header.Status,
                                RequirementCategory.STATUS_DIRECTORY_NOT_EMPTY.Id,
                                RequirementCategory.STATUS_DIRECTORY_NOT_EMPTY.Description);
                        });

            status = clientTriggeringBreak.Close(treeIdClientTriggeringBreak, fileIdClientTriggeringBreak);
            #endregion

            #region CREATE an open to parent directory again
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "CREATE an open to parent directory again.");

            // Currently we need an additional CREATE to open the parent directory to trigger the lease break
            // which is the same way when Windows attempt to delete the parent directory when child is opened by others
            Smb2CreateContextResponse[] serverCreateContexts;
            status = clientTriggeringBreak.Create(
                treeIdClientTriggeringBreak,
                targetName,
                CreateOptions_Values.FILE_DIRECTORY_FILE | CreateOptions_Values.FILE_DELETE_ON_CLOSE,
                out fileIdClientTriggeringBreak,
//.........这里部分代码省略.........
开发者ID:XiaotianLiuMS,项目名称:WindowsProtocolTestSuites,代码行数:101,代码来源:DirectoryLeasingExtendedTest.cs

示例4: DirectoryLeasing_BreakHandleCachingByParentRenamed

        public void DirectoryLeasing_BreakHandleCachingByParentRenamed()
        {
            #region Prepare test directory
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Create test directory.");
            uncSharePath = Smb2Utility.GetUncPath(TestConfig.SutComputerName, TestConfig.BasicFileShare);
            string parentDirectory = "ParentDirectory_" + Guid.NewGuid().ToString();
            sutProtocolController.CreateDirectory(uncSharePath, parentDirectory);
            testDirectory = CreateTestDirectory(TestConfig.SutComputerName, TestConfig.BasicFileShare + "\\" + parentDirectory);
            #endregion

            #region Initialize test clients
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Initialize test clients.");

            Guid clientGuidRequestingLease = Guid.NewGuid();
            Smb2FunctionalClient clientRequestingLease = new Smb2FunctionalClient(TestConfig.Timeout, TestConfig, BaseTestSite);

            Guid clientGuidTriggeringBreak = Guid.NewGuid();
            Smb2FunctionalClient clientTriggeringBreak = new Smb2FunctionalClient(TestConfig.Timeout, TestConfig, BaseTestSite);

            clientRequestingLease.Smb2Client.LeaseBreakNotificationReceived +=
                new Action<Packet_Header, LEASE_BREAK_Notification_Packet>(base.OnLeaseBreakNotificationReceived);

            clientRequestingLease.ConnectToServer(TestConfig.UnderlyingTransport, TestConfig.SutComputerName, TestConfig.SutIPAddress);
            clientTriggeringBreak.ConnectToServer(TestConfig.UnderlyingTransport, TestConfig.SutComputerName, TestConfig.SutIPAddress);
            #endregion

            #region CREATE an open to request lease
            uint treeIdClientRequestingLease;
            FILEID fileIdClientRequestingLease;
            string targetName = parentDirectory + "\\" + testDirectory;
            LeaseStateValues requestedLeaseState = LeaseStateValues.SMB2_LEASE_READ_CACHING | LeaseStateValues.SMB2_LEASE_HANDLE_CACHING;

            // Add expected NewLeaseState
            expectedNewLeaseState = LeaseStateValues.SMB2_LEASE_READ_CACHING;

            BaseTestSite.Log.Add(
                LogEntryKind.TestStep,
                "Client attempts to request lease {0} on directory {1}", requestedLeaseState, testDirectory);
            status = CreateOpenFromClient(clientRequestingLease, clientGuidRequestingLease, targetName, true, requestedLeaseState, AccessMask.GENERIC_READ, out treeIdClientRequestingLease, out fileIdClientRequestingLease);
            BaseTestSite.Assert.AreEqual(
                Smb2Status.STATUS_SUCCESS,
                status,
                "Create an open to {0} should succeed, actual status is {1}", testDirectory, Smb2Status.GetStatusCode(status));
            #endregion

            // Create a timer that signals the delegate to invoke CheckBreakNotification after 5 seconds
            Timer timer = new Timer(base.CheckBreakNotification, treeIdClientRequestingLease, 5000, Timeout.Infinite);
            base.clientToAckLeaseBreak = clientRequestingLease;

            #region Attempt to trigger lease break by renaming parent directory
            uint treeIdClientTriggeringBreak;
            FILEID fileIdClientTriggeringBreak;
            AccessMask accessMaskTrigger = AccessMask.DELETE;
            BaseTestSite.Log.Add(
                LogEntryKind.TestStep,
                "A separate client attempts to access directory {0} to trigger lease break by renaming its parent directory", testDirectory);
            status = CreateOpenFromClient(clientTriggeringBreak, clientGuidTriggeringBreak, parentDirectory, true, LeaseStateValues.SMB2_LEASE_NONE, accessMaskTrigger, out treeIdClientTriggeringBreak, out fileIdClientTriggeringBreak);
            BaseTestSite.Assert.AreEqual(
                Smb2Status.STATUS_SUCCESS,
                status,
                "Create an open to {0} should succeed, actual status is {1}", testDirectory, Smb2Status.GetStatusCode(status));

            #region SetFileAttributes with FileRenameInformation to rename parent directory
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "SetFileAttributes with FileRenameInformation to rename parent directory.");

            string newName = "Renamed" + parentDirectory;
            FileRenameInformation fileRenameInfo;
            fileRenameInfo.ReplaceIfExists = TypeMarshal.ToBytes(false)[0];
            fileRenameInfo.Reserved = new byte[7];
            fileRenameInfo.RootDirectory = FileRenameInformation_RootDirectory_Values.V1;
            fileRenameInfo.FileName = Encoding.Unicode.GetBytes(newName);
            fileRenameInfo.FileNameLength = (uint)fileRenameInfo.FileName.Length;

            byte[] inputBuffer;
            inputBuffer = TypeMarshal.ToBytes<FileRenameInformation>(fileRenameInfo);

            status = clientTriggeringBreak.SetFileAttributes(
                        treeIdClientTriggeringBreak,
                        (byte)FileInformationClasses.FileRenameInformation,
                        fileIdClientTriggeringBreak,
                        inputBuffer,
                        (header, response) =>
                        {
                            BaseTestSite.Assert.AreNotEqual(
                                Smb2Status.STATUS_SUCCESS,
                                header.Status,
                                "{0} should succeed, actually server returns {1}", header.Command, Smb2Status.GetStatusCode(header.Status));
                            BaseTestSite.CaptureRequirementIfAreEqual(
                                Smb2Status.STATUS_ACCESS_DENIED,
                                header.Status,
                                RequirementCategory.STATUS_ACCESS_DENIED.Id,
                                RequirementCategory.STATUS_ACCESS_DENIED.Description);
                        });
            #endregion

            #endregion

            // Sleep 10 seconds to make sure LeaseBreakNotification checked
            Thread.Sleep(10000);
        }
开发者ID:gitter-badger,项目名称:WindowsProtocolTestSuites,代码行数:100,代码来源:DirectoryLeasingExtendedTest.cs


注:本文中的Smb2FunctionalClient.SetFileAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。