コード例 #1
0
        private static NtAlpcClient ConnectPort(string path, SecurityQualityOfService sqos)
        {
            AlpcReceiveMessageAttributes in_attr = new AlpcReceiveMessageAttributes();

            return(NtAlpcClient.Connect(path, null,
                                        CreatePortAttributes(sqos), AlpcMessageFlags.SyncRequest, null, null, null, in_attr, NtWaitTimeout.FromSeconds(5)));
        }
コード例 #2
0
 /// <summary>
 /// Method to create an object from a set of object attributes.
 /// </summary>
 /// <param name="obj_attributes">The object attributes to create/open from.</param>
 /// <returns>The newly created object.</returns>
 protected override object CreateObject(ObjectAttributes obj_attributes)
 {
     if (ParameterSetName == "SidCheck")
     {
         return(NtAlpcClient.Connect(Path, HandleObjectAttributes, PortAttributes, Flags, RequiredServerSid, ConnectionMessage,
                                     OutMessageAttributes, InMessageAttributes, Timeout));
     }
     else
     {
         return(NtAlpcClient.Connect(obj_attributes, HandleObjectAttributes, PortAttributes, Flags, ServerSecurityRequirements,
                                     ConnectionMessage, OutMessageAttributes, InMessageAttributes, Timeout));
     }
 }
コード例 #3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="path">The path to connect. The format depends on the transport.</param>
        /// <param name="security_quality_of_service">The security quality of service for the connection.</param>
        public RpcAlpcClientTransport(string path, SecurityQualityOfService security_quality_of_service)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentException("Must specify a path to connect to");
            }

            if (!path.StartsWith(@"\"))
            {
                path = $@"\RPC Control\{path}";
            }

            _client  = ConnectPort(path, security_quality_of_service);
            Endpoint = path;
        }
コード例 #4
0
        /// <summary>
        /// Connect the client to an ALPC port.
        /// </summary>
        /// <param name="alpc_path">The path to the ALPC port.</param>
        /// <param name="security_quality_of_service">The security quality of service for the port.</param>
        public void Connect(string alpc_path, SecurityQualityOfService security_quality_of_service)
        {
            if (Connected)
            {
                throw new InvalidOperationException("RPC client is already connected.");
            }

            if (string.IsNullOrEmpty(alpc_path))
            {
                alpc_path = LookupEndpoint();
            }
            else if (!alpc_path.StartsWith(@"\"))
            {
                alpc_path = $@"\RPC Control\{alpc_path}";
            }
            AlpcPath = alpc_path;
            _client  = ConnectPort(alpc_path, security_quality_of_service);
            CallId   = 1;
            BindInterface();
        }
コード例 #5
0
 /// <summary>
 /// Dispose of the client.
 /// </summary>
 public void Dispose()
 {
     _client?.Dispose();
     _client = null;
 }