/// <summary> /// Verify the response of RopCreateFolder ROP operation. /// </summary> /// <param name="createFolderResponse">The response of RopCreateFolder operation</param> private void VerifyRopCreateFolder(RopCreateFolderResponse createFolderResponse) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R58"); // If the RopCreateFolder operation returns successfully, it indicates that the server creates a new folder. // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R58 Site.CaptureRequirementIfAreEqual<uint>( Constants.SuccessCode, createFolderResponse.ReturnValue, 58, @"[RopCreateFolder ROP Response Buffer] ReturnValue (4 bytes): The server returns 0x00000000 to indicate success."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R37"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R37 Site.CaptureRequirementIfAreEqual<uint>( Constants.SuccessCode, createFolderResponse.ReturnValue, 37, @"[In RopCreateFolder ROP] The RopCreateFolder ROP ([MS-OXCROPS] section 2.2.4.2) creates a new folder."); if (createFolderResponse.IsExistingFolder != 0) { Site.Assert.IsNotNull(createFolderResponse.IsGhosted, "[In RopCreateFolder Rop response] The IsGhosted field should be present when the IsExistingFolder field is set to a nonzero (TRUE) value."); if (createFolderResponse.IsGhosted != 0) { Site.Assert.IsNotNull(createFolderResponse.ServerCount, "[In RopCreateFolder Rop response] The ServerCount field should be present when the IsGhosted field is set to a nonzero (TRUE) value."); Site.Assert.IsNotNull(createFolderResponse.CheapServerCount, "[In RopCreateFolder Rop response] The CheapServerCount field should be present when the IsGhosted field is set to a nonzero (TRUE) value."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R936"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R936 Site.CaptureRequirementIfIsTrue( createFolderResponse.CheapServerCount <= createFolderResponse.ServerCount, 936, @"[In RopCreateFolder ROP Response Buffer] The value of this field [CheapServerCount] MUST be less than or equal to the value of the ServerCount field."); if (createFolderResponse.ServerCount > 0) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R937"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R937 Site.CaptureRequirementIfIsTrue( createFolderResponse.CheapServerCount > 0, 937, @"[In RopCreateFolder ROP Response Buffer] And [the value of this field ""CheapServerCount""] MUST be greater than zero when the value of the ServerCount field is greater than zero."); } // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R940, the number of strings contained in field Servers is {0}, the ServerCount is {1}.", createFolderResponse.Servers.Length, createFolderResponse.ServerCount); bool isVerifiedR940 = false; if (createFolderResponse.Servers == null) { isVerifiedR940 = createFolderResponse.ServerCount == 0; } else { isVerifiedR940 = createFolderResponse.ServerCount == (ushort)createFolderResponse.Servers.Length; } // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R940. Site.CaptureRequirementIfIsTrue( isVerifiedR940, 940, @"[In RopCreateFolder ROP Response Buffer] The number of strings contained in this field [Servers] is specified by the ServerCount field."); } } }
/// <summary> /// This method is used to copy or move properties from a source object to a destination object with error code returned. /// </summary> /// <param name="condition">Specifies a special scenario of RopCopyTo.</param> public void RopCopyToMethodForErrorCodeTable(CopyToCondition condition) { // The source handle. uint sourceHandle = 0; // The destination handle. uint destHandle = 0; uint destMessageHandleFirst = 0; uint destMessageHandleSecond = 0; if ((condition == CopyToCondition.SourceMessageContainsDestMessage) || (condition == CopyToCondition.SourceMessageIndirectlyContainsDestMessage)) { this.GetDestinationMessageHandle(cprptMessageHandle[0], out destMessageHandleFirst, out destMessageHandleSecond); } RopCreateFolderResponse createFolderResponse = new RopCreateFolderResponse(); switch (condition) { case CopyToCondition.SourceDestNotCompatible: sourceHandle = cprptMessageHandle[0]; destHandle = cprptFolderHandle[0]; break; case CopyToCondition.SourceContainsDest: sourceHandle = cprptFolderHandle[2]; destHandle = this.RopCreateFolder(sourceHandle, out createFolderResponse, SubFolder, SubFolder, true); break; case CopyToCondition.SourceDestHasSubObjWithSameDisplayName: // Create sub folder for Folder1 and Folder2 with the same name. this.RopCreateFolder(cprptFolderHandle[1], out createFolderResponse, SubFolder, SubFolder, true); this.RopCreateFolder(cprptFolderHandle[2], out createFolderResponse, SubFolder, SubFolder, true); sourceHandle = cprptFolderHandle[1]; destHandle = cprptFolderHandle[2]; break; case CopyToCondition.Normal: sourceHandle = cprptMessageHandle[0]; destHandle = cprptMessageHandle[1]; break; case CopyToCondition.SourceMessageContainsDestMessage: sourceHandle = cprptMessageHandle[0]; destHandle = destMessageHandleFirst; break; case CopyToCondition.SourceMessageIndirectlyContainsDestMessage: sourceHandle = cprptMessageHandle[0]; destHandle = destMessageHandleSecond; break; default: this.Site.Assert.Fail("Invalid CopyToCondition enum value {0}.", condition); break; } // Copy subobject. byte wantSubObject = Convert.ToByte(true); RopCopyToResponse copyToRes = (RopCopyToResponse)this.RopCopyTo(sourceHandle, destHandle, (byte)HandleIndex.FirstIndex, (byte)HandleIndex.SecondIndex, 0, wantSubObject, (byte)RopCopyToCopyFlags.Move, null); this.VerifyRopCopyTo(copyToRes, condition, this.cprptCurrentType, CopyFlags.Move); }
/// <summary> /// Initialize a generic folder under inbox as a root folder for test. /// </summary> protected void GenericFolderInitialization() { RopLogonResponse logonResponse = this.Logon(LogonFlags.Private, out this.logonHandle); #region Open the inbox folder. RopOpenFolderRequest openFolderRequest = new RopOpenFolderRequest { RopId = (byte)RopId.RopOpenFolder, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, OutputHandleIndex = Constants.CommonOutputHandleIndex, FolderId = logonResponse.FolderIds[Constants.InboxIndex], OpenModeFlags = (byte)FolderOpenModeFlags.OpenSoftDeleted }; // Use the logon object as input handle here. RopOpenFolderResponse openFolderResponse = this.Adapter.OpenFolder(openFolderRequest, this.LogonHandle, ref this.responseHandles); this.inboxFolderHandle = this.responseHandles[0][openFolderResponse.OutputHandleIndex]; #endregion #region Create a generic folder for test. RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest(); RopCreateFolderResponse createFolderResponse = new RopCreateFolderResponse(); createFolderRequest.RopId = (byte)RopId.RopCreateFolder; createFolderRequest.LogonId = Constants.CommonLogonId; createFolderRequest.InputHandleIndex = Constants.CommonInputHandleIndex; createFolderRequest.OutputHandleIndex = Constants.CommonOutputHandleIndex; createFolderRequest.FolderType = 0x01; createFolderRequest.UseUnicodeStrings = 0x0; createFolderRequest.OpenExisting = 0x01; createFolderRequest.Reserved = 0x0; createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(this.RootFolder); createFolderRequest.Comment = Encoding.ASCII.GetBytes(this.RootFolder); createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.inboxFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(0, createFolderResponse.ReturnValue, "Creating Folder should succeed."); this.rootFolderHandle = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; this.rootFolderId = createFolderResponse.FolderId; this.isRootFolderCreated = true; #endregion }
/// <summary> /// This ROP creates a new subfolder. /// </summary> /// <param name="handle">The handle to operate.</param> /// <param name="createFolderResponse">The response of this ROP.</param> /// <param name="displayName">The name of the created folder. </param> /// <param name="comment">The folder comment that is associated with the created folder.</param> /// <param name="needVerify">Whether need to verify the response.</param> /// <returns>The handle of new folder.</returns> private uint RopCreateFolder(uint handle, out RopCreateFolderResponse createFolderResponse, string displayName, string comment, bool needVerify) { this.rawDataValue = null; this.responseValue = null; this.responseSOHsValue = null; RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest() { RopId = (byte)RopId.RopCreateFolder, LogonId = LogonId, InputHandleIndex = (byte)HandleIndex.FirstIndex, OutputHandleIndex = (byte)HandleIndex.SecondIndex, FolderType = (byte)FolderType.Genericfolder, UseUnicodeStrings = Convert.ToByte(false), OpenExisting = Convert.ToByte(true), Reserved = ReservedValue, DisplayName = Encoding.ASCII.GetBytes(displayName + "\0"), Comment = Encoding.ASCII.GetBytes(comment + "\0") }; this.responseSOHsValue = this.ProcessSingleRop(createFolderRequest, handle, ref this.responseValue, ref this.rawDataValue, RopResponseType.SuccessResponse); createFolderResponse = (RopCreateFolderResponse)this.responseValue; if (needVerify) { this.Site.Assert.AreEqual((uint)RopResponseType.SuccessResponse, createFolderResponse.ReturnValue, string.Format("RopCreateFolder Failed! Error: 0x{0:X8}", createFolderResponse.ReturnValue)); } return this.responseSOHsValue[0][createFolderResponse.OutputHandleIndex]; }
public void MSOXCFOLD_S04_TC08_RopHardDeleteMessagesAndSubfoldersInPublicFolder() { if (!Common.IsRequirementEnabled(98301002, this.Site)) { this.NeedCleanup = false; Site.Assert.Inconclusive("The server does not support the RopHardDeleteMessagesAndSubfolders ROP for public folders."); } this.CheckWhetherSupportTransport(); this.Logon(); this.PublicFolderInitialization(); #region Step 1. The client calls RopCreateFolder to create [MSOXCFOLDSubfolder1] under the root public folder. RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest(); RopCreateFolderResponse createFolderResponse = new RopCreateFolderResponse(); createFolderRequest.RopId = (byte)RopId.RopCreateFolder; createFolderRequest.LogonId = Constants.CommonLogonId; createFolderRequest.InputHandleIndex = Constants.CommonInputHandleIndex; createFolderRequest.OutputHandleIndex = Constants.CommonOutputHandleIndex; createFolderRequest.FolderType = (byte)FolderType.Genericfolder; createFolderRequest.UseUnicodeStrings = 0x0; createFolderRequest.OpenExisting = 0x01; createFolderRequest.Reserved = 0x0; createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(Constants.Subfolder1); createFolderRequest.Comment = Encoding.ASCII.GetBytes(Constants.Subfolder1); createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.publicRootFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(0, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully."); uint subfolderHandle1 = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; #endregion #region Step 2. The client calls RopCreateFolder to create [MSOXCFOLDSubfolder2] under [MSOXCFOLDSubfolder1]. createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(Constants.Subfolder2); createFolderRequest.Comment = Encoding.ASCII.GetBytes(Constants.Subfolder2); createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, subfolderHandle1, ref this.responseHandles); Site.Assert.AreEqual<uint>(0, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully."); #endregion #region Step 3. The client creates a message in [MSOXCFOLDSubfolder1]. uint messageHandle = 0; ulong messageId = 0; this.CreateSaveMessage(this.publicRootFolderHandle, this.publicRootFolderId, ref messageId, ref messageHandle); #endregion #region Step 4. The client calls RopHardDeleteMessagesAndSubfolders applying to [MSOXCFOLDSubfolder1]. object ropResponse = new object(); RopHardDeleteMessagesAndSubfoldersRequest hardDeleteMessagesAndSubfoldersRequest = new RopHardDeleteMessagesAndSubfoldersRequest(); RopHardDeleteMessagesAndSubfoldersResponse hardDeleteMessagesAndSubfoldersResponse; hardDeleteMessagesAndSubfoldersRequest.RopId = (byte)RopId.RopHardDeleteMessagesAndSubfolders; hardDeleteMessagesAndSubfoldersRequest.LogonId = Constants.CommonLogonId; hardDeleteMessagesAndSubfoldersRequest.InputHandleIndex = Constants.CommonInputHandleIndex; hardDeleteMessagesAndSubfoldersRequest.WantAsynchronous = 0x00; hardDeleteMessagesAndSubfoldersRequest.WantDeleteAssociated = 0xFF; this.Adapter.DoRopCall(hardDeleteMessagesAndSubfoldersRequest, subfolderHandle1, ref ropResponse, ref this.responseHandles); hardDeleteMessagesAndSubfoldersResponse = (RopHardDeleteMessagesAndSubfoldersResponse)ropResponse; Site.Assert.AreEqual<uint>(0, hardDeleteMessagesAndSubfoldersResponse.ReturnValue, "RopHardDeleteMessagesAndSubfolders ROP operation performs successfully."); Site.Assert.AreEqual<uint>(0, hardDeleteMessagesAndSubfoldersResponse.PartialCompletion, "If delete all subsets of targets succeeds, PartialCompletion of its response will be 0 (success)"); #endregion #region Step 5. The client calls GetContentsTable to retrieve the contents table of [MSOXCFOLDSubfolder1]. RopGetContentsTableRequest getContentsTableRequest = new RopGetContentsTableRequest { RopId = (byte)RopId.RopGetContentsTable, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, OutputHandleIndex = Constants.CommonOutputHandleIndex, TableFlags = (byte)FolderTableFlags.None }; RopGetContentsTableResponse getContentsTableResponse = this.Adapter.GetContentsTable(getContentsTableRequest, subfolderHandle1, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getContentsTableResponse.ReturnValue, "RopGetContentsTable ROP operation performs successfully!"); #endregion #region Step 6. The client calls GetHierarchyTable to retrieve the hierarchy table of [MSOXCFOLDSubfolder1]. RopGetHierarchyTableRequest getHierarchyTableRequest = new RopGetHierarchyTableRequest { RopId = (byte)RopId.RopGetHierarchyTable, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, OutputHandleIndex = Constants.CommonOutputHandleIndex, TableFlags = (byte)FolderTableFlags.None }; RopGetHierarchyTableResponse getHierarchyTableResponse = this.Adapter.GetHierarchyTable(getHierarchyTableRequest, subfolderHandle1, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getHierarchyTableResponse.ReturnValue, "RopGetHierarchyTable ROP operation performs successfully!"); // Add the debug information. Site.Log.Add( LogEntryKind.Debug, "Verify MS-OXCFOLD_R98301002: The message count of the target folder after RopEmptyFolder is {0}, the subfolder count of the target folder after RopEmptyFolder is {1}", getContentsTableResponse.RowCount, getHierarchyTableResponse.RowCount); bool isVerifyR98301002 = getHierarchyTableResponse.RowCount == 0 && getContentsTableResponse.RowCount == 0; // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R98301002. Site.CaptureRequirementIfIsTrue( isVerifyR98301002, 98301002, @"[In Appendix A: Product Behavior] Implementation does support the RopHardDeleteMessagesAndSubfolders ROP ([MS-OXCROPS] section 2.2.4.10) for public folders. (Microsoft Exchange Server 2007 and Microsoft Exchange Server 2010 follow this behavior.)"); #endregion }
/// <summary> /// Verify RopCreateFolder Failure Response /// </summary> /// <param name="ropCreateFolderResponse">The failure response of RopCreateFolder request</param> /// <param name="outputHandleIndex">The field of OutputHandleIndex in RopCreateFolder request</param> private void VerifyRopCreateFolderFailureResponse(RopCreateFolderResponse ropCreateFolderResponse, byte outputHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R645"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R645 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropCreateFolderResponse.RopId.GetType(), 645, @"[In RopCreateFolder ROP Failure Response Buffer] RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R647"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R647 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopCreateFolder, ropCreateFolderResponse.RopId, 647, @"[In RopCreateFolder ROP Failure Response Buffer] RopId (1 byte): For this operation[RopCreateFolder], this field[RopId (1 byte)] is set to 0x1C."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R648"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R648 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropCreateFolderResponse.OutputHandleIndex.GetType(), 648, @"[In RopCreateFolder ROP Failure Response Buffer] OutputHandleIndex (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R649"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R649 Site.CaptureRequirementIfAreEqual<byte>( outputHandleIndex, ropCreateFolderResponse.OutputHandleIndex, 649, @"[In RopCreateFolder ROP Failure Response Buffer] OutputHandleIndex (1 byte): This index MUST be set to the value specified in the OutputHandleIndex field in the request."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R650"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R650 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropCreateFolderResponse.ReturnValue.GetType(), 650, @"[In RopCreateFolder ROP Failure Response Buffer] ReturnValue (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R652"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R652 Site.CaptureRequirementIfAreNotEqual<uint>( SuccessReturnValue, ropCreateFolderResponse.ReturnValue, 652, @"[In RopCreateFolder ROP Failure Response Buffer] ReturnValue (4 bytes): For this response[Failure Response], this field[ReturnValue (4 bytes)] is set to a value other than 0x00000000."); }
/// <summary> /// Verify RopCreateFolder Success Response /// </summary> /// <param name="ropCreateFolderResponse">The success response of RopCreateFolder request</param> /// <param name="outputHandleIndex">The field of OutputHandleIndex in RopCreateFolder request</param> private void VerifyRopCreateFolderSuccessResponse(RopCreateFolderResponse ropCreateFolderResponse, byte outputHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R609"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R609 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropCreateFolderResponse.RopId.GetType(), 609, @"[In RopCreateFolder ROP Success Response Buffer] RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R611"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R611 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopCreateFolder, ropCreateFolderResponse.RopId, 611, @"[In RopCreateFolder ROP Success Response Buffer] RopId (1 byte): For this operation[RopCreateFolder], this field[RopId (1 byte)] is set to 0x1C."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R612"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R612 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropCreateFolderResponse.OutputHandleIndex.GetType(), 612, @"[In RopCreateFolder ROP Success Response Buffer] OutputHandleIndex (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R613"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R613 Site.CaptureRequirementIfAreEqual<byte>( outputHandleIndex, ropCreateFolderResponse.OutputHandleIndex, 613, @"[In RopCreateFolder ROP Success Response Buffer] OutputHandleIndex (1 byte): This index MUST be set to the value specified in the OutputHandleIndex field in the request."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R614"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R614 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropCreateFolderResponse.ReturnValue.GetType(), 614, @"[In RopCreateFolder ROP Success Response Buffer] ReturnValue (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R616"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R616 Site.CaptureRequirementIfAreEqual<uint>( SuccessReturnValue, ropCreateFolderResponse.ReturnValue, 616, @"[In RopCreateFolder ROP Success Response Buffer] ReturnValue (4 bytes): For this response[Success Response], this field is set to 0x00000000."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R617"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R617 Site.CaptureRequirementIfAreEqual<int>( 8, Marshal.SizeOf(ropCreateFolderResponse.FolderId), 617, @"[In RopCreateFolder ROP Success Response Buffer] FolderId (8 bytes): An identifier."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R619,IsExistingFolder:{0}", ropCreateFolderResponse.IsExistingFolder); // Verify MS-OXCROPS requirement: MS-OXCROPS_R619 // If IsExistingFolder is byte type and can be boolean type representation, then verify R619 bool isVerifyR619 = (typeof(byte) == ropCreateFolderResponse.IsExistingFolder.GetType()) && ((Convert.ToBoolean(ropCreateFolderResponse.IsExistingFolder) == true) || (Convert.ToBoolean(ropCreateFolderResponse.IsExistingFolder) == false)); Site.CaptureRequirementIfIsTrue( isVerifyR619, 619, @"[In RopCreateFolder ROP Success Response Buffer] IsExistingFolder (1 byte): A Boolean."); if (ropCreateFolderResponse.HasRules != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R621,HasRules:{0}", ropCreateFolderResponse.HasRules); // Verify MS-OXCROPS requirement: MS-OXCROPS_R621 // If HasRules is byte type and can be boolean type representation, then verify R621 bool isVerifyR621 = (typeof(byte) == ropCreateFolderResponse.HasRules.GetType()) && ((Convert.ToBoolean(ropCreateFolderResponse.HasRules) == true) || (Convert.ToBoolean(ropCreateFolderResponse.HasRules) == false)); Site.CaptureRequirementIfIsTrue( isVerifyR621, 621, @"[In RopCreateFolder ROP Success Response Buffer] HasRules (1 byte): A Boolean."); } if (ropCreateFolderResponse.IsGhosted != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R625,IsGhosted:{0}", ropCreateFolderResponse.IsGhosted); // Verify MS-OXCROPS requirement: MS-OXCROPS_R625 // If IsGhosted is byte type and can be boolean type representation, then verify R625 bool isVerifyR625 = (typeof(byte) == ropCreateFolderResponse.IsGhosted.GetType()) && ((Convert.ToBoolean(ropCreateFolderResponse.IsGhosted) == true) || (Convert.ToBoolean(ropCreateFolderResponse.IsGhosted) == false)); Site.CaptureRequirementIfIsTrue( isVerifyR625, 625, @"[In RopCreateFolder ROP Success Response Buffer] IsGhosted (1 byte): A Boolean."); } // The field ServerCount,CheapServerCount and Servers are present if IsGhosted is non-zero, and are not present if IsGhosted is zero. if (ropCreateFolderResponse.IsGhosted != null && ropCreateFolderResponse.IsGhosted != 0) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R629"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R629 Site.CaptureRequirementIfAreEqual<Type>( typeof(ushort), ropCreateFolderResponse.ServerCount.GetType(), 629, @"[In RopCreateFolder ROP Success Response Buffer] ServerCount (2 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R633"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R633 Site.CaptureRequirementIfAreEqual<Type>( typeof(ushort), ropCreateFolderResponse.CheapServerCount.GetType(), 633, @"[In RopCreateFolder ROP Success Response Buffer] CheapServerCount (2 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R637,the length of the Servers is {0}", ropCreateFolderResponse.Servers.Length); // Verify MS-OXCROPS requirement: MS-OXCROPS_R637 // Assume the result is true. If one of List is not null-terminated ASCII string, then false. bool isVerifyR637 = true; foreach (string s in ropCreateFolderResponse.Servers) { byte[] buffer = Encoding.ASCII.GetBytes(s); isVerifyR637 = isVerifyR637 && this.IsNullTerminatedASCIIStr(buffer); // If one of List is not null-terminated ASCII string then break iteration if (!isVerifyR637) { break; } } Site.CaptureRequirementIfIsTrue( isVerifyR637, 637, @"[In RopCreateFolder ROP Success Response Buffer] Servers (variable):A list of null-terminated ASCII strings."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R640"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R640 Site.CaptureRequirementIfAreEqual<ushort>( (ushort)ropCreateFolderResponse.ServerCount, (ushort)ropCreateFolderResponse.Servers.Length, 640, @"[In RopCreateFolder ROP Success Response Buffer] Servers (variable): The number of strings contained in this field is specified by the ServersCount field."); } }
/// <summary> /// This ROP creates a new subfolder. /// </summary> /// <param name="handle">Handle to operate.</param> /// <param name="displayName">This value specifies the name of the created folder. .</param> /// <param name="comment">This value specifies the folder comment that is associated with the created folder.</param> /// <param name="createFolderResponse">Response of this ROP.</param> /// <returns>Handle of new folder.</returns> public uint RopCreateFolder(uint handle, string displayName, string comment, out RopCreateFolderResponse createFolderResponse) { this.rawData = null; this.response = null; this.responseSOHs = null; RopCreateFolderRequest createFolderRequest; createFolderRequest.RopId = 0x1C; createFolderRequest.LogonId = 0x0; createFolderRequest.InputHandleIndex = 0x0; createFolderRequest.OutputHandleIndex = 0x01; // Generic folder createFolderRequest.FolderType = 0x01; // FALSE createFolderRequest.UseUnicodeStrings = 0x0; // non-zero(TRUE) createFolderRequest.OpenExisting = 0xFF; // FALSE createFolderRequest.Reserved = 0x0; createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(displayName + "\0"); createFolderRequest.Comment = Encoding.ASCII.GetBytes(comment + "\0"); this.responseSOHs = this.DoRPCCall(createFolderRequest, handle, ref this.response, ref this.rawData); createFolderResponse = (RopCreateFolderResponse)this.response; uint folderHandle = this.responseSOHs[0][createFolderResponse.OutputHandleIndex]; return folderHandle; }