Пример #1
0
        private static IEnumerable <RpcAlpcServer> GetAlpcServersInternal(IEnumerable <NtHandle> handles)
        {
            NtType alpc_type = NtType.GetTypeByType <NtAlpc>();

            foreach (var handle in handles.Where(h => h.NtType == alpc_type &&
                                                 h.Name.StartsWith(@"\RPC Control\", StringComparison.OrdinalIgnoreCase)))
            {
                List <RpcEndpoint> endpoints = new List <RpcEndpoint>();
                try {
                    endpoints.AddRange(RpcEndpointMapper.QueryEndpointsForAlpcPort(handle.Name));
                } catch (SafeWin32Exception) {
                }

                if (endpoints.Count > 0)
                {
                    yield return(new RpcAlpcServer(handle, endpoints));
                }
            }
        }
 /// <summary>
 /// Resolve the current running endpoint for this server.
 /// </summary>
 /// <returns></returns>
 public string ResolveRunningEndpoint()
 {
     return(RpcEndpointMapper.QueryAlpcEndpoints(Server.InterfaceId, Server.InterfaceVersion).FirstOrDefault()?.Endpoint ?? string.Empty);
 }