Пример #1
0
        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);

            ProtocolSequence = cracked.Protseq;
            NetworkAddress   = cracked.NetworkAddr;
            Endpoint         = cracked.Endpoint;
            NetworkOptions   = cracked.NetworkOptions;
            if (ProtocolSequence.Equals("ncalrpc", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(Endpoint))
            {
                EndpointPath = $@"\RPC Control\{Endpoint}";
            }
            else if (ProtocolSequence.Equals("ncacn_np", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(Endpoint))
            {
                EndpointPath = $@"\??{Endpoint}";
            }
            else
            {
                EndpointPath = string.Empty;
            }
        }
Пример #2
0
 internal RpcEndpoint(RPC_IF_ID if_id, UUID uuid, SafeRpcStringHandle annotation, SafeRpcBindingHandle binding, bool registered)
 {
     InterfaceId      = if_id.Uuid;
     InterfaceVersion = new Version(if_id.VersMajor, if_id.VersMinor);
     ObjectUuid       = uuid.Uuid;
     Annotation       = annotation?.ToString() ?? string.Empty;
     BindingString    = binding.ToString();
     ProtocolSequence = binding.Protseq;
     NetworkAddress   = binding.NetworkAddr;
     Endpoint         = binding.Endpoint;
     NetworkOptions   = binding.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 = $@"\??{Endpoint}";
     }
     else
     {
         EndpointPath = string.Empty;
     }
     Registered = registered;
 }
        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);
        }