protected override void DisposeHandle(ref IntPtr handle) { if (!(handle != IntPtr.Zero)) { return; } int num = (int)RpcServerApi.RpcServerUnregisterIf(handle, IntPtr.Zero, 1U); handle = IntPtr.Zero; }
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); }
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); }
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); }
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; }
public bool AddProtocol(RpcProtseq protocol, string endpoint, int maxCalls) { this._maxCalls = Math.Max(this._maxCalls, maxCalls); return(RpcServerApi.ServerUseProtseqEp(protocol, maxCalls, endpoint)); }
private static void ServerStopListening() { int num1 = (int)RpcServerApi.RpcMgmtStopServerListening(IntPtr.Zero); int num2 = (int)RpcServerApi.RpcMgmtWaitServerListen(); }