private static void ServerRegisterInterface(RpcHandle handle, Guid iid, RpcExecute fnExec, int maxCalls, int maxRequestBytes, bool allowAnonTcp)
        {
            const int RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH = 0x0010;
            int       flags  = 0;
            IntPtr    fnAuth = IntPtr.Zero;

            if (allowAnonTcp)
            {
                flags  = RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH;
                fnAuth = hAuthCall.Handle;
            }

            Ptr <RPC_SERVER_INTERFACE> sIf = MIDL_SERVER_INFO.Create(handle, iid, RpcApi.TYPE_FORMAT, RpcApi.FUNC_FORMAT, fnExec);

            if (!allowAnonTcp && maxRequestBytes < 0)
            {
                RpcException.Assert(RpcServerRegisterIf(sIf.Handle, IntPtr.Zero, IntPtr.Zero));
            }
            else
            {
                RpcException.Assert(RpcServerRegisterIf2(sIf.Handle, IntPtr.Zero, IntPtr.Zero, flags,
                                                         maxCalls <= 0 ? MAX_CALL_LIMIT : maxCalls,
                                                         maxRequestBytes <= 0 ? 80 * 1024 : maxRequestBytes, fnAuth));
            }

            handle.Handle = sIf.Handle;
        }
Ejemplo n.º 2
0
        private static Ptr <RPC_SERVER_INTERFACE> Configure(MIDL_SERVER_INFO temp, RpcHandle handle, Ptr <MIDL_SERVER_INFO> me, Guid iid,
                                                            Byte[] formatTypes,
                                                            Byte[] formatProc, ExplicitBytesExecute fnExecute)
        {
            Ptr <RPC_SERVER_INTERFACE> svrIface = handle.CreatePtr(CreateExplicitBytesServer(handle, me, iid));
            Ptr <MIDL_STUB_DESC>       stub     = handle.CreatePtr(new MIDL_STUB_DESC(handle, svrIface.Handle, formatTypes, true));

            temp.pStubDesc = stub.Handle;

            IntPtr ptrFunction = handle.PinFunction(fnExecute);

            temp.DispatchTable = handle.Pin(ptrFunction);

            temp.ProcString      = handle.Pin(formatProc);
            temp.FmtStringOffset = handle.Pin(new int[1] {
                0
            });

            temp.ThunkTable      = IntPtr.Zero;
            temp.pTransferSyntax = IntPtr.Zero;
            temp.nCount          = IntPtr.Zero;
            temp.pSyntaxInfo     = IntPtr.Zero;

            //Copy us back into the pinned address
            Marshal.StructureToPtr(temp, me.Handle, false);
            return(svrIface);
        }
        private static void ServerRegisterInterface(RpcHandle handle, Guid iid, RpcExecute fnExec)
        {
            Log.Verbose("ServerRegisterInterface({0})", iid);
            Ptr <RPC_SERVER_INTERFACE> sIf = MIDL_SERVER_INFO.Create(handle, iid, RpcApi.TYPE_FORMAT, RpcApi.FUNC_FORMAT,
                                                                     fnExec);

            RpcException.Assert(RpcServerRegisterIf(sIf.Handle, IntPtr.Zero, IntPtr.Zero));
            handle.Handle = sIf.Handle;
        }
Ejemplo n.º 4
0
        public static Ptr <RPC_SERVER_INTERFACE> Create(RpcHandle handle, Guid iid, Byte[] formatTypes,
                                                        Byte[] formatProc,
                                                        ExplicitBytesExecute fnExecute)
        {
            Ptr <MIDL_SERVER_INFO> pServer = handle.CreatePtr(new MIDL_SERVER_INFO());

            MIDL_SERVER_INFO temp = new MIDL_SERVER_INFO();

            return(Configure(temp, handle, pServer, iid, formatTypes, formatProc, fnExecute));
        }