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;
        }
예제 #2
0
        private Ptr <RPC_SERVER_INTERFACE> Configure(RpcHandle handle, Ptr <MIDL_SERVER_INFO> me, Guid iid,
                                                     Byte[] formatTypes,
                                                     Byte[] formatProc, RpcExecute fnExecute)
        {
            Ptr <RPC_SERVER_INTERFACE> svrIface = handle.CreatePtr(new RPC_SERVER_INTERFACE(handle, me, iid));
            Ptr <MIDL_STUB_DESC>       stub     = handle.CreatePtr(new MIDL_STUB_DESC(handle, svrIface.Handle, formatTypes, true));

            pStubDesc = stub.Handle;

            IntPtr ptrFunction = handle.PinFunction(fnExecute);

            DispatchTable = handle.Pin(ptrFunction);

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

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

            //Copy us back into the pinned address
            Marshal.StructureToPtr(this, 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;
        }
예제 #4
0
        internal static Ptr<RPC_SERVER_INTERFACE> Create(RpcHandle handle, Guid iid, Byte[] formatTypes,
                                                         Byte[] formatProc,
                                                         RpcExecute fnExecute)
        {
            Ptr<MIDL_SERVER_INFO> pServer = handle.CreatePtr(new MIDL_SERVER_INFO());

            MIDL_SERVER_INFO temp = new MIDL_SERVER_INFO();
            return temp.Configure(handle, pServer, iid, formatTypes, formatProc, fnExecute);
        }
예제 #5
0
        internal static Ptr <RPC_SERVER_INTERFACE> Create(RpcHandle handle, Guid iid, Byte[] formatTypes,
                                                          Byte[] formatProc,
                                                          RpcExecute fnExecute)
        {
            Ptr <MIDL_SERVER_INFO> pServer = handle.CreatePtr(new MIDL_SERVER_INFO());

            MIDL_SERVER_INFO temp = new MIDL_SERVER_INFO();

            return(temp.Configure(handle, pServer, iid, formatTypes, formatProc, fnExecute));
        }
예제 #6
0
        private Ptr<RPC_SERVER_INTERFACE> Configure(RpcHandle handle, Ptr<MIDL_SERVER_INFO> me, Guid iid,
                                                    Byte[] formatTypes,
                                                    Byte[] formatProc, RpcExecute fnExecute)
        {
            Ptr<RPC_SERVER_INTERFACE> svrIface = handle.CreatePtr(new RPC_SERVER_INTERFACE(handle, me, iid));
            Ptr<MIDL_STUB_DESC> stub = handle.CreatePtr(new MIDL_STUB_DESC(handle, svrIface.Handle, formatTypes, true));
            pStubDesc = stub.Handle;

            IntPtr ptrFunction = handle.PinFunction(fnExecute);
            DispatchTable = handle.Pin(ptrFunction);

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

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

            //Copy us back into the pinned address
            Marshal.StructureToPtr(this, me.Handle, false);
            return svrIface;
        }
예제 #7
0
        private static void ServerRegisterInterface(RpcHandle handle, Guid iid, RpcExecute fnExec, int maxCalls, int maxRequestBytes, bool allowAnonTcp)
        {
            int    Flags = 0;
            IntPtr hProc = IntPtr.Zero;

            if (allowAnonTcp)
            {
                Flags = 16;
                hProc = RpcServerApi.hAuthCall.Handle;
            }
            Ptr <RPC_SERVER_INTERFACE> ptr = MIDL_SERVER_INFO.Create(handle, iid, RpcApi.TYPE_FORMAT, RpcApi.FUNC_FORMAT, fnExec);

            if (!allowAnonTcp && maxRequestBytes < 0)
            {
                RpcException.Assert(RpcServerApi.RpcServerRegisterIf(ptr.Handle, IntPtr.Zero, IntPtr.Zero));
            }
            else
            {
                RpcException.Assert(RpcServerApi.RpcServerRegisterIf2(ptr.Handle, IntPtr.Zero, IntPtr.Zero, Flags, maxCalls <= 0 ? (int)byte.MaxValue : maxCalls, maxRequestBytes <= 0 ? 81920 : maxRequestBytes, hProc));
            }

            handle.Handle = ptr.Handle;
        }
        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;
        }
예제 #9
0
        private Ptr <RPC_SERVER_INTERFACE> Configure(RpcHandle handle, Ptr <MIDL_SERVER_INFO> me, Guid iid, byte[] formatTypes, byte[] formatProc, RpcExecute fnExecute)
        {
            Ptr <RPC_SERVER_INTERFACE> ptr = handle.CreatePtr <RPC_SERVER_INTERFACE>(new RPC_SERVER_INTERFACE(handle, me, iid));

            this.pStubDesc = handle.CreatePtr <MIDL_STUB_DESC>(new MIDL_STUB_DESC(handle, ptr.Handle, formatTypes, true)).Handle;
            IntPtr data = handle.PinFunction <RpcExecute>(fnExecute);

            this.DispatchTable   = handle.Pin <IntPtr>(data);
            this.ProcString      = handle.Pin <byte[]>(formatProc);
            this.FmtStringOffset = handle.Pin <int[]>(new int[1]);
            this.ThunkTable      = IntPtr.Zero;
            this.pTransferSyntax = IntPtr.Zero;
            this.nCount          = IntPtr.Zero;
            this.pSyntaxInfo     = IntPtr.Zero;
            Marshal.StructureToPtr((object)this, me.Handle, false);
            return(ptr);
        }
예제 #10
0
        internal static Ptr <RPC_SERVER_INTERFACE> Create(RpcHandle handle, Guid iid, byte[] formatTypes, byte[] formatProc, RpcExecute fnExecute)
        {
            Ptr <MIDL_SERVER_INFO> ptr = handle.CreatePtr <MIDL_SERVER_INFO>(new MIDL_SERVER_INFO());

            return(new MIDL_SERVER_INFO().Configure(handle, ptr, iid, formatTypes, formatProc, fnExecute));
        }