windowswindows-8logmein

Detect programmatically if there is a LogMeIn remote session


Is there a way to programmatically detect if there is a LogMeIn session on the current Windows PC / user?

I have tried it in several ways (in C#, but the language is irrelevant):

Any hints?


Solution

  • Solved it by intercepting ETW traces:

    var logmeinProcess = System.Diagnostics.Process.GetProcessesByName("LogMeIn").Single();
    using (var session = new TraceEventSession("MyRealTimeSession"))         // Create a session to listen for events
    {
        session.EnableKernelProvider(Microsoft.Diagnostics.Tracing.Parsers.KernelTraceEventParser.Keywords.NetworkTCPIP);
        session.Source.Kernel.UdpIpSend += (data) =>
        {
            if (data.ProcessID == logmeinProcess.Id)
            {
                lock (_logMeInUdpQueue)
                {
                    _logMeInUdpQueue.Enqueue(DateTime.UtcNow);
                }
            }
        };
    
        session.Source.Process();
    }
    

    This way I get the number of UDP Sends by the LogMeIn process, which is perfect for detecting LogMeIn sessions.