/// <summary> /// Create sample RuleData array to modify the rules associated with a folder. /// </summary> /// <returns>Return RuleData array to be used in RopModifyRules request.</returns> protected RuleData[] CreateSampleRuleDataArrayForAdd() { int propertyValuesCount = 4; PropertyValue[] propertyValues = new PropertyValue[propertyValuesCount]; for (int i = 0; i < propertyValuesCount; i++) { propertyValues[i] = new PropertyValue(); } // As specified in section 2.2.1.3.2 in [MS-OXORULE], // when adding a PRULE, the client MUST NOT // pass in PidTagRuleId, it MUST pass in PidTagRuleCondition, // PidTagRuleActions and PidTagRuleProvider. TaggedPropertyValue taggedPropertyValue = new TaggedPropertyValue(); PropertyTag tempPropertyTag = new PropertyTag { PropertyId = 0x6676, PropertyType = 0003 }; taggedPropertyValue.PropertyTag = tempPropertyTag; byte[] value3 = { 0x00, 0x00, 0x00, 0x0a }; taggedPropertyValue.Value = value3; propertyValues[3].Value = taggedPropertyValue.Serialize(); // PidTagRuleCondition taggedPropertyValue = new TaggedPropertyValue(); tempPropertyTag.PropertyId = 0x6679; tempPropertyTag.PropertyType = 0x00fd; taggedPropertyValue.PropertyTag = tempPropertyTag; byte[] value = { 0x03, 0x01, 0x00, 0x01, 0x00, 0x1f, 0x00, 0x37, 0x00, 0x1f, 0x00, 0x37, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x6a, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x20, 0x00, 0x58, 0x00, 0x00, 0x00 }; taggedPropertyValue.Value = value; propertyValues[1].Value = taggedPropertyValue.Serialize(); // PidTagRuleAction taggedPropertyValue = new TaggedPropertyValue(); tempPropertyTag.PropertyId = 0x6680; tempPropertyTag.PropertyType = 0x00fe; taggedPropertyValue.PropertyTag = tempPropertyTag; byte[] value1 = { 0x01, 0x00, 0x09, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; taggedPropertyValue.Value = value1; propertyValues[2].Value = taggedPropertyValue.Serialize(); // PidTagRuleProvider taggedPropertyValue = new TaggedPropertyValue(); tempPropertyTag.PropertyId = 0x6681; tempPropertyTag.PropertyType = 0x001f; taggedPropertyValue.PropertyTag = tempPropertyTag; byte[] value2 = Encoding.Unicode.GetBytes("RuleOrganizer\0"); taggedPropertyValue.Value = value2; propertyValues[0].Value = taggedPropertyValue.Serialize(); RuleData sampleRuleData = new RuleData { RuleDataFlags = 0x01, PropertyValueCount = (ushort)propertyValues.Length, PropertyValues = propertyValues }; RuleData[] sampleRuleDataArray = new RuleData[1]; sampleRuleDataArray[0] = sampleRuleData; return sampleRuleDataArray; }
/// <summary> /// Create Sample RuleData Array For Add. /// </summary> /// <returns>Return RuleData array</returns> private RuleData[] CreateSampleRuleDataArrayForAdd() { // Count of PropertyValues. int length = 4; TaggedPropertyValue[] propertyValues = new TaggedPropertyValue[length]; for (int i = 0; i < length; i++) { propertyValues[i] = new TaggedPropertyValue(); } TaggedPropertyValue taggedPropertyValue; // MS-OXORULE 2.2.1.3.2 // When adding a rule, the client MUST NOT pass in PidTagRuleId, it MUST pass in PidTagRuleCondition, // PidTagRuleActions and PidTagRuleProvider. // PidTagRuleSequence taggedPropertyValue = new TaggedPropertyValue { PropertyTag = { PropertyId = this.propertyDictionary[PropertyNames.PidTagRuleSequence].PropertyId, PropertyType = this.propertyDictionary[PropertyNames.PidTagRuleSequence].PropertyType } }; byte[] value3 = { 0x00, 0x00, 0x00, 0x0a }; taggedPropertyValue.Value = value3; propertyValues[3] = taggedPropertyValue; // PidTagRuleCondition taggedPropertyValue = new TaggedPropertyValue { PropertyTag = { PropertyId = this.propertyDictionary[PropertyNames.PidTagRuleCondition].PropertyId, PropertyType = this.propertyDictionary[PropertyNames.PidTagRuleCondition].PropertyType } }; byte[] value = { 0x03, 0x01, 0x00, 0x01, 0x00, 0x1f, 0x00, 0x37, 0x00, 0x1f, 0x00, 0x37, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x6a, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x20, 0x00, 0x58, 0x00, 0x00, 0x00 }; taggedPropertyValue.Value = value; propertyValues[1] = taggedPropertyValue; // PidTagRuleActions taggedPropertyValue = new TaggedPropertyValue { PropertyTag = { PropertyId = this.propertyDictionary[PropertyNames.PidTagRuleActions].PropertyId, PropertyType = this.propertyDictionary[PropertyNames.PidTagRuleActions].PropertyType } }; byte[] value1 = { 0x01, 0x00, 0x09, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; taggedPropertyValue.Value = value1; propertyValues[2] = taggedPropertyValue; // PidTagRuleProvider taggedPropertyValue = new TaggedPropertyValue { PropertyTag = { PropertyId = this.propertyDictionary[PropertyNames.PidTagRuleProvider].PropertyId, PropertyType = this.propertyDictionary[PropertyNames.PidTagRuleProvider].PropertyType } }; byte[] value2 = Encoding.Unicode.GetBytes("RuleOrganizerContoso\0"); taggedPropertyValue.Value = value2; propertyValues[0] = taggedPropertyValue; RuleData sampleRuleData = new RuleData { RuleDataFlags = (byte)RuleDataFlags.RowAdd, PropertyValueCount = (ushort)propertyValues.Length, PropertyValues = propertyValues }; RuleData[] sampleRuleDataArray = new RuleData[1]; sampleRuleDataArray[0] = sampleRuleData; return sampleRuleDataArray; }
/// <summary> /// Generate RuleData from ptf config base on different action Type. /// </summary> /// <param name="actionType">ActionType of each blocks, the sequence must be the same as the actionData array.</param> /// <param name="ruleSequence">Rule sequence in PidTagRuleSequence of the RuleData.</param> /// <param name="ruleState">Specifies value of PidTagRuleState of the RuleData.</param> /// <param name="actionData">The actionData array needed to construct the ActionBlock in RuleActions.</param> /// <param name="actionFlavor">The actionFlavor array of the rule ActionBlocks.</param> /// <param name="otherInfo"> /// An array of Other needed information of Actions. /// Index may be from 0-4 /// 0. Rule name /// 1. Rule provider /// 2. Rule user Flags /// 3. Rule provider data /// 4. Subject name of content restriction /// </param> /// <returns>A valid RuleData structure.</returns> public static RuleData GenerateValidRuleDataWithFlavor(ActionType[] actionType, int ruleSequence, RuleState ruleState, IActionData[] actionData, uint[] actionFlavor, RuleProperties otherInfo) { RuleData ruleData = new RuleData { RuleDataFlags = (byte)TestRuleDataType.ForAdd }; List<TaggedPropertyValue> propertyList = new List<TaggedPropertyValue>(); TaggedPropertyValue pidTagRuleSequence = new TaggedPropertyValue(); PropertyTag pidTagRuleSequencePropertyTag = new PropertyTag { PropertyId = (ushort)PropertyId.PidTagRuleSequence, PropertyType = (ushort)PropertyType.PtypInteger32 }; pidTagRuleSequence.PropertyTag = pidTagRuleSequencePropertyTag; pidTagRuleSequence.Value = BitConverter.GetBytes(ruleSequence); propertyList.Add(pidTagRuleSequence); TaggedPropertyValue pidTagRuleLevel = new TaggedPropertyValue(); PropertyTag pidTagRuleLevelPropertyTag = new PropertyTag { PropertyId = (ushort)PropertyId.PidTagRuleLevel, PropertyType = (ushort)PropertyType.PtypInteger32 }; pidTagRuleLevel.PropertyTag = pidTagRuleLevelPropertyTag; pidTagRuleLevel.Value = BitConverter.GetBytes(Constants.RuleLevel); propertyList.Add(pidTagRuleLevel); TaggedPropertyValue pidTagRuleState = new TaggedPropertyValue(); PropertyTag pidTagRuleStatePropertyTag = new PropertyTag { PropertyId = (ushort)PropertyId.PidTagRuleState, PropertyType = (ushort)PropertyType.PtypInteger32 }; pidTagRuleState.PropertyTag = pidTagRuleStatePropertyTag; pidTagRuleState.Value = BitConverter.GetBytes((uint)ruleState); propertyList.Add(pidTagRuleState); if (otherInfo.Name.Length > 0) { TaggedPropertyValue pidTagRuleName = new TaggedPropertyValue(); PropertyTag pidTagRuleNamePropertyTag = new PropertyTag { PropertyId = (ushort)PropertyId.PidTagRuleName, PropertyType = (ushort)PropertyType.PtypString }; pidTagRuleName.PropertyTag = pidTagRuleNamePropertyTag; pidTagRuleName.Value = Encoding.Unicode.GetBytes((string)otherInfo.Name + "\0"); propertyList.Add(pidTagRuleName); } if (otherInfo.Provider.Length > 0) { TaggedPropertyValue pidTagRuleProvider = new TaggedPropertyValue(); PropertyTag pidTagRuleProviderPropertyTag = new PropertyTag { PropertyId = (ushort)PropertyId.PidTagRuleProvider, PropertyType = (ushort)PropertyType.PtypString }; pidTagRuleProvider.PropertyTag = pidTagRuleProviderPropertyTag; pidTagRuleProvider.Value = Encoding.Unicode.GetBytes((string)otherInfo.Provider + "\0"); propertyList.Add(pidTagRuleProvider); } if (otherInfo.UserFlag.Length > 0) { TaggedPropertyValue pidTagRuleUserFlags = new TaggedPropertyValue(); PropertyTag pidTagRuleUserFlagsPropertyTag = new PropertyTag { PropertyId = (ushort)PropertyId.PidTagRuleUserFlags, PropertyType = (ushort)PropertyType.PtypInteger32 }; pidTagRuleUserFlags.PropertyTag = pidTagRuleUserFlagsPropertyTag; pidTagRuleUserFlags.Value = BitConverter.GetBytes(int.Parse(otherInfo.UserFlag)); propertyList.Add(pidTagRuleUserFlags); } if (otherInfo.ProviderData.Length > 0) { TaggedPropertyValue pidTagRuleProviderData = new TaggedPropertyValue(); PropertyTag pidTagRuleProviderDataPropertyTag = new PropertyTag { PropertyId = (ushort)PropertyId.PidTagRuleProviderData, PropertyType = (ushort)PropertyType.PtypBinary }; pidTagRuleProviderData.PropertyTag = pidTagRuleProviderDataPropertyTag; pidTagRuleProviderData.Value = Common.GetBytesFromBinaryHexString(otherInfo.ProviderData); pidTagRuleProviderData.Value = Common.AddInt16LengthBeforeBinaryArray(pidTagRuleProviderData.Value); propertyList.Add(pidTagRuleProviderData); } if (otherInfo.ConditionSubjectName.Length > 0) { AddRuleCondition(propertyList, otherInfo.ConditionSubjectName); uint[] defaultActionFlags = new uint[actionData.Length]; for (int i = 0; i < actionData.Length; i++) { defaultActionFlags[i] = Constants.RuleActionFlags; } AddRuleAction(propertyList, actionType, actionData, actionFlavor, defaultActionFlags); } ruleData.PropertyValues = propertyList.ToArray(); ruleData.PropertyValueCount = (ushort)propertyList.Count; return ruleData; }
/// <summary> /// Generate RuleData from ptf config base on different action Type. /// </summary> /// <param name="actionType">ActionType in a rule.</param> /// <param name="ruleDataType">The type of the rule data.</param> /// <param name="ruleSequence">Rule sequence in PidTagRuleSequence of the RuleData.</param> /// <param name="ruleState">Specifies value of PidTagRuleState of the RuleData.</param> /// <param name="actionData">The actionData needed to construct the RuleData.</param> /// <param name="otherInfo"> /// An array of Other needed information of Actions. /// Index may be from 0-4 /// 0. Rule name /// 1. Rule provider /// 2. Rule user Flags /// 3. Rule provider data /// 4. Subject name of content restriction /// </param> /// <param name="ruleId">A 64-bit unsigned integer represents the rule.</param> /// <returns>A valid RuleData structure.</returns> public static RuleData GenerateValidRuleData(ActionType actionType, TestRuleDataType ruleDataType, int ruleSequence, RuleState ruleState, IActionData actionData, RuleProperties otherInfo, ulong? ruleId) { RuleData ruleData = new RuleData { RuleDataFlags = (byte)ruleDataType }; List<TaggedPropertyValue> propertyList = new List<TaggedPropertyValue>(); if (ruleDataType == TestRuleDataType.ForModify || ruleDataType == TestRuleDataType.ForRemove) { TaggedPropertyValue pidTagRuleId = new TaggedPropertyValue(); PropertyTag pidTagRuleIdPropertyTag = new PropertyTag { PropertyId = (ushort)PropertyId.PidTagRuleId, PropertyType = (ushort)PropertyType.PtypInteger64 }; pidTagRuleId.PropertyTag = pidTagRuleIdPropertyTag; pidTagRuleId.Value = BitConverter.GetBytes((ulong)ruleId); propertyList.Add(pidTagRuleId); } if (ruleDataType != TestRuleDataType.ForRemove) { TaggedPropertyValue pidTagRuleSequence = new TaggedPropertyValue(); PropertyTag pidTagRuleSequencePropertyTag = new PropertyTag { PropertyId = (ushort)PropertyId.PidTagRuleSequence, PropertyType = (ushort)PropertyType.PtypInteger32 }; pidTagRuleSequence.PropertyTag = pidTagRuleSequencePropertyTag; pidTagRuleSequence.Value = BitConverter.GetBytes(ruleSequence); propertyList.Add(pidTagRuleSequence); TaggedPropertyValue pidTagRuleLevel = new TaggedPropertyValue(); PropertyTag pidTagRuleLevelPropertyTag = new PropertyTag { PropertyId = (ushort)PropertyId.PidTagRuleLevel, PropertyType = (ushort)PropertyType.PtypInteger32 }; pidTagRuleLevel.PropertyTag = pidTagRuleLevelPropertyTag; pidTagRuleLevel.Value = BitConverter.GetBytes(0); propertyList.Add(pidTagRuleLevel); TaggedPropertyValue pidTagRuleState = new TaggedPropertyValue(); PropertyTag pidTagRuleStatePropertyTag = new PropertyTag { PropertyId = (ushort)PropertyId.PidTagRuleState, PropertyType = (ushort)PropertyType.PtypInteger32 }; pidTagRuleState.PropertyTag = pidTagRuleStatePropertyTag; pidTagRuleState.Value = BitConverter.GetBytes((uint)ruleState); propertyList.Add(pidTagRuleState); if (otherInfo.Name.Length > 0) { TaggedPropertyValue pidTagRuleName = new TaggedPropertyValue(); PropertyTag pidTagRuleNamePropertyTag = new PropertyTag { PropertyId = (ushort)PropertyId.PidTagRuleName, PropertyType = (ushort)PropertyType.PtypString }; pidTagRuleName.PropertyTag = pidTagRuleNamePropertyTag; pidTagRuleName.Value = Encoding.Unicode.GetBytes((string)otherInfo.Name + "\0"); propertyList.Add(pidTagRuleName); } if (otherInfo.Provider.Length > 0) { TaggedPropertyValue pidTagRuleProvider = new TaggedPropertyValue(); PropertyTag pidTagRuleProviderPropertyTag = new PropertyTag { PropertyId = (ushort)PropertyId.PidTagRuleProvider, PropertyType = (ushort)PropertyType.PtypString }; pidTagRuleProvider.PropertyTag = pidTagRuleProviderPropertyTag; pidTagRuleProvider.Value = Encoding.Unicode.GetBytes((string)otherInfo.Provider + "\0"); propertyList.Add(pidTagRuleProvider); } if (otherInfo.UserFlag.Length > 0) { TaggedPropertyValue pidTagRuleUserFlags = new TaggedPropertyValue(); PropertyTag pidTagRuleUserFlagsPropertyTag = new PropertyTag { PropertyId = (ushort)PropertyId.PidTagRuleUserFlags, PropertyType = (ushort)PropertyType.PtypInteger32 }; pidTagRuleUserFlags.PropertyTag = pidTagRuleUserFlagsPropertyTag; pidTagRuleUserFlags.Value = BitConverter.GetBytes(int.Parse(otherInfo.UserFlag)); propertyList.Add(pidTagRuleUserFlags); } if (otherInfo.ProviderData.Length > 0) { TaggedPropertyValue pidTagRuleProviderData = new TaggedPropertyValue(); PropertyTag pidTagRuleProviderDataPropertyTag = new PropertyTag { PropertyId = (ushort)PropertyId.PidTagRuleProviderData, PropertyType = (ushort)PropertyType.PtypBinary }; pidTagRuleProviderData.PropertyTag = pidTagRuleProviderDataPropertyTag; pidTagRuleProviderData.Value = Common.GetBytesFromBinaryHexString(otherInfo.ProviderData); pidTagRuleProviderData.Value = Common.AddInt16LengthBeforeBinaryArray(pidTagRuleProviderData.Value); propertyList.Add(pidTagRuleProviderData); } if (otherInfo.ConditionSubjectName.Length > 0) { AddRuleCondition(propertyList, otherInfo.ConditionSubjectName); AddRuleAction(propertyList, actionType, actionData, Constants.CommonActionFlavor, Constants.RuleActionFlags); } } ruleData.PropertyValues = propertyList.ToArray(); ruleData.PropertyValueCount = (ushort)propertyList.Count; return ruleData; }
/// <summary> /// Verify the RopGetProperties in RuleData Structure. /// </summary> /// <param name="ruleData">RuleData Structure.</param> private void VerifyPropertiesInRuleData(RuleData ruleData) { // RuleData contains a list of properties. for (int i = 0; i < ruleData.PropertyValues.Length; i++) { // propertyId indicates the Id of a property. ushort propertyId = (ruleData.PropertyValues[i] as TaggedPropertyValue).PropertyTag.PropertyId; // propertyType indicates the Type of a property. ushort propertyType = (ruleData.PropertyValues[i] as TaggedPropertyValue).PropertyTag.PropertyType; // propertyValue indicates the value of a property. byte[] propertyValue = (ruleData.PropertyValues[i] as TaggedPropertyValue).Value; switch (propertyId) { // If propertyId is 0x6679, it means the property is PidTagRuleCondition. case 0x6679: { RuleCondition ruleCondition = new RuleCondition(); ruleCondition.Deserialize(propertyValue); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2705, the value of the propertyType is {0}.", propertyType); // Verify MS-OXCDATA requirement: MS-OXCDATA_R2705. // Stack De-serialize this structure as this requirement, if ruleCondition is not null, // "a byte array representing one or more Restriction structures" can be covered. bool isVerifyR2705 = ruleCondition != null && propertyType == 0x00FD; Site.CaptureRequirementIfIsTrue( isVerifyR2705, "MS-OXCDATA", 2705, @"[In Property Value Types] PtypRestriction (PT_SRESTRICT) is that variable size; a byte array representing one or more Restriction structures as specified in section 2.12. with Property Type Value 0x00FD,%xFD.00."); } break; // If propertyId is 0x6680, it means the property is PidTagRuleActions. case 0x6680: { RuleAction ruleAction = new RuleAction(); ruleAction.Deserialize(propertyValue); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2706, the value of the propertyType is {0}.", propertyType); // Verify MS-OXCDATA requirement: MS-OXCDATA_R2706. // Stack De-serialize this structure as this requirement, if ruleAction is not null, // "a 16-bit COUNT of actions (not bytes) followed by that many Rule Action structures" can be covered. bool isVerifyR2706 = ruleAction != null && propertyType == 0x00FE; Site.CaptureRequirementIfIsTrue( isVerifyR2706, "MS-OXCDATA", 2706, @"[In Property Value Types] PtypRuleAction (PT_ACTIONS) is that variable size; a 16-bit COUNT field followed by that many rule (2) action (2) structures, as specified in [MS-OXORULE] section 2.2.5. with Property Type Value 0x00FE,%xFE.00."); } break; // If propertyId is 0x6674, it means the property is PidTagRuleId. case 0x6674: { // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2699", "The length({0}) of the propertyValue should be 8 and the value of the propertyType({1}) should be 0x0014.", propertyValue.Length, propertyType); // Verify MS-OXCDATA requirement: MS-OXCDATA_R2699. bool isVerifyR2699 = propertyValue.Length == 8 && propertyType == 0x0014; Site.CaptureRequirementIfIsTrue( isVerifyR2699, "MS-OXCDATA", 2699, @"[In Property Data Types] PtypInteger64 (PT_LONGLONG, PT_I8, i8, ui8) is that 8 bytes; a 64-bit integer [MS-DTYP]: LONGLONG with Property Type Value 0x0014,%x14.00."); } break; } } }
/// <summary> /// Clear all rules of the inbox folder. /// </summary> protected void ClearAllRules() { // Call RopGetRulesTable with valid TableFlags. RopGetRulesTableResponse ropGetRulesTableResponse; uint ruleTableHandle = this.OxoruleAdapter.RopGetRulesTable(this.InboxFolderHandle, TableFlags.Normal, out ropGetRulesTableResponse); if (ropGetRulesTableResponse.ReturnValue == 0) { // Get rule ID if rules exist. PropertyTag ruleIDTag = new PropertyTag { PropertyId = (ushort)PropertyId.PidTagRuleId, PropertyType = (ushort)PropertyType.PtypInteger64 }; RopQueryRowsResponse queryRowsResponse = this.OxoruleAdapter.QueryPropertiesInTable(ruleTableHandle, new PropertyTag[1] { ruleIDTag }); Site.Assert.AreEqual<uint>(0, queryRowsResponse.ReturnValue, "Retrieving rows from the rule table should succeed."); // Delete all rules if exist. if (queryRowsResponse.RowCount > 0) { RuleData[] ruleDatas = new RuleData[queryRowsResponse.RowCount]; for (int i = 0; i < queryRowsResponse.RowCount; i++) { ulong ruleId = BitConverter.ToUInt64(queryRowsResponse.RowData.PropertyRows[i].PropertyValues[0].Value, 0); RuleProperties ruleProperties = new RuleProperties(); ruleDatas[i] = AdapterHelper.GenerateValidRuleData(ActionType.OP_MARK_AS_READ, TestRuleDataType.ForRemove, 0, RuleState.ST_ENABLED, null, ruleProperties, ruleId); } RopModifyRulesResponse modifyRulesResponse = this.OxoruleAdapter.RopModifyRules(this.InboxFolderHandle, ModifyRuleFlag.Modify_OnExisting, ruleDatas); Site.Assert.AreEqual<uint>(0, modifyRulesResponse.ReturnValue, "Deleting rule should be success"); // Wait the rule to be deleted Thread.Sleep(this.WaitForTheRuleToTakeEffect); } } }
/// <summary> /// This ROP modifies the rules associated with a folder. /// </summary> /// <param name="objHandle">This index refers to the handle in the Server object handle table used as input for this operation.</param> /// <param name="modifyRulesFlags">The possible values are specified in [MS-OXORULE]. These Flags specify behavior of this operation.</param> /// <param name="ruleData">An array of RuleData structures, each of which specifies details about a standard rule.</param> /// <returns>Structure of RopModifyRulesResponse.</returns> public RopModifyRulesResponse RopModifyRules(uint objHandle, ModifyRuleFlag modifyRulesFlags, RuleData[] ruleData) { this.rawData = null; this.response = null; this.responseSOHs = null; RopModifyRulesRequest modifyRulesRequest; RopModifyRulesResponse modifyRulesResponse; modifyRulesRequest.RopId = 0x41; modifyRulesRequest.LogonId = 0x0; modifyRulesRequest.InputHandleIndex = 0x00; modifyRulesRequest.ModifyRulesFlags = (byte)modifyRulesFlags; modifyRulesRequest.RulesCount = 0; if (ruleData != null) { modifyRulesRequest.RulesCount = (ushort)ruleData.Length; } modifyRulesRequest.RulesData = ruleData; this.responseSOHs = this.DoRPCCall(modifyRulesRequest, objHandle, ref this.response, ref this.rawData); modifyRulesResponse = (RopModifyRulesResponse)this.response; // Verify the response of RopModifyRules this.VerifyRopModifyRules(modifyRulesResponse, modifyRulesRequest); // modifyRulesResponse.ReturnValue equals 0 means that RopModifyRules is successful. // So the ruleDatas in modifyRulesRequest is correct. if (modifyRulesResponse.ReturnValue == 0) { this.VerifyPropertiesInRuleData(ruleData[0]); } return modifyRulesResponse; }