internal RpcEndpoint(RPC_IF_ID if_id, UUID uuid, SafeRpcStringHandle annotation, SafeRpcBindingHandle binding) { InterfaceId = if_id.Uuid; InterfaceVersion = new Version(if_id.VersMajor, if_id.VersMinor); ObjectUuid = uuid.Uuid; Annotation = annotation.ToString(); BindingString = binding.ToString(); var cracked = new CrackedBindingString(BindingString); Protseq = cracked.Protseq; NetworkAddr = cracked.NetworkAddr; Endpoint = cracked.Endpoint; NetworkOptions = cracked.NetworkOptions; if (Protseq.Equals("ncalrpc", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(Endpoint)) { EndpointPath = $@"\RPC Control\{Endpoint}"; } else if (Protseq.Equals("ncacn_np", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(Endpoint)) { EndpointPath = $@"\??{Endpoint}"; } else { EndpointPath = string.Empty; } }
private CrackedBindingString GetCrackedBinding() { if (IsClosed) { throw new ObjectDisposedException("CrackedBindingString"); } if (_cracked_binding == null) { _cracked_binding = new CrackedBindingString(ToString()); } return(_cracked_binding); }
private RpcEndpoint(Guid interface_id, Version interface_version, string annotation, string binding, bool registered) { InterfaceId = interface_id; InterfaceVersion = interface_version; CrackedBindingString cracked = new CrackedBindingString(binding); Guid.TryParse(cracked.ObjUuid, out Guid guid); ObjectUuid = guid; Annotation = annotation ?? string.Empty; BindingString = binding.ToString(); ProtocolSequence = cracked.Protseq; NetworkAddress = cracked.NetworkAddr; Endpoint = cracked.Endpoint; NetworkOptions = cracked.NetworkOptions; if (ProtocolSequence.Equals("ncalrpc", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(Endpoint)) { if (Endpoint.Contains(@"\")) { EndpointPath = Endpoint; } else { EndpointPath = $@"\RPC Control\{Endpoint}"; } } else if (ProtocolSequence.Equals("ncacn_np", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(Endpoint)) { EndpointPath = string.IsNullOrEmpty(NetworkAddress) ? $@"\??{Endpoint}" : $@"\??\UNC\{NetworkAddress}{Endpoint}"; } else { EndpointPath = string.Empty; } Registered = registered; _server_process_info = new Lazy <RpcServerProcessInformation>(GetServerProcessInformation); }