/// <summary>
        /// It is used to test the Reserved fields in the rgbAuxIn on method EcDoRpcExt2
        /// </summary>
        /// <param name="rgbAuxInEnum">Enum of the blocks sent in the rgbAuxIn on method EcDoRpcExt2</param>
        /// <param name="payload">A byte array contains an auxiliary payload buffer.</param>
        /// <returns>The return value of the EcDoRpcExt2 method</returns>
        private uint SendAuxiliaryPayloadBufferInEcDoRpcExt2(RgbAuxInEnum rgbAuxInEnum, byte[] payload)
        {
            #region Call EcDoConnectEx to establish a new Session Context with the server.
            uint returnValueOfDisconnect = 0;
            byte[] sessionInfo = AdapterHelper.Compose_AUX_PERF_SESSIONINFO(ReserveDefault);
            this.rgbAuxIn = AdapterHelper.ComposeRgbAuxIn(RgbAuxInEnum.AUX_PERF_SESSIONINFO, sessionInfo);

            this.pcbAuxOut = ConstValues.ValidpcbAuxOut;
            this.returnValue = this.oxcrpcAdapter.EcDoConnectEx(
                ref this.pcxh,
                TestSuiteBase.UlIcxrLinkForNoSessionLink,
                ref this.pulTimeStamp,
                this.rgbAuxIn,
                this.userDN,
                ref this.pcbAuxOut,
                this.rgwClientVersion,
                out this.rgwBestVersion,
                out this.picxr);
            Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoConnectEx should succeed and send CXH to EcDoRpcExt2. '0' is expected to be returned. The returned value is {0}.", this.returnValue);
            #endregion

            #region Call EcDoRpcExt2 to pass generic remote operation (ROP) commands to the server.
            this.rgbAuxIn = AdapterHelper.ComposeRgbAuxIn(rgbAuxInEnum, payload);

            // Parameter inObjHandle is no use for RopLogon command, so set it to unUsedInfo
            this.rgbIn = AdapterHelper.ComposeRgbIn(ROPCommandType.RopLogon, this.unusedInfo, this.userPrivilege);
            this.pcbOut = ConstValues.ValidpcbOut;
            this.pcbAuxOut = ConstValues.ValidpcbAuxOut;

            this.returnValue = this.oxcrpcAdapter.EcDoRpcExt2(
                ref this.pcxh,
                PulFlags.NoCompression | PulFlags.NoXorMagic,
                this.rgbIn,
                ref this.pcbOut,
                this.rgbAuxIn,
                ref this.pcbAuxOut,
                out this.response,
                ref this.responseSOHTable);

            Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoRpcExt2 should succeed for test of the Reserved fields in the rgbAuxIn. '0' is expected to be returned. The returned value is {0}.", this.returnValue);
            #endregion

            #region Call EcDoDisconnect to close a Session Context with the server
            returnValueOfDisconnect = this.oxcrpcAdapter.EcDoDisconnect(ref this.pcxh);
            Site.Assert.AreEqual<uint>(0, returnValueOfDisconnect, "EcDoDisconnect should succeed and '0' is expected to be returned. The returned value is {0}.", this.returnValue);
            #endregion
            return this.returnValue;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Composes rgbAuxIn buffer
        /// </summary>
        /// <param name="rgbAuxIn">Enum value of rgbAuxIn</param>
        /// <param name="rgbAuxInPayload">The payload of rgbAuxIn buffer.</param>
        /// <returns>Returns a buffer composed according to the parameters</returns>
        public static byte[] ComposeRgbAuxIn(RgbAuxInEnum rgbAuxIn, byte[] rgbAuxInPayload)
        {
            byte         version;
            byte         type;
            const string ErrorMessage = "This input structure name is not a valid AUX structure type";

            // Version set to 0x01 means the Version field of AUX_HEADER is AUX_VERSION_1
            // Version set to 0x02 means the Version field of AUX_HEADER is AUX_VERSION_2
            switch (rgbAuxIn)
            {
            case RgbAuxInEnum.AUX_PERF_SESSIONINFO:
                version = (byte)AuxVersions.AUX_VERSION_1;
                type    = (byte)AuxTypes.AUX_TYPE_PERF_SESSIONINFO;
                break;

            case RgbAuxInEnum.AUX_PERF_SESSIONINFO_V2:
                version = (byte)AuxVersions.AUX_VERSION_2;
                type    = (byte)AuxTypes.AUX_TYPE_PERF_SESSIONINFO;
                break;

            case RgbAuxInEnum.AUX_PERF_CLIENTINFO:
                version = (byte)AuxVersions.AUX_VERSION_1;
                type    = (byte)AuxTypes.AUX_TYPE_PERF_CLIENTINFO;
                break;

            case RgbAuxInEnum.AUX_PERF_PROCESSINFO:
                version = (byte)AuxVersions.AUX_VERSION_2;
                type    = (byte)AuxTypes.AUX_TYPE_PERF_PROCESSINFO;
                break;

            case RgbAuxInEnum.AUX_PERF_DEFMDB_SUCCESS:
                version = (byte)AuxVersions.AUX_VERSION_1;
                type    = (byte)AuxTypes.AUX_TYPE_PERF_BG_DEFMDB_SUCCESS;
                break;

            case RgbAuxInEnum.AUX_PERF_DEFGC_SUCCESS:
                version = (byte)AuxVersions.AUX_VERSION_1;
                type    = (byte)AuxTypes.AUX_TYPE_PERF_BG_DEFGC_SUCCESS;
                break;

            case RgbAuxInEnum.AUX_PERF_MDB_SUCCESS_V2:
                version = (byte)AuxVersions.AUX_VERSION_2;
                type    = (byte)AuxTypes.AUX_TYPE_PERF_MDB_SUCCESS;
                break;

            case RgbAuxInEnum.AUX_PERF_GC_SUCCESS:
                version = (byte)AuxVersions.AUX_VERSION_1;
                type    = (byte)AuxTypes.AUX_TYPE_PERF_BG_GC_SUCCESS;
                break;

            case RgbAuxInEnum.AUX_PERF_GC_SUCCESS_V2:
                version = (byte)AuxVersions.AUX_VERSION_2;
                type    = (byte)AuxTypes.AUX_TYPE_PERF_BG_GC_SUCCESS;
                break;

            case RgbAuxInEnum.AUX_PERF_FAILURE:
                version = (byte)AuxVersions.AUX_VERSION_1;
                type    = (byte)AuxTypes.AUX_TYPE_PERF_BG_FAILURE;
                break;

            case RgbAuxInEnum.AUX_PERF_FAILURE_V2:
                version = (byte)AuxVersions.AUX_VERSION_2;
                type    = (byte)AuxTypes.AUX_TYPE_PERF_BG_FAILURE;
                break;

            case RgbAuxInEnum.AUX_PERF_ACCOUNTINFO:
                version = (byte)AuxVersions.AUX_VERSION_1;
                type    = (byte)AuxTypes.AUX_TYPE_PERF_ACCOUNTINFO;
                break;

            case RgbAuxInEnum.AUX_CLIENT_CONNECTION_INFO:
                version = (byte)AuxVersions.AUX_VERSION_1;
                type    = (byte)AuxTypes.AUX_CLIENT_CONNECTION_INFO;
                break;

            default:
                throw new NotImplementedException(ErrorMessage);
            }

            RPC_HEADER_EXT rpcHeaderExt = new RPC_HEADER_EXT
            {
                Version = 0x0000,                                                          // This value MUST be set to 0x0000.
                Flags   = (ushort)RpcHeaderExtFlags.Last,                                  // No Compression and no obfuscation
                Size    = (ushort)(rgbAuxInPayload.Length + ConstValues.AuxHeaderByteSize) // The total length of the payload data that follows the RPC_HEADER_EXT structure.
            };

            // The length of the payload data after it has been uncompressed.
            rpcHeaderExt.SizeActual = rpcHeaderExt.Size;

            // The length of AuxHeader is the length of AUX_HEADER structure plus the length of any additional payload data.
            AUX_HEADER auxHeader = new AUX_HEADER
            {
                Size    = (ushort)(rgbAuxInPayload.Length + ConstValues.AuxHeaderByteSize),
                Version = version,
                Type    = type
            };
            int returnSize = rgbAuxInPayload.Length + Marshal.SizeOf(rpcHeaderExt) + Marshal.SizeOf(auxHeader);

            byte[] returnByte = new byte[returnSize];

            // RgbAuxIn serialization
            // Serializes the RPC_HEADER_EXT
            int index = 0;

            Array.Copy(BitConverter.GetBytes(rpcHeaderExt.Version), 0, returnByte, index, sizeof(short));
            index += sizeof(short);
            Array.Copy(BitConverter.GetBytes(rpcHeaderExt.Flags), 0, returnByte, index, sizeof(short));
            index += sizeof(short);
            Array.Copy(BitConverter.GetBytes(rpcHeaderExt.Size), 0, returnByte, index, sizeof(short));
            index += sizeof(short);
            Array.Copy(BitConverter.GetBytes(rpcHeaderExt.SizeActual), 0, returnByte, index, sizeof(short));
            index += sizeof(short);

            // Serializes the AUX_HEADER
            Array.Copy(BitConverter.GetBytes(auxHeader.Size), 0, returnByte, index, sizeof(ushort));
            index            += sizeof(ushort);
            returnByte[index] = auxHeader.Version;
            index++;
            returnByte[index] = auxHeader.Type;
            index++;

            Array.Copy(rgbAuxInPayload, 0, returnByte, index, rgbAuxInPayload.Length);

            return(returnByte);
        }
        /// <summary>
        /// It is used to test the reserved fields in the rgbAuxIn on method EcDoConnectEx.
        /// </summary>
        /// <param name="rgbAuxInEnum">Enum of the blocks sent in the rgbAuxIn on method EcDoConnectEx</param>
        /// <param name="payload">A byte array contains an auxiliary payload buffer.</param>
        /// <returns>The return value of the EcDoConnectEx method</returns>
        private uint SendAuxiliaryPayloadBufferInEcDoConnectEx(RgbAuxInEnum rgbAuxInEnum, byte[] payload)
        {
            uint returnValueOfDisconnect = 0;
            this.rgbAuxIn = AdapterHelper.ComposeRgbAuxIn(rgbAuxInEnum, payload);
            this.pcbAuxOut = ConstValues.ValidpcbAuxOut;
            this.returnValue = this.oxcrpcAdapter.EcDoConnectEx(
                ref this.pcxh,
                TestSuiteBase.UlIcxrLinkForNoSessionLink,
                ref this.pulTimeStamp,
                this.rgbAuxIn,
                this.userDN,
                ref this.pcbAuxOut,
                this.rgwClientVersion,
                out this.rgwBestVersion,
                out this.picxr);
            Site.Assert.AreEqual<uint>(0, this.returnValue, "EcDoConnectEx should succeed for test of reserved fields and '0' is expected to be returned. The returned value is {0}.", this.returnValue);

            returnValueOfDisconnect = this.oxcrpcAdapter.EcDoDisconnect(ref this.pcxh);
            Site.Assert.AreEqual<uint>(0, returnValueOfDisconnect, "EcDoDisconnect should succeed and '0' is expected to be returned. The returned value is {0}.", returnValueOfDisconnect);
            return this.returnValue;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Composes rgbAuxIn buffer
        /// </summary>
        /// <param name="rgbAuxIn">Enum value of rgbAuxIn</param>
        /// <param name="rgbAuxInPayload">The payload of rgbAuxIn buffer.</param>
        /// <returns>Returns a buffer composed according to the parameters</returns>
        public static byte[] ComposeRgbAuxIn(RgbAuxInEnum rgbAuxIn, byte[] rgbAuxInPayload)
        {
            byte version;
            byte type;
            const string ErrorMessage = "This input structure name is not a valid AUX structure type";

            // Version set to 0x01 means the Version field of AUX_HEADER is AUX_VERSION_1
            // Version set to 0x02 means the Version field of AUX_HEADER is AUX_VERSION_2
            switch (rgbAuxIn)
            {
                case RgbAuxInEnum.AUX_PERF_SESSIONINFO:
                     version = (byte)AuxVersions.AUX_VERSION_1;
                    type = (byte)AuxTypes.AUX_TYPE_PERF_SESSIONINFO;
                    break;
                case RgbAuxInEnum.AUX_PERF_SESSIONINFO_V2:
                    version = (byte)AuxVersions.AUX_VERSION_2;
                    type = (byte)AuxTypes.AUX_TYPE_PERF_SESSIONINFO;
                    break;
                case RgbAuxInEnum.AUX_PERF_CLIENTINFO:
                    version = (byte)AuxVersions.AUX_VERSION_1;
                    type = (byte)AuxTypes.AUX_TYPE_PERF_CLIENTINFO;
                    break;
                case RgbAuxInEnum.AUX_PERF_PROCESSINFO:
                    version = (byte)AuxVersions.AUX_VERSION_2;
                    type = (byte)AuxTypes.AUX_TYPE_PERF_PROCESSINFO;
                    break;
                case RgbAuxInEnum.AUX_PERF_DEFMDB_SUCCESS:
                    version = (byte)AuxVersions.AUX_VERSION_1;
                    type = (byte)AuxTypes.AUX_TYPE_PERF_BG_DEFMDB_SUCCESS;
                    break;
                case RgbAuxInEnum.AUX_PERF_DEFGC_SUCCESS:
                    version = (byte)AuxVersions.AUX_VERSION_1;
                    type = (byte)AuxTypes.AUX_TYPE_PERF_BG_DEFGC_SUCCESS;
                    break;
                case RgbAuxInEnum.AUX_PERF_MDB_SUCCESS_V2:
                    version = (byte)AuxVersions.AUX_VERSION_2;
                    type = (byte)AuxTypes.AUX_TYPE_PERF_MDB_SUCCESS;
                    break;
                case RgbAuxInEnum.AUX_PERF_GC_SUCCESS:
                    version = (byte)AuxVersions.AUX_VERSION_1;
                    type = (byte)AuxTypes.AUX_TYPE_PERF_BG_GC_SUCCESS;
                    break;
                case RgbAuxInEnum.AUX_PERF_GC_SUCCESS_V2:
                    version = (byte)AuxVersions.AUX_VERSION_2;
                    type = (byte)AuxTypes.AUX_TYPE_PERF_BG_GC_SUCCESS;
                    break;
                case RgbAuxInEnum.AUX_PERF_FAILURE:
                    version = (byte)AuxVersions.AUX_VERSION_1;
                    type = (byte)AuxTypes.AUX_TYPE_PERF_BG_FAILURE;
                    break;
                case RgbAuxInEnum.AUX_PERF_FAILURE_V2:
                     version = (byte)AuxVersions.AUX_VERSION_2;
                    type = (byte)AuxTypes.AUX_TYPE_PERF_BG_FAILURE;
                    break;
                case RgbAuxInEnum.AUX_PERF_ACCOUNTINFO:
                    version = (byte)AuxVersions.AUX_VERSION_1;
                    type = (byte)AuxTypes.AUX_TYPE_PERF_ACCOUNTINFO;
                    break;
                case RgbAuxInEnum.AUX_CLIENT_CONNECTION_INFO:
                    version = (byte)AuxVersions.AUX_VERSION_1;
                    type = (byte)AuxTypes.AUX_CLIENT_CONNECTION_INFO;
                    break;
                default:
                    throw new NotImplementedException(ErrorMessage);
            }

            RPC_HEADER_EXT rpcHeaderExt = new RPC_HEADER_EXT
            {
                Version = 0x0000, // This value MUST be set to 0x0000.
                Flags = (ushort)RpcHeaderExtFlags.Last, // No Compression and no obfuscation
                Size = (ushort)(rgbAuxInPayload.Length + ConstValues.AuxHeaderByteSize) // The total length of the payload data that follows the RPC_HEADER_EXT structure. 
            };

            // The length of the payload data after it has been uncompressed.
            rpcHeaderExt.SizeActual = rpcHeaderExt.Size;

            // The length of AuxHeader is the length of AUX_HEADER structure plus the length of any additional payload data.
            AUX_HEADER auxHeader = new AUX_HEADER
            {
                Size = (ushort)(rgbAuxInPayload.Length + ConstValues.AuxHeaderByteSize),
                Version = version,
                Type = type
            };
            int returnSize = rgbAuxInPayload.Length + Marshal.SizeOf(rpcHeaderExt) + Marshal.SizeOf(auxHeader);
            byte[] returnByte = new byte[returnSize];

            // RgbAuxIn serialization 
            // Serializes the RPC_HEADER_EXT
            int index = 0;
            Array.Copy(BitConverter.GetBytes(rpcHeaderExt.Version), 0, returnByte, index, sizeof(short));
            index += sizeof(short);
            Array.Copy(BitConverter.GetBytes(rpcHeaderExt.Flags), 0, returnByte, index, sizeof(short));
            index += sizeof(short);
            Array.Copy(BitConverter.GetBytes(rpcHeaderExt.Size), 0, returnByte, index, sizeof(short));
            index += sizeof(short);
            Array.Copy(BitConverter.GetBytes(rpcHeaderExt.SizeActual), 0, returnByte, index, sizeof(short));
            index += sizeof(short);

            // Serializes the AUX_HEADER
            Array.Copy(BitConverter.GetBytes(auxHeader.Size), 0, returnByte, index, sizeof(ushort));
            index += sizeof(ushort);
            returnByte[index] = auxHeader.Version;
            index++;
            returnByte[index] = auxHeader.Type;
            index++;

            Array.Copy(rgbAuxInPayload, 0, returnByte, index, rgbAuxInPayload.Length);

            return returnByte;
        }