The Save Session Info PDU is used by the server to transmit session and user logon information back to the client after the user has logged on.
file:///C:/ts_dev/TestSuites/MS-RDPBCGR/TestSuite/Src/TD/latest_XMLS_16may/RDPBCGR/ _rfc_ms-rdpbcgr2_1_8_3_1.xml
Наследование: RdpbcgrServerPdu
        /// <summary>
        /// Decode Save Session Info PDU
        /// </summary>
        /// <param name="data">data to be parsed</param>
        /// <param name="decryptedUserData">decrypted user data to be parsed</param>
        /// <param name="type">security header type</param>
        /// <returns>decoded Save Session Info PDU</returns>
        public StackPacket DecodeSaveSessionInfoPDU(
            byte[] data,
            byte[] decryptedUserData,
            SecurityHeaderType type)
        {
            Server_Save_Session_Info_Pdu pdu = new Server_Save_Session_Info_Pdu();

            // data index
            int dataIndex = 0;

            // SaveSessionInfoPDU: commonHeader
            pdu.commonHeader = ParseMcsCommonHeader(data, ref dataIndex, type);

            // user data index
            int userDataIndex = 0;

            // SaveSessionInfoPDU: saveSessionInfoPduData
            pdu.saveSessionInfoPduData = ParseTsSaveSessionInfoPduData(decryptedUserData, ref userDataIndex);

            // Check if data length exceeded expectation
            VerifyDataLength(decryptedUserData.Length, userDataIndex, ConstValue.ERROR_MESSAGE_DATA_LENGTH_EXCEEDED);
            return pdu;
        }
Пример #2
0
        /// <summary>
        /// Create an instance of the class that is identical to the current PDU. 
        /// </summary>
        /// <returns>The new instance.</returns>
        public override StackPacket Clone()
        {
            Server_Save_Session_Info_Pdu cloneServerSaveSessionInfo = new Server_Save_Session_Info_Pdu();

            cloneServerSaveSessionInfo.commonHeader = commonHeader.Clone();
            cloneServerSaveSessionInfo.saveSessionInfoPduData = saveSessionInfoPduData;

            if (cloneServerSaveSessionInfo.saveSessionInfoPduData.infoData.GetType()
                == typeof(TS_LOGON_INFO_VERSION_2))
            {
                TS_LOGON_INFO_VERSION_2 version2 =
                    (TS_LOGON_INFO_VERSION_2)cloneServerSaveSessionInfo.saveSessionInfoPduData.infoData;
                version2.Pad = RdpbcgrUtility.CloneByteArray(version2.Pad);
                cloneServerSaveSessionInfo.saveSessionInfoPduData.infoData = version2;
            }
            else if (cloneServerSaveSessionInfo.saveSessionInfoPduData.infoData.GetType()
                == typeof(TS_PLAIN_NOTIFY))
            {
                TS_PLAIN_NOTIFY notify = (TS_PLAIN_NOTIFY)cloneServerSaveSessionInfo.saveSessionInfoPduData.infoData;
                notify.Pad = RdpbcgrUtility.CloneByteArray(notify.Pad);
                cloneServerSaveSessionInfo.saveSessionInfoPduData.infoData = notify;
            }
            else if (cloneServerSaveSessionInfo.saveSessionInfoPduData.infoData.GetType()
                == typeof(TS_LOGON_INFO_EXTENDED))
            {
                TS_LOGON_INFO_EXTENDED extended =
                    (TS_LOGON_INFO_EXTENDED)cloneServerSaveSessionInfo.saveSessionInfoPduData.infoData;
                extended.Pad = RdpbcgrUtility.CloneByteArray(extended.Pad);

                TS_LOGON_INFO_EXTENDED srcInfo = (TS_LOGON_INFO_EXTENDED)saveSessionInfoPduData.infoData;
                if (srcInfo.LogonFields != null)
                {
                    TS_LOGON_INFO_FIELD[] logonFields = new TS_LOGON_INFO_FIELD[srcInfo.LogonFields.Length];
                    for (int i = 0; i < srcInfo.LogonFields.Length; ++i)
                    {
                        logonFields[i] = srcInfo.LogonFields[i];
                        if (srcInfo.LogonFields[i].FieldData != null)
                        {
                            if (srcInfo.LogonFields[i].FieldData.GetType() == typeof(TS_LOGON_ERRORS_INFO))
                            {
                                logonFields[i].FieldData = new TS_LOGON_ERRORS_INFO();
                                ((TS_LOGON_ERRORS_INFO)logonFields[i].FieldData).ErrorNotificationData =
                                    ((TS_LOGON_ERRORS_INFO)srcInfo.LogonFields[i].FieldData).ErrorNotificationData;
                                ((TS_LOGON_ERRORS_INFO)logonFields[i].FieldData).ErrorNotificationType =
                                    ((TS_LOGON_ERRORS_INFO)srcInfo.LogonFields[i].FieldData).ErrorNotificationType;
                            }
                            else if (srcInfo.LogonFields[i].FieldData.GetType() == typeof(ARC_SC_PRIVATE_PACKET))
                            {
                                logonFields[i].FieldData = new ARC_SC_PRIVATE_PACKET();
                                ((ARC_SC_PRIVATE_PACKET)logonFields[i].FieldData).cbLen =
                                    ((ARC_SC_PRIVATE_PACKET)srcInfo.LogonFields[i].FieldData).cbLen;
                                ((ARC_SC_PRIVATE_PACKET)logonFields[i].FieldData).LogonId =
                                    ((ARC_SC_PRIVATE_PACKET)srcInfo.LogonFields[i].FieldData).LogonId;
                                ((ARC_SC_PRIVATE_PACKET)logonFields[i].FieldData).Version =
                                    ((ARC_SC_PRIVATE_PACKET)srcInfo.LogonFields[i].FieldData).Version;
                                ((ARC_SC_PRIVATE_PACKET)logonFields[i].FieldData).ArcRandomBits =
                                    RdpbcgrUtility.CloneByteArray(
                                    ((ARC_SC_PRIVATE_PACKET)srcInfo.LogonFields[i].FieldData).ArcRandomBits);
                            }
                        }
                    }

                    extended.LogonFields = logonFields;
                    cloneServerSaveSessionInfo.saveSessionInfoPduData.infoData = extended;
                }
            }

            return cloneServerSaveSessionInfo;
        }