refactor: split node agent and Go control plane
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
using System.Diagnostics;
|
||||
using Windows.Win32;
|
||||
using WxAgent.Core;
|
||||
|
||||
namespace WxAgent.Windows;
|
||||
|
||||
internal static class WechatDesktop
|
||||
{
|
||||
public static bool IsInputAvailable()
|
||||
{
|
||||
using var process = Process.GetCurrentProcess();
|
||||
// UIA can read cached windows on a locked/disconnected desktop. GetCursorPos requires the input desktop.
|
||||
return Environment.UserInteractive && process.SessionId != 0 && PInvoke.GetCursorPos(out _);
|
||||
}
|
||||
|
||||
public static void EnsureInputAvailable()
|
||||
{
|
||||
if (!IsInputAvailable())
|
||||
throw new WxAgentException(WxAgentErrorCode.SessionLocked,
|
||||
"The current session cannot access the input desktop. Connect and unlock the existing user session; no login bypass was attempted.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user