Esempio n. 1
0
            protected override void DisposeHandle(ref IntPtr handle)
            {
                if (!(handle != IntPtr.Zero))
                {
                    return;
                }
                int num = (int)RpcServerApi.RpcServerUnregisterIf(handle, IntPtr.Zero, 1U);

                handle = IntPtr.Zero;
            }
Esempio n. 2
0
        private static void ServerListen(int maxCalls)
        {
            RpcError errorCode = RpcServerApi.RpcServerListen(1U, maxCalls, 1U);

            if (errorCode == RpcError.RPC_S_ALREADY_LISTENING)
            {
                errorCode = RpcError.RPC_S_OK;
            }
            RpcException.Assert(errorCode);
        }
Esempio n. 3
0
 public RpcServerApi(Guid iid, int maxCalls, int maxRequestBytes, bool allowAnonTcp)
 {
     this.IID       = iid;
     this._maxCalls = maxCalls;
     this._handle   = (RpcHandle) new RpcServerApi.RpcServerHandle();
     if (Guid.Empty.Equals(iid))
     {
         return;
     }
     RpcServerApi.ServerRegisterInterface(this._handle, this.IID, new RpcExecute(this.RpcEntryPoint), maxCalls, maxRequestBytes, allowAnonTcp);
 }
Esempio n. 4
0
        private static bool ServerUseProtseqEp(RpcProtseq protocol, int maxCalls, string endpoint)
        {
            RpcError errorCode = RpcServerApi.RpcServerUseProtseqEp(protocol.ToString(), maxCalls, endpoint, IntPtr.Zero);

            if (errorCode != RpcError.RPC_S_DUPLICATE_ENDPOINT)
            {
                RpcException.Assert(errorCode);
            }

            return(errorCode == RpcError.RPC_S_OK);
        }
Esempio n. 5
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;
        }
Esempio n. 6
0
 public bool AddProtocol(RpcProtseq protocol, string endpoint, int maxCalls)
 {
     this._maxCalls = Math.Max(this._maxCalls, maxCalls);
     return(RpcServerApi.ServerUseProtseqEp(protocol, maxCalls, endpoint));
 }
Esempio n. 7
0
 private static void ServerStopListening()
 {
     int num1 = (int)RpcServerApi.RpcMgmtStopServerListening(IntPtr.Zero);
     int num2 = (int)RpcServerApi.RpcMgmtWaitServerListen();
 }