/// <summary> /// Open the attachment /// </summary> /// <param name="objectHandle">A Server object handle.</param> /// <param name="openAttachmentResponse">The RopOpenAttachmentResponse value.</param> /// <param name="attachmentId">The ID of an attachment to be opened.</param> /// <param name="openFlags">The OpenModeFlags value.</param> /// <returns>A Server object handle of the opened attachment.</returns> private uint OpenAttachment(uint objectHandle, out RopOpenAttachmentResponse openAttachmentResponse, uint attachmentId, OpenAttachmentFlags openFlags) { RopOpenAttachmentRequest openAttachmentRequest = new RopOpenAttachmentRequest() { RopId = (byte)RopId.RopOpenAttachment, LogonId = CommonLogonId, // The logonId 0x00 is associated with this operation. InputHandleIndex = CommonInputHandleIndex, // This index specifies the location 0x00 in the Server Object Handle Table where the handle for the input Server Object is stored. OutputHandleIndex = CommonOutputHandleIndex, // This index specifies the location 0x01 in the Server Object Handle Table where the handle for the output Server Object is stored. OpenAttachmentFlags = (byte)openFlags, AttachmentID = attachmentId }; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(openAttachmentRequest, objectHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); openAttachmentResponse = (RopOpenAttachmentResponse)this.response; return this.ResponseSOHs[0][openAttachmentResponse.OutputHandleIndex]; }
/// <summary> /// This ROP opens an attachment of a message. /// </summary> /// <param name="handle">The handle to operate.</param> /// <param name="attachmentId">The identifier of the attachment to be opened. </param> /// <param name="openAttachmentResponse">The response of this ROP.</param> /// <param name="needVerify">Whether need to verify the response.</param> /// <returns>The index of the output handle for the response.</returns> private uint RopOpenAttachment(uint handle, uint attachmentId, out RopOpenAttachmentResponse openAttachmentResponse, bool needVerify) { this.rawDataValue = null; this.responseValue = null; this.responseSOHsValue = null; RopOpenAttachmentRequest openAttachmentRequest = new RopOpenAttachmentRequest() { RopId = (byte)RopId.RopOpenAttachment, LogonId = LogonId, InputHandleIndex = (byte)HandleIndex.FirstIndex, OutputHandleIndex = (byte)HandleIndex.SecondIndex, OpenAttachmentFlags = (byte)OpenAttachmentFlags.ReadWrite, AttachmentID = attachmentId }; this.responseSOHsValue = this.ProcessSingleRop(openAttachmentRequest, handle, ref this.responseValue, ref this.rawDataValue, RopResponseType.SuccessResponse); openAttachmentResponse = (RopOpenAttachmentResponse)this.responseValue; if (needVerify) { this.Site.Assert.AreEqual((uint)RopResponseType.SuccessResponse, openAttachmentResponse.ReturnValue, string.Format("RopOpenAttachment Failed! Error: 0x{0:X8}", openAttachmentResponse.ReturnValue)); } return this.responseSOHsValue[0][openAttachmentResponse.OutputHandleIndex]; }
/// <summary> /// Verify RopOpenAttachment Response /// </summary> /// <param name="ropOpenAttachmentResponse">The response of RopOpenAttachment request</param> /// <param name="outputHandleIndex">The field of OutputHandleIndex in RopOpenAttachment request</param> private void VerifyRopOpenAttachmentResponse(RopOpenAttachmentResponse ropOpenAttachmentResponse, byte outputHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2143"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2143 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropOpenAttachmentResponse.RopId.GetType(), 2143, @"[In RopOpenAttachment ROP Response Buffer] RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2145"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2145 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopOpenAttachment, ropOpenAttachmentResponse.RopId, 2145, @"[In RopOpenAttachment ROP Response Buffer,RopId (1 byte)]For this operation[RopOpenAttachment], this field is set to 0x22."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2146"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2146 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropOpenAttachmentResponse.OutputHandleIndex.GetType(), 2146, @"[In RopOpenAttachment ROP Response Buffer]OutputHandleIndex (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R2147"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2147 Site.CaptureRequirementIfAreEqual<byte>( outputHandleIndex, ropOpenAttachmentResponse.OutputHandleIndex, 2147, @"[In RopOpenAttachment ROP 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_R2149"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R2149 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropOpenAttachmentResponse.ReturnValue.GetType(), 2149, @"[In RopOpenAttachment ROP Response Buffer]ReturnValue (4 bytes): An unsigned integer."); }