失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > C#扫雷外挂辅助工具

C#扫雷外挂辅助工具

时间:2024-05-31 03:36:25

相关推荐

C#扫雷外挂辅助工具

C#扫雷外挂辅助工具

C#使用CE工具获取到扫雷的内存地址,调用API接口读取内存地址来获取具体的位置是否有雷,使用鼠标来点击。

using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Runtime.InteropServices;using System.Text;using System.Threading;using System.Threading.Tasks;using System.Windows.Forms;namespace MinesweeperHelper{public partial class Form2 : Form{public Form2(){InitializeComponent();}private void button1_Click(object sender, EventArgs e){int baseAddress = 0x01005000;string gamename = "winmine";byte[][] array = new byte[30][];byte[] buffer = new byte[1];IntPtr hProcess = Helper.OpenProcess(0x1F0FFF, false, Helper.GetPidByProcessName(gamename));for (int i = 0; i < 30; i++){array[i] = new byte[30];int rowaddress = baseAddress + 0x360 + i * 0x20;int cindex = 0;for (int j = 0; j < 30; j++){cindex = j;int address = rowaddress + 0x1 + 0x1 * j;IntPtr byteAddress = Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0); //获取缓冲区地址Helper.ReadProcessMemory(hProcess, (IntPtr)address, byteAddress, 4, IntPtr.Zero); //将制定内存中的值读入缓冲区byte b = Marshal.ReadByte(byteAddress);array[i][j] = b;if (b == 0x10){break;}}if (cindex == 0){break;}}IntPtr handle = FindWindow(null, "扫雷");SetForegroundWindow(handle);//显示Thread.Sleep(10);Point currentpoint = System.Windows.Forms.Cursor.Position;RECT rectWindows = new RECT();GetWindowRect(handle, ref rectWindows);SetCursorPos(rectWindows.Left + 11,rectWindows.Top + 95);MouseClick();int left = rectWindows.Left + 11 + 8;int top = rectWindows.Top + 100 + 8;for (int i = 0; i < 30; i++){for (int j = 0; j < 30; j++){if (array[i][j] == (byte)0x0F){SetCursorPos(left + j * 16, top + i * 16);MouseClick();}else if (array[i][j] == (byte)0x10){break;}//else if (array[i][j] == (byte)0x8F)//{// SetCursorPos(left + j * 16, top + i * 16);// MouseRightClick();//}}if (array[i][0] == (byte)0x10){break;}}System.Windows.Forms.Cursor.Position = currentpoint;var c = 0;}public static void MoveAndClick(IntPtr handle, Point point){Point pointnew = GetWindowsPoint(handle, point);SetCursorPos(pointnew.X, pointnew.Y);MouseClick();}public static void MouseClick(){//System.Threading.Thread.Sleep(1);mouse_event(MouseEventFlag.LeftDown, 0, 0, 0, UIntPtr.Zero);//System.Threading.Thread.Sleep(1);mouse_event(MouseEventFlag.LeftUp, 0, 0, 0, UIntPtr.Zero);}public static void MouseRightClick(){//System.Threading.Thread.Sleep(1);mouse_event(MouseEventFlag.RightDown, 0, 0, 0, UIntPtr.Zero);// System.Threading.Thread.Sleep(1);mouse_event(MouseEventFlag.RightUp, 0, 0, 0, UIntPtr.Zero);}public static Point GetWindowsPoint(IntPtr handle, Point pointConfig){RECT rectWindows = new RECT();GetWindowRect(handle, ref rectWindows);Point point = new Point();point.X = rectWindows.Left + pointConfig.X;point.Y = rectWindows.Top + pointConfig.Y;return point;}//设置鼠标按键和动作 [DllImport("user32.dll")]public static extern void mouse_event(MouseEventFlag flags, int dx, int dy,uint data, UIntPtr extraInfo); //UIntPtr指针多句柄类型 [DllImport("User32.dll")]public static extern bool SetCursorPos(int x, int y);[StructLayout(LayoutKind.Sequential)]public struct RECT{public int Left; //最左坐标public int Top; //最上坐标public int Right; //最右坐标public int Bottom; //最下坐标}[DllImport("user32.dll")][return: MarshalAs(UnmanagedType.Bool)]public static extern bool GetWindowRect(IntPtr hWnd, ref RECT lpRect);[DllImport("USER32.DLL")] //激活窗体 public static extern bool SetForegroundWindow(IntPtr hWnd);public enum MouseEventFlag : uint //设置鼠标动作的键值 {Move = 0x0001,//发生移动 LeftDown = 0x0002, //鼠标按下左键 LeftUp = 0x0004, //鼠标松开左键 RightDown = 0x0008,//鼠标按下右键 RightUp = 0x0010, //鼠标松开右键 MiddleDown = 0x0020, //鼠标按下中键 MiddleUp = 0x0040, //鼠标松开中键 XDown = 0x0080,XUp = 0x0100,Wheel = 0x0800, //鼠标轮被移动 VirtualDesk = 0x4000, //虚拟桌面 Absolute = 0x8000}[DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);}}

完整代码请下载

/download/DarkMoonSH/12314210

如果觉得《C#扫雷外挂辅助工具》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。