/// <summary>
        /// The common method of all the SWN async calls
        /// </summary>
        /// <param name="paramList">input param list to decode</param>
        /// <param name="opnum">opnum of the current SWN calls</param>
        /// <returns>The identifier of this async call.</returns>
        private uint RpceAsyncCall(Int3264[] paramList, ushort opnum)
        {
            byte[] requestStub;
            uint   callId;

            requestStub = RpceStubEncoder.ToBytes(
                RpceStubHelper.GetPlatform(),
                SwnStubFormatString.TypeFormatString,
                null,
                SwnStubFormatString.ProcFormatString,
                SwnStubFormatString.ProcFormatStringOffsetTable[opnum],
                true,
                paramList);

            rpceClientTransport.SendRequest(opnum, requestStub, out callId);

            RpceResponseFormat format = new RpceResponseFormat();

            format.opnum     = opnum;
            format.paramList = paramList;

            lock (responseLock)
            {
                responseFormat.Add(callId, format);
            }

            return(callId);
        }
        private RpceInt3264Collection RpceCall(Int3264[] paramList, ushort opnum)
        {
            byte[] requestStub;
            byte[] responseStub;
            RpceInt3264Collection outParamList = null;

            requestStub = RpceStubEncoder.ToBytes(
                RpceStubHelper.GetPlatform(),
                SrvsStubFormatString.TypeFormatString,
                null,
                SrvsStubFormatString.ProcFormatString,
                SrvsStubFormatString.ProcFormatStringOffsetTable[opnum],
                true,
                paramList);

            RpceClientTransport.Call(opnum, requestStub, RpceTimeout, out responseStub);

            outParamList = RpceStubDecoder.ToParamList(
                RpceStubHelper.GetPlatform(),
                SrvsStubFormatString.TypeFormatString,
                null,
                SrvsStubFormatString.ProcFormatString,
                SrvsStubFormatString.ProcFormatStringOffsetTable[opnum],
                true,
                responseStub,
                paramList);

            return(outParamList);
        }
        /// <summary>
        /// The common part of all the FSRVP methods
        /// </summary>
        /// <param name="paramList">input param list to decode</param>
        /// <param name="opnum">opnum of the current FSRVP method</param>
        /// <returns>the decoded paramlist</returns>
        public RpceInt3264Collection RpceCall(Int3264[] paramList, ushort opnum)
        {
            byte[] requestStub;
            byte[] responseStub;
            RpceInt3264Collection outParamList = null;

            requestStub = RpceStubEncoder.ToBytes(
                RpceStubHelper.GetPlatform(),
                FsrvpStubFormatString.TypeFormatString,
                null,
                FsrvpStubFormatString.ProcFormatString,
                FsrvpStubFormatString.ProcFormatStringOffsetTable[opnum],
                true,
                paramList);

            rpceClientTransport.Call(opnum, requestStub, rpceTimeout, out responseStub);

            outParamList = RpceStubDecoder.ToParamList(
                RpceStubHelper.GetPlatform(),
                FsrvpStubFormatString.TypeFormatString,
                null,
                FsrvpStubFormatString.ProcFormatString,
                FsrvpStubFormatString.ProcFormatStringOffsetTable[opnum],
                true,
                responseStub,
                rpceClientTransport.Context.PackedDataRepresentationFormat,
                paramList);


            return(outParamList);
        }
        /// <summary>
        ///  The IDL_DSAExecuteScript method executes a maintenance script.
        ///  Opnum: 1
        /// </summary>
        /// <param name="hRpc">
        ///  The RPC binding handle, as specified in [C706].
        /// </param>
        /// <param name="dwInVersion">
        ///  The version of the request message.
        /// </param>
        /// <param name="pmsgIn">
        ///  A pointer to the request message.
        /// </param>
        /// <param name="pdwOutVersion">
        ///  A pointer to the version of the response message.
        /// </param>
        /// <param name="pmsgOut">
        ///  A pointer to the response message.
        /// </param>
        public uint IDL_DSAExecuteScript(
            IntPtr hRpc,
            uint dwInVersion,
            //[Switch("dwInVersion")]
            DSA_MSG_EXECUTE_SCRIPT_REQ?pmsgIn,
            out uint?pdwOutVersion,
            //[Switch("*pdwOutVersion")]
            out DSA_MSG_EXECUTE_SCRIPT_REPLY?pmsgOut)
        {
            const ushort opnum = 1;

            byte[]    requestStub;
            byte[]    responseStub;
            Int3264[] paramList;

            SafeIntPtr ptrMsgIn = TypeMarshal.ToIntPtr(pmsgIn, dwInVersion, null, null);

            paramList = new Int3264[]
            {
                dwInVersion,
                ptrMsgIn,
                IntPtr.Zero,
                IntPtr.Zero,
                0//retVal
            };

            requestStub = RpceStubEncoder.ToBytes(
                RpceStubHelper.GetPlatform(),
                DrsrRpcStubFormatString.TypeFormatString,
                null,
                DrsrRpcStubFormatString.ProcFormatString,
                DrsrRpcStubFormatString.Dsaop_ProcFormatStringOffsetTable[opnum],
                true,
                paramList);

            rpceClientTransport.Call(opnum, requestStub, rpceTimeout, out responseStub);

            using (RpceInt3264Collection outParamList = RpceStubDecoder.ToParamList(
                       RpceStubHelper.GetPlatform(),
                       DrsrRpcStubFormatString.TypeFormatString,
                       null,
                       DrsrRpcStubFormatString.ProcFormatString,
                       DrsrRpcStubFormatString.Dsaop_ProcFormatStringOffsetTable[opnum],
                       true,
                       responseStub,
                       rpceClientTransport.Context.PackedDataRepresentationFormat,
                       paramList))
            {
                pdwOutVersion = TypeMarshal.ToNullableStruct <uint>(outParamList[2]);
                pmsgOut       = TypeMarshal.ToNullableStruct <DSA_MSG_EXECUTE_SCRIPT_REPLY>(
                    outParamList[3], pdwOutVersion, null, null);
                retVal = outParamList[4].ToUInt32();
            }

            ptrMsgIn.Dispose();

            return(retVal);
        }