/// <summary>
        /// Verify RopSeekStream Failure Response
        /// </summary>
        /// <param name="ropSeekStreamResponse">The failure response of RopSeekStream request</param>
        /// <param name="inputHandleIndex">The field of InputHandleIndex in RopSeekStream request</param>
        private void VerifyRopSeekStreamFailureResponse(RopSeekStreamResponse ropSeekStreamResponse, byte inputHandleIndex)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3355");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3355
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropSeekStreamResponse.RopId.GetType(),
                3355,
                @"[In RopSeekStream ROP Failure Response Buffer]RopId (1 byte): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3357");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3357
            Site.CaptureRequirementIfAreEqual<byte>(
                (byte)RopId.RopSeekStream,
                ropSeekStreamResponse.RopId,
                3357,
                @"[In RopSeekStream ROP Failure Response Buffer,RopId (1 byte)]For this operation[RopSeekStream], this field is set to 0x2E.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3358");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3358
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropSeekStreamResponse.InputHandleIndex.GetType(),
                3358,
                @"[In RopSeekStream ROP Failure Response Buffer]InputHandleIndex (1 byte): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3359");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3359
            Site.CaptureRequirementIfAreEqual<byte>(
                inputHandleIndex,
                ropSeekStreamResponse.InputHandleIndex,
                3359,
                @"[In RopSeekStream ROP Failure Response Buffer,InputHandleIndex (1 byte)]This index MUST be set to the value specified in the InputHandleIndex field in the request.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3361");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3361
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(uint),
                ropSeekStreamResponse.ReturnValue.GetType(),
                3361,
                @"[In RopSeekStream ROP Failure Response Buffer]ReturnValue (4 bytes): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3363");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3363
            Site.CaptureRequirementIfAreNotEqual<uint>(
                SuccessReturnValue,
                ropSeekStreamResponse.ReturnValue,
                3363,
                @"[In Failure Response Buffer,ReturnValue (4 bytes)]For this response[Failure Response ], this
                field is set to a value other than 0x00000000.");
        }
Пример #2
0
        /// <summary>
        /// Verify the RopSeekStream operation related requirements.
        /// </summary>
        /// <param name="ropSeekStreamResponse">The RopSeekStream response buffer structure.</param>
        /// <param name="seekStereamCondition">Specifies the particular scenario when performing RopSeekStream.</param>
        private void VerifyRopSeekStream(RopSeekStreamResponse ropSeekStreamResponse, SeekStreamCondition seekStereamCondition)
        {
            // Since the RopSeekStream ROP response was parsed successfully, MS-OXCPRPT_R57902 can be captured directly.
            Site.CaptureRequirement(
                57902,
                @"[In Processing RopSeekStream] The server responds with a RopSeekStream ROP response buffer.");

            // CPRPTErrorCode.None indicates the operation is performed successfully.
            if (ropSeekStreamResponse.ReturnValue.Equals((uint)CPRPTErrorCode.None))
            {
                // If this operation is performed successfully, that means this operation is valid on Stream objects.
                Site.CaptureRequirement(
                    33101,
                    @"[In RopSeekStream ROP] This ROP is valid on Stream objects.");

                // Since the RopSeekStream ROP response is performed successfully, MS-OXCPRPT_R581 can be captured directly.
                Site.CaptureRequirement(
                  581,
                  @"[In Processing RopSeekStream] The server modifies the location of the seek point associated with the Stream object according to the ROP request buffer. ");

                // Since the RopSeekStream ROP response is performed successfully, MS-OXCPRPT_R330 can be captured directly.
                Site.CaptureRequirement(
                    330,
                    @"[In RopSeekStream ROP] RopSeekStream sets the seek pointer to a new location.");

                // The parser has ensured the field satisfied the format, otherwise the response cannot be received.
                Site.CaptureRequirement(
                   341,
                   @"[In  RopSeekStream ROP Response Buffer] NewPosition (8 bytes): An integer.");
            }

            if (seekStereamCondition == SeekStreamCondition.OriginInvalid)
            {
                if (Common.IsRequirementEnabled(903, this.Site))
                {
                    Site.CaptureRequirementIfAreEqual<uint>(
                        (uint)CPRPTErrorCode.StreamInvalidParam,
                        ropSeekStreamResponse.ReturnValue,
                        903,
                        @"[In Processing RopSeekStream] Implementation does return error code ""0x80030057"" with name ""StreamInvalidParam"", when The value of the Origin field is invalid.(Microsoft Exchange Server 2007 and above follow this behavior)");
                }
            }

            if (seekStereamCondition == SeekStreamCondition.MovedBeyondMaxStreamSize)
            {
                if (Common.IsRequirementEnabled(894, this.Site))
                {
                    Site.CaptureRequirementIfAreEqual<uint>(
                        (uint)CPRPTErrorCode.StreamSeekError,
                        ropSeekStreamResponse.ReturnValue,
                        894,
                        @"[In Appendix A: Product Behavior] Implementation does return error code ""0x80030019"" with name ""StreamSeekError"",  When Tried to seek to offset before the start or beyond the max stream size of 2^31.(Microsoft Exchange Server 2007 and above follow this behavior)");
                }
            }
        }
        /// <summary>
        /// Verify RopSeekStream Success Response
        /// </summary>
        /// <param name="ropSeekStreamResponse">The success response of RopSeekStream request</param>
        /// <param name="inputHandleIndex">The field of InputHandleIndex in RopSeekStream request</param>
        private void VerifyRopSeekStreamSuccessResponse(RopSeekStreamResponse ropSeekStreamResponse, byte inputHandleIndex)
        {
            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3344");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3344
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropSeekStreamResponse.RopId.GetType(),
                3344,
                @"[In RopSeekStream ROP Success Response Buffer]RopId (1 byte): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3346");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3346
            Site.CaptureRequirementIfAreEqual<byte>(
                (byte)RopId.RopSeekStream,
                ropSeekStreamResponse.RopId,
                3346,
                @"[In RopSeekStream ROP Success Response Buffer,RopId (1 byte)]For this operation[[RopSeekStream]], this field is set to 0x2E.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3347");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3347
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(byte),
                ropSeekStreamResponse.InputHandleIndex.GetType(),
                3347,
                @"[In RopSeekStream ROP Success Response Buffer]InputHandleIndex (1 byte): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3348");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3348
            Site.CaptureRequirementIfAreEqual<byte>(
                inputHandleIndex,
                ropSeekStreamResponse.InputHandleIndex,
                3348,
                @"[In RopSeekStream ROP Success Response Buffer,InputHandleIndex (1 byte)]This index MUST be set to the value specified in the InputHandleIndex field in the request.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3350");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3350
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(uint),
                ropSeekStreamResponse.ReturnValue.GetType(),
                3350,
                @"[In RopSeekStream ROP Success Response Buffer]ReturnValue (4 bytes): An unsigned integer.");

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R3352");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3352
            Site.CaptureRequirementIfAreEqual<uint>(
                SuccessReturnValue,
                ropSeekStreamResponse.ReturnValue,
                3352,
                @"[In RopSeekStream 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_R3353");

            // Verify MS-OXCROPS requirement: MS-OXCROPS_R3353
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(ulong),
                ropSeekStreamResponse.NewPosition.GetType(),
                3353,
                @"[In RopSeekStream ROP Success Response Buffer]NewPosition (8 bytes): An unsigned integer.");
        }