Ejemplo n.º 1
0
        /// <summary>
        /// The common method of all the SWN calls
        /// </summary>
        /// <param name="callId">The identifier of async call.</param>
        /// <returns>The decoded paramlist</returns>
        /// <exception cref="ArgumentException">
        /// Thrown when the call id is invalid.
        /// </exception>
        private RpceInt3264Collection RpceAsyncCallExpect(uint callId)
        {
            RpceInt3264Collection outParamList = null;

            byte[]             responseStub;
            RpceResponseFormat format;

            lock (responseLock)
            {
                if (!responseFormat.TryGetValue(callId, out format))
                {
                    throw new ArgumentException("Invalid call id.");
                }
            }

            rpceClientTransport.RecvResponse(callId, rpceTimeout, out responseStub);

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

            lock (responseLock)
            {
                responseFormat.Remove(callId);
            }

            return(outParamList);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The common method of all the SWN calls
        /// </summary>
        /// <param name="paramList">input param list to decode</param>
        /// <param name="opnum">opnum of the current SWN calls</param>
        /// <returns>the decoded paramlist</returns>
        private RpceInt3264Collection RpceCall(Int3264[] paramList, ushort opnum)
        {
            RpceInt3264Collection outParamList = null;

            byte[] requestStub;
            byte[] responseStub;

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

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

            outParamList = RpceStubDecoder.ToParamList(
                RpceStubHelper.GetPlatform(),
                SwnStubFormatString.TypeFormatString,
                null,
                SwnStubFormatString.ProcFormatString,
                SwnStubFormatString.ProcFormatStringOffsetTable[opnum],
                true,
                responseStub,
                rpceClientTransport.Context.PackedDataRepresentationFormat,
                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,
                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);
        }