/// <summary> /// Retrieve the content table for a folder. /// </summary> /// <param name="serverId">A 32-bit signed integer represent the Identity of server.</param> /// <param name="folderHandleIndex">The folder handle index</param> /// <param name="deleteFlags">The delete flag indicates whether checking delete.</param> /// <param name="rowCount">The row count.</param> /// <returns>Indicate the result of this ROP operation.</returns> public RopResult GetContentsTable(int serverId, int folderHandleIndex, DeleteFlags deleteFlags, out int rowCount) { RopResult result = RopResult.InvalidParameter; rowCount = -1; uint objHandle = this.handleContainer[folderHandleIndex]; RopGetContentsTableRequest getContentsTableRequest = new RopGetContentsTableRequest(); RopGetContentsTableResponse getContentsTableResponse = new RopGetContentsTableResponse(); getContentsTableRequest.RopId = 0x05; getContentsTableRequest.LogonId = 0x00; getContentsTableRequest.InputHandleIndex = 0x00; getContentsTableRequest.OutputHandleIndex = 0x01; // If this bit is set, the contents table lists only the soft-deleted messages. getContentsTableRequest.TableFlags = 0x20; getContentsTableResponse = (RopGetContentsTableResponse)this.Process(serverId, getContentsTableRequest, objHandle); result = (RopResult)getContentsTableResponse.ReturnValue; int expectedRowCount = (int)getContentsTableResponse.RowCount; // Add this condition to match the model logical for return result, it's better to compare. if (deleteFlags == DeleteFlags.SoftDeleteCheck && this.currentSoftDeleteRowCount + 1 == expectedRowCount) { rowCount = 1; } else if (deleteFlags == DeleteFlags.HardDeleteCheck && this.currentSoftDeleteRowCount == expectedRowCount) { rowCount = 0; } else if (deleteFlags == DeleteFlags.Initial) { rowCount = 0; } else if (deleteFlags == DeleteFlags.SoftDeleteCheck && this.isImportMessageMoveROP && this.currentSoftDeleteRowCount + 1 == expectedRowCount) { rowCount = 1; } this.currentSoftDeleteRowCount = expectedRowCount; return result; }
/// <summary> /// Verify the response of RopGetContentsTable ROP operation. /// </summary> /// <param name="getContentsTableResponse">The response of RopGetContentsTable operation</param> private void VerifyRopGetContentsTable(RopGetContentsTableResponse getContentsTableResponse) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R332"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R332 Site.CaptureRequirementIfAreEqual<uint>( Constants.SuccessCode, getContentsTableResponse.ReturnValue, 332, @"[In RopGetContentsTable 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_R320"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R320 Site.CaptureRequirementIfAreEqual<uint>( Constants.SuccessCode, getContentsTableResponse.ReturnValue, 320, @"[In RopGetContentsTable ROP] The RopGetContentsTable ROP ([MS-OXCROPS] section 2.2.4.14) is used to retrieve the contents table for a folder."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R321"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R321 Site.CaptureRequirementIfAreEqual<uint>( Constants.SuccessCode, getContentsTableResponse.ReturnValue, 321, @"[In RopGetContentsTable ROP] This ROP [RopGetContentsTable] returns a Table object on which table operations can be performed."); }
/// <summary> /// Verify RopGetContentsTable Failure Response /// </summary> /// <param name="ropGetContentsTableResponse">The failure response of RopGetContentsTable request</param> /// <param name="outputHandleIndex">The field of OutputHandleIndex in RopGetContentsTable request</param> private void VerifyRopGetContentsTableFailureResponse(RopGetContentsTableResponse ropGetContentsTableResponse, byte outputHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1036"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1036 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropGetContentsTableResponse.RopId.GetType(), 1036, @"[In RopGetContentsTable ROP Failure Response Buffer] RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1038"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1038 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopGetContentsTable, ropGetContentsTableResponse.RopId, 1038, @"[In RopGetContentsTable ROP Failure Response Buffer] RopId (1 byte): For this operation[RopGetContentsTable], this field[RopId (1 byte)] is set to 0x05."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1039"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1039 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropGetContentsTableResponse.OutputHandleIndex.GetType(), 1039, @"[In RopGetContentsTable ROP Failure Response Buffer] OutputHandleIndex (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1040"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1040 Site.CaptureRequirementIfAreEqual<byte>( outputHandleIndex, ropGetContentsTableResponse.OutputHandleIndex, 1040, @"[In RopGetContentsTable 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_R1041"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1041 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropGetContentsTableResponse.ReturnValue.GetType(), 1041, @"[In RopGetContentsTable ROP Failure Response Buffer] ReturnValue (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1043"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1043 Site.CaptureRequirementIfAreNotEqual<uint>( SuccessReturnValue, ropGetContentsTableResponse.ReturnValue, 1043, @"[In RopGetContentsTable ROP Failure Response Buffer] ReturnValue (4 bytes): For this response[Failure Response], this field is set to a value other than 0x00000000."); }