/// <summary> /// 2.2.7.1.6 /// </summary> /// <param name="input"></param> public void VerifyStructure(TS_INPUT_CAPABILITYSET input) { site.CaptureRequirementIfAreEqual<capabilitySetType_Values>(capabilitySetType_Values.CAPSTYPE_INPUT, input.capabilitySetType, 1298, @"In TS_INPUT_CAPABILITY_SET structure, the capabilitySetType field MUST be set to " + @"CAPSTYPE_INPUT (13)."); bool isR1313Satisfied = input.keyboardType == TS_INPUT_CAPABILITYSET_keyboardType_Values.V1 || input.keyboardType == TS_INPUT_CAPABILITYSET_keyboardType_Values.V2 || input.keyboardType == TS_INPUT_CAPABILITYSET_keyboardType_Values.V3 || input.keyboardType == TS_INPUT_CAPABILITYSET_keyboardType_Values.V4 || input.keyboardType == TS_INPUT_CAPABILITYSET_keyboardType_Values.V5 || input.keyboardType == TS_INPUT_CAPABILITYSET_keyboardType_Values.V6 || input.keyboardType == TS_INPUT_CAPABILITYSET_keyboardType_Values.V7 || input.keyboardType == TS_INPUT_CAPABILITYSET_keyboardType_Values.None; site.CaptureRequirementIfIsTrue(isR1313Satisfied, 1313, @"In TS_INPUT_CAPABILITY_SET structure, the keyboardType field can take the values 1,2,3,4,5,6,7,0"); String imeFileName = input.imeFileName; Console.WriteLine("RS1328, imeFileName= " + imeFileName); Console.WriteLine("RS1328, imeFileName.Length = " + imeFileName.Length.ToString()); //<?> should check is Unicode characters? //site.CaptureRequirementIfIsTrue(input.imeFileName.Length <= 32, 1328, // @"In TS_INPUT_CAPABILITY_SET structure, the imeFileNamefield contains up to 31 Unicode characters plus a null terminator."); }
/// <summary> /// Create a TS_INPUT_CAPABILITYSET type Capability, 2.2.7.1.6 /// Problem: not implement client-end parameters, and we can modify this func in the future /// </summary> /// <param name="scanCodes">Indicates support for using scancodes in the Keyboard Event notifications /// (see sections 2.2.8.1.1.3.1.1.1 and 2.2.8.1.2.2.1).</param> /// <param name="mouseX">Indicates support for Extended Mouse Event notifications (see sections 2.2.8.1.1.3.1.1.4 /// and 2.2.8.1.2.2.4).</param> /// <param name="fpInput">Advertised by RDP 5.0 and 5.1 servers. RDP 5.2, 6.0, 6.1, and 7.0 servers advertise the /// INPUT_FLAG_FASTPATH_INPUT2 flag to indicate support for fast-path input.</param> /// <param name="unicode">Indicates support for Unicode Keyboard Event notifications (see sections 2.2.8.1.1.3.1.1.2 /// and 2.2.8.1.2.2.2).</param> /// <param name="fpInput2">Advertised by RDP 5.2, 6.0, 6.1, and 7.0 servers. Clients that do not support /// this flag will not be able to use fast-path input when connecting to RDP 5.2, 6.0, 6.1, and 7.0 servers.</param> /// <returns>TS_INPUT_CAPABILITYSET type Capability</returns> public static TS_INPUT_CAPABILITYSET CreateInputCapSet(bool scanCodes, bool mouseX, bool fpInput, bool unicode, bool fpInput2) { TS_INPUT_CAPABILITYSET inputCapabilitySet = new TS_INPUT_CAPABILITYSET(); inputCapabilitySet.capabilitySetType = capabilitySetType_Values.CAPSTYPE_INPUT; if (scanCodes) inputCapabilitySet.inputFlags |= inputFlags_Values.INPUT_FLAG_SCANCODES; if (mouseX) inputCapabilitySet.inputFlags |= inputFlags_Values.INPUT_FLAG_MOUSEX; if (fpInput) inputCapabilitySet.inputFlags |= inputFlags_Values.INPUT_FLAG_FASTPATH_INPUT; if (unicode) inputCapabilitySet.inputFlags |= inputFlags_Values.INPUT_FLAG_UNICODE; if (fpInput2) inputCapabilitySet.inputFlags |= inputFlags_Values.INPUT_FLAG_FASTPATH_INPUT2; inputCapabilitySet.pad2octetsA = 0; //Only set by Client inputCapabilitySet.keyboardLayout = 0; //Only set by Client inputCapabilitySet.keyboardType = TS_INPUT_CAPABILITYSET_keyboardType_Values.None; //Only set by Client inputCapabilitySet.keyboardSubType = 0; //Only set by Client inputCapabilitySet.keyboardFunctionKey = 0; //Only set by Client inputCapabilitySet.imeFileName = "00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" + "00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" + "00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-" + "00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00"; inputCapabilitySet.lengthCapability = (ushort)(24 + 64); // the other fields(except imeFileName field) totoal length is 24 return inputCapabilitySet; }
/// <summary> /// Parse TS_INPUT_CAPABILITYSET /// </summary> /// <param name="data">data to be parsed</param> /// <returns>TS_INPUT_CAPABILITYSET</returns> private TS_INPUT_CAPABILITYSET ParseCapsTypeInput(byte[] data) { int currentIndex = 0; TS_INPUT_CAPABILITYSET set = new TS_INPUT_CAPABILITYSET(); // TS_INPUT_CAPABILITYSET: capabilitySetType set.capabilitySetType = (capabilitySetType_Values)ParseUInt16(data, ref currentIndex, false); // TS_INPUT_CAPABILITYSET: lengthCapability set.lengthCapability = ParseUInt16(data, ref currentIndex, false); // TS_INPUT_CAPABILITYSET: inputFlags set.inputFlags = (inputFlags_Values)ParseUInt16(data, ref currentIndex, false); // TS_INPUT_CAPABILITYSET: pad2octetsA set.pad2octetsA = ParseUInt16(data, ref currentIndex, false); // TS_INPUT_CAPABILITYSET: keyboardLayout set.keyboardLayout = ParseUInt32(data, ref currentIndex, false); // TS_INPUT_CAPABILITYSET: keyboardType set.keyboardType = (TS_INPUT_CAPABILITYSET_keyboardType_Values)ParseUInt32(data, ref currentIndex, false); // TS_INPUT_CAPABILITYSET: keyboardSubType set.keyboardSubType = ParseUInt32(data, ref currentIndex, false); // TS_INPUT_CAPABILITYSET: keyboardFunctionKey set.keyboardFunctionKey = ParseUInt32(data, ref currentIndex, false); // TS_INPUT_CAPABILITYSET: imeFileName byte[] imeFileName = GetBytes(data, ref currentIndex, ConstValue.TS_INPUT_CAPABILITY_SET_IME_FILE_NAME_LENGTH); set.imeFileName = BitConverter.ToString(imeFileName); // Check if data length is consistent with the decoded struct length VerifyDataLength(data.Length, currentIndex, ConstValue.ERROR_MESSAGE_DATA_LENGTH_INCONSISTENT); return set; }