采用的混合解决方案 WinAPIHelper(C# 项目)提供一些API的封装Win32.csusing System; using System.Runtime.InteropServices;namespace WinAPIHelper { public class Consts { private Consts() {
} public const int MK_LBUTTON = 0x1; public const int MK_MBUTTON = 0x10; public const int MK_RBUTTON = 0x2; public const int MOUSEEVENTF_ABSOLUTE = 0x8000; public const int MOUSEEVENTF_LEFTDOWN = 0x2; public const int MOUSEEVENTF_LEFTUP = 0x4; public const int MOUSEEVENTF_MIDDLEDOWN = 0x20; public const int MOUSEEVENTF_MIDDLEUP = 0x40; public const int MOUSEEVENTF_MOVE = 0x1; public const int MOUSEEVENTF_RIGHTDOWN = 0x8; public const int MOUSEEVENTF_RIGHTUP = 0x10; public const int HWND_NOTOPMOST = -2; public const int HWND_TOPMOST = -1;
public const int SWP_NOSIZE = 0x1; public const int SWP_NOMOVE = 0x2; public const int STANDARD_RIGHTS_REQUIRED = 0xF0000; public const int SYNCHRONIZE = 0x100000; public const int SPECIFIC_RIGHTS_ALL = 0xFFFF; public const int STANDARD_RIGHTS_ALL = 0x1F0000; public const int PAGE_EXECUTE_READ = 0x20; public const int PAGE_EXECUTE_READWRITE = 0x40; } public class Types { private Types() {
} [StructLayout(LayoutKind.Sequential)] public struct POINTAPI { public int x; public int y; } } public class Declares { private Declares() {
}
[DllImport("user32.dll", EntryPoint="FindWindow")] public static extern int FindWindow ( string lpClassName, string lpWindowName ); [DllImport("user32.dll", EntryPoint="SetWindowPos")] public static extern int SetWindowPos ( int hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags ); [DllImport("user32.dll", EntryPoint="mouse_event")] public static extern void mouse_event ( int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo ); [DllImport("user32.dll", EntryPoint="GetDC")] public static extern int GetDC ( int hwnd ); [DllImport("gdi32.dll", EntryPoint="GetPixel")] public static extern int GetPixel ( int hdc, int x, int y ); [DllImport("user32.dll", EntryPoint="ReleaseDC")] public static extern int ReleaseDC ( int hwnd, int hdc ); [DllImport("user32.dll", EntryPoint="GetCursorPos")] public static extern int GetCursorPos ( ref Types.POINTAPI lpPoint ); [DllImport("user32.dll", EntryPoint="SetCursorPos")] public static extern int SetCursorPos ( int x, int y ); [DllImport("kernel32.dll", EntryPoint="WriteProcessMemory")] public static extern int WriteProcessMemory ( int hProcess, ref int lpBaseAddress, ref int lpBuffer, int nSize, ref int lpNumberOfBytesWritten ); [DllImport("kernel32.dll", EntryPoint="WriteProcessMemory")] public static extern int WriteProcessMemory ( int hProcess, ref int lpBaseAddress, ref char[] lpBuffer, int nSize, ref int lpNumberOfBytesWritten ); [DllImport("kernel32.dll", EntryPoint="ReadProcessMemory")] public static extern int ReadProcessMemory ( int hProcess, ref int lpBaseAddress, ref int lpBuffer, int nSize, ref int lpNumberOfBytesWritten ); [DllImport("kernel32.dll", EntryPoint="ReadProcessMemory")] public static extern int ReadProcessMemory ( int hProcess, ref int lpBaseAddress, ref byte[] lpBuffer, int nSize, ref int lpNumberOfBytesWritten ); [DllImport("kernel32.dll", EntryPoint="ReadProcessMemory")] public static extern int ReadProcessMemory ( int hProcess, ref int lpBaseAddress, ref byte lpBuffer, int nSize, ref int lpNumberOfBytesWritten ); [DllImport("user32.dll", EntryPoint="GetWindowThreadProcessId")] public static extern int GetWindowThreadProcessId ( int hwnd, ref int lpdwProcessId ); [DllImport("kernel32.dll", EntryPoint="OpenProcess")] public static extern int OpenProcess ( int dwDesiredAccess, int bInheritHandle, int dwProcessId ); [DllImport("kernel32.dll", EntryPoint="CloseHandle")] public static extern int CloseHandle ( int hObject ); [DllImport("user32.dll", EntryPoint="GetMessageExtraInfo")] public static extern int GetMessageExtraInfo (); [DllImport("kernel32.dll", EntryPoint="VirtualProtectEx")] public static extern int VirtualProtectEx ( int hProcess, ref int lpAddress, int dwSize, int flNewProtect, ref int lpflOldProtect ); [DllImport("kernel32.dll", EntryPoint="GetModuleHandle")] public static extern int GetModuleHandle ( string lpModuleName ); [DllImport("user32.dll", EntryPoint="SendMessage")] public static extern int SendMessage ( int hwnd, int wMsg, int wParam, ref int lParam ); } }
bytesRead = ptrBytesRead.ToInt32(); return buffer; } public void WriteProcessMemory(IntPtr MemoryAddress, byte[] bytesToWrite ,out int bytesWritten) { IntPtr ptrBytesWritten; ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess,MemoryAddress,bytesToWrite,bytesToWrite.Length,out ptrBytesWritten);
bytesWritten = ptrBytesWritten.ToInt32(); } } }
DuiDuiTool(VB.net项目) ,添加WinAPIHelper引用 Imports WinAPIHelper.Declares Imports WinAPIHelper.Consts Imports WinAPIHelper.TypesPublic Class Form1 Inherits System.Windows.Forms.Form#Region " Windows 窗体设计器生成的代码 " Public Sub New() MyBase.New() '该调用是 Windows 窗体设计器所必需的。 InitializeComponent() '在 InitializeComponent() 调用之后添加任何初始化 End Sub '窗体重写 dispose 以清理组件列表。 Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Windows 窗体设计器所必需的 Private components As System.ComponentModel.IContainer '注意: 以下过程是 Windows 窗体设计器所必需的 '可以使用 Windows 窗体设计器修改此过程。 '不要使用代码编辑器修改它。 Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents NumericUpDown1 As System.Windows.Forms.NumericUpDown Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Timer1 As System.Timers.Timer Friend WithEvents Button2 As System.Windows.Forms.Button <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.Button1 = New System.Windows.Forms.Button Me.NumericUpDown1 = New System.Windows.Forms.NumericUpDown Me.Label1 = New System.Windows.Forms.Label Me.Label2 = New System.Windows.Forms.Label Me.Timer1 = New System.Timers.Timer Me.Button2 = New System.Windows.Forms.Button CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.Timer1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(8, 112) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(88, 40) Me.Button1.TabIndex = 0 Me.Button1.Text = "启动" ' 'NumericUpDown1 ' Me.NumericUpDown1.Location = New System.Drawing.Point(8, 32) Me.NumericUpDown1.Maximum = New Decimal(New Integer() {100000, 0, 0, 0}) Me.NumericUpDown1.Minimum = New Decimal(New Integer() {10, 0, 0, 0}) Me.NumericUpDown1.Name = "NumericUpDown1" Me.NumericUpDown1.Size = New System.Drawing.Size(56, 21) Me.NumericUpDown1.TabIndex = 1 Me.NumericUpDown1.Value = New Decimal(New Integer() {100, 0, 0, 0}) ' 'Label1 ' Me.Label1.AutoSize = True Me.Label1.Location = New System.Drawing.Point(8, 8) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(79, 17) Me.Label1.TabIndex = 2 Me.Label1.Text = "扫描间隔时间" ' 'Label2 ' Me.Label2.AutoSize = True Me.Label2.Location = New System.Drawing.Point(72, 40) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(29, 17) Me.Label2.TabIndex = 3 Me.Label2.Text = "毫秒" ' 'Timer1 ' Me.Timer1.Interval = 10 Me.Timer1.SynchronizingObject = Me ' 'Button2 ' Me.Button2.Location = New System.Drawing.Point(8, 64) Me.Button2.Name = "Button2" Me.Button2.Size = New System.Drawing.Size(88, 40) Me.Button2.TabIndex = 4 Me.Button2.Text = "去除QQ反作弊" ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14) Me.ClientSize = New System.Drawing.Size(106, 175) Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.NumericUpDown1) Me.Controls.Add(Me.Button1) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "Form1" Me.Text = "对对碰工具" Me.TopMost = True CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.Timer1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub#End Region
'各图片颜色标志点 Private Const FOX_POINT1_COLOR As Integer = 15187901 Private Const FOX_POINT2_COLOR As Integer = 13862016 Private Const PANDA_POINT1_COLOR As Integer = 0 Private Const PANDA_POINT2_COLOR As Integer = 5000268 Private Const CHICKEN_POINT1_COLOR As Integer = 5493503 Private Const CHICKEN_POINT2_COLOR As Integer = 1964541 Private Const CAT_POINT1_COLOR As Integer = 9539985 Private Const CAT_POINT2_COLOR As Integer = 14211288 Private Const FROG_POINT1_COLOR As Integer = 16777215 Private Const FROG_POINT2_COLOR As Integer = 16777215 Private Const MONKEY_POINT1_COLOR As Integer = 16777215 Private Const MONKEY_POINT2_COLOR As Integer = 6733055 Private Const COW_POINT1_COLOR As Integer = 8447487 Private Const COW_POINT2_COLOR As Integer = 11382961 Private Const DUIITEM_ROW As Integer = 7 Private Const DUIITEM_COL As Integer = 7 Private Const DUIITEM_WIDTH As Integer = 48 Private Const DUIITEM_HEIGHT As Integer = 48 Private Const GAME_WINDOW_LEFT As Integer = 0 Private Const GAME_WINDOW_TOP As Integer = 0 Private Const GAME_TABLE_LEFT As Integer = GAME_WINDOW_LEFT + 175 Private Const GAME_TABLE_TOP As Integer = GAME_WINDOW_TOP + 101 Private Const POINT_POS_LEFT_1 As Integer = 15 Private Const POINT_POS_LEFT_2 As Integer = 30 Private Const POINT_POS_TOP As Integer = 20 Private Const GAME_WINDOW_TITLE As String = "对对碰" '"对对碰" Private Const BASE As Integer = &H408520 ' Public Enum DuiItemType No Fox Panda Chicken Cat Frog Monkey Cow End Enum Public Enum ClickArow Up Down Left Right End Enum Public Structure DuiItem Dim x As Integer Dim y As Integer Dim ct As DuiItemType '单元类型 Dim arow As ClickArow '与该单元格互换的单元格所在的方向 End Structure Private DuiItems(DUIITEM_ROW, DUIITEM_COL) As DuiItem Private g_hwnd As Integer = 0 Private screenWidth As Integer Private screenHeight As Integer Private Function GetPixelColor(ByVal x As Integer, ByVal y As Integer) As Integer Dim color As Integer If g_hwnd <> 0 Then Dim dc As Integer dc = GetDC(0) color = GetPixel(dc, x, y) ReleaseDC(g_hwnd, dc) End If Return color End Function Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim desktopSize As Size desktopSize = System.Windows.Forms.SystemInformation.PrimaryMonitorSize screenHeight = desktopSize.Height screenWidth = desktopSize.Width End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If Me.Button1.Text = "启动" Then Me.Timer1.Interval = Me.NumericUpDown1.Value Me.Timer1.Start() Me.NumericUpDown1.Enabled = False Me.Button1.Text = "停止" Else Me.Timer1.Stop() Me.NumericUpDown1.Enabled = True Me.Button1.Text = "启动" End If End Sub
Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed g_hwnd = FindWindow(vbNullString, GAME_WINDOW_TITLE) If g_hwnd <> 0 Then Me.Timer1.Stop() SetWindowPos(g_hwnd, HWND_TOPMOST, GAME_WINDOW_LEFT, GAME_WINDOW_TOP, 0, 0, SWP_NOSIZE) InitDuiItems() '获取当前图片中所有单元格 Dim c As DuiItem = GetDuiItem() '获取符合交换条件的单元格 If c.ct <> DuiItemType.No Then '获取成功后模拟点击鼠标进行图片交换 Dim x As Integer = c.x Dim y As Integer = c.y MouseClick(x, y) Select Case c.arow Case ClickArow.Down y = y + DUIITEM_HEIGHT Case ClickArow.Left x = x - DUIITEM_WIDTH Case ClickArow.Right x = x + DUIITEM_WIDTH Case ClickArow.Up y = y - DUIITEM_HEIGHT End Select MouseClick(x, y) System.Threading.Thread.Sleep(Me.NumericUpDown1.Value) End If Me.Timer1.Start() End If End Sub '模拟鼠标点击 Public Sub MouseClick(ByVal x As Integer, ByVal y As Integer) Dim p As POINTAPI GetCursorPos(p) mouse_event(MOUSEEVENTF_MOVE Or MOUSEEVENTF_ABSOLUTE, 65535 * x / screenWidth, 65535 * y / screenHeight, 0, GetMessageExtraInfo()) mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, GetMessageExtraInfo()) mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, GetMessageExtraInfo()) SetCursorPos(p.x, p.y) End Sub Private Function GetDuiItem() As DuiItem Dim i As Integer Dim j As Integer Try For i = 0 To DUIITEM_ROW - 1 For j = 0 To DUIITEM_COL - 1 '与右边两连 If DuiItems(i, j).ct = DuiItems(i, j + 1).ct And DuiItems(i, j).ct <> DuiItemType.No Then '左 If j > 1 Then If (DuiItems(i, j - 2).ct = DuiItems(i, j).ct) Then DuiItems(i, j - 2).arow = ClickArow.Right Return DuiItems(i, j - 2) End If End If '左上 If i > 0 And j > 0 Then If (DuiItems(i - 1, j - 1).ct = DuiItems(i, j).ct) Then DuiItems(i - 1, j - 1).arow = ClickArow.Down Return DuiItems(i - 1, j - 1) End If End If '左下 If i < DUIITEM_ROW And j > 0 Then If (DuiItems(i + 1, j - 1).ct = DuiItems(i, j).ct) Then DuiItems(i + 1, j - 1).arow = ClickArow.Up Return DuiItems(i + 1, j - 1) End If End If '右 If j < DUIITEM_COL - 2 Then If (DuiItems(i, j + 3).ct = DuiItems(i, j).ct) Then DuiItems(i, j + 3).arow = ClickArow.Left Return DuiItems(i, j + 3) End If End If '右上 If i > 0 And j < DUIITEM_COL - 1 Then If (DuiItems(i - 1, j + 2).ct = DuiItems(i, j).ct) Then DuiItems(i - 1, j + 2).arow = ClickArow.Down Return DuiItems(i - 1, j + 2) End If End If '右下 If i < DUIITEM_ROW And j < DUIITEM_COL - 1 Then If (DuiItems(i + 1, j + 2).ct = DuiItems(i, j).ct) Then DuiItems(i + 1, j + 2).arow = ClickArow.Up Return DuiItems(i + 1, j + 2) End If End If End If
'与下边两连 If DuiItems(i, j).ct = DuiItems(i + 1, j).ct And DuiItems(i, j).ct <> DuiItemType.No Then '上 If i > 1 Then If (DuiItems(i - 2, j).ct = DuiItems(i, j).ct) Then DuiItems(i - 2, j).arow = ClickArow.Down Return DuiItems(i - 2, j) End If End If '上左 If i > 0 And j > 0 Then If (DuiItems(i - 1, j - 1).ct = DuiItems(i, j).ct) Then DuiItems(i - 1, j - 1).arow = ClickArow.Right Return DuiItems(i - 1, j - 1) End If End If '上右 If i > 0 And j < DUIITEM_COL - 1 Then If (DuiItems(i - 1, j + 1).ct = DuiItems(i, j).ct) Then DuiItems(i - 1, j + 1).arow = ClickArow.Left Return DuiItems(i - 1, j + 1) End If End If '下 If i < DUIITEM_ROW - 2 Then If (DuiItems(i + 3, j).ct = DuiItems(i, j).ct) Then DuiItems(i + 3, j).arow = ClickArow.Up Return DuiItems(i + 3, j) End If End If '下左 If i < DUIITEM_ROW - 1 And j > 0 Then If (DuiItems(i + 2, j - 1).ct = DuiItems(i, j).ct) Then DuiItems(i + 2, j - 1).arow = ClickArow.Right Return DuiItems(i + 2, j - 1) End If End If '下右 If i < DUIITEM_ROW - 1 And j < DUIITEM_COL - 1 Then If (DuiItems(i + 2, j + 1).ct = DuiItems(i, j).ct) Then DuiItems(i + 2, j + 1).arow = ClickArow.Left Return DuiItems(i + 2, j + 1) End If End If End If '与右间隔两连 If j < DUIITEM_COL - 1 Then If DuiItems(i, j).ct = DuiItems(i, j + 2).ct And DuiItems(i, j).ct <> DuiItemType.No Then '上 If i > 0 Then If (DuiItems(i - 1, j + 1).ct = DuiItems(i, j).ct) Then DuiItems(i - 1, j + 1).arow = ClickArow.Down Return DuiItems(i - 1, j + 1) End If End If '下 If i < DUIITEM_ROW Then If (DuiItems(i + 1, j + 1).ct = DuiItems(i, j).ct) Then DuiItems(i + 1, j + 1).arow = ClickArow.Up Return DuiItems(i + 1, j + 1) End If End If End If End If '与下间隔两连 If i < DUIITEM_ROW - 1 Then If DuiItems(i, j).ct = DuiItems(i + 2, j).ct And DuiItems(i, j).ct <> DuiItemType.No Then '左 If j > 0 Then If (DuiItems(i + 1, j - 1).ct = DuiItems(i, j).ct) Then DuiItems(i + 1, j - 1).arow = ClickArow.Right Return DuiItems(i + 1, j - 1) End If End If '下 If j < DUIITEM_COL Then If (DuiItems(i + 1, j + 1).ct = DuiItems(i, j).ct) Then DuiItems(i + 1, j + 1).arow = ClickArow.Left Return DuiItems(i + 1, j + 1) End If End If End If End If Next Next Catch ex As Exception End Try Dim result As DuiItem result.ct = DuiItemType.No Return result End FunctionPrivate Sub InitDuiItems() Dim color1 As Integer Dim color2 As Integer For i As Integer = 0 To DUIITEM_ROW For j As Integer = 0 To DUIITEM_COL With DuiItems(i, j) .x = GAME_TABLE_LEFT + j * DUIITEM_WIDTH + POINT_POS_LEFT_1 .y = GAME_TABLE_TOP + i * DUIITEM_HEIGHT + POINT_POS_TOP color1 = GetPixelColor(.x, .y) color2 = GetPixelColor(.x + POINT_POS_LEFT_2 - POINT_POS_LEFT_1, .y) If color1 = CAT_POINT1_COLOR And color2 = CAT_POINT2_COLOR Then .ct = DuiItemType.Cat ElseIf color1 = CHICKEN_POINT1_COLOR And color2 = CHICKEN_POINT2_COLOR Then .ct = DuiItemType.Chicken ElseIf color1 = FOX_POINT1_COLOR And color2 = FOX_POINT2_COLOR Then .ct = DuiItemType.Fox ElseIf color1 = FROG_POINT1_COLOR And color2 = FROG_POINT2_COLOR Then .ct = DuiItemType.Frog ElseIf color1 = MONKEY_POINT1_COLOR And color2 = MONKEY_POINT2_COLOR Then .ct = DuiItemType.Monkey ElseIf color1 = PANDA_POINT1_COLOR And color2 = PANDA_POINT2_COLOR Then .ct = DuiItemType.Panda ElseIf color1 = COW_POINT1_COLOR And color2 = COW_POINT2_COLOR Then .ct = DuiItemType.Cow Else .ct = DuiItemType.No End If End With Next Next End Sub '在默认情况下,对对碰游戏对鼠标输入进行了检测,如果为模拟输入则会忽略掉,所以如果不修改内存则调用MouseClick无效 '这里就是修改对对碰 &H408520 地址,将其检测鼠标的指令cmp eac,0x166d5c9改为cmp eax,eax加三条空指令nop,nop,nop Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim pArray As Process() = Process.GetProcessesByName("twin") If pArray.Length = 0 Then MsgBox(GAME_WINDOW_TITLE & "没有运行") Exit Sub End If Dim pReader As New ProcessMemoryReaderLib.ProcessMemoryReader pReader.ReadProcess = pArray(0) pReader.OpenProcess() Dim writeBytes As Integer Dim buffer() As Byte = {&H39, &HC0, &H90, &H90, &H90} pReader.WriteProcessMemory(New IntPtr(BASE), buffer, writeBytes) pReader.CloseHandle() End SubEnd Class
WinAPIHelper(C# 项目)提供一些API的封装Win32.csusing System;
using System.Runtime.InteropServices;namespace WinAPIHelper
{
public class Consts
{
private Consts()
{
} public const int MK_LBUTTON = 0x1;
public const int MK_MBUTTON = 0x10;
public const int MK_RBUTTON = 0x2; public const int MOUSEEVENTF_ABSOLUTE = 0x8000;
public const int MOUSEEVENTF_LEFTDOWN = 0x2;
public const int MOUSEEVENTF_LEFTUP = 0x4;
public const int MOUSEEVENTF_MIDDLEDOWN = 0x20;
public const int MOUSEEVENTF_MIDDLEUP = 0x40;
public const int MOUSEEVENTF_MOVE = 0x1;
public const int MOUSEEVENTF_RIGHTDOWN = 0x8;
public const int MOUSEEVENTF_RIGHTUP = 0x10; public const int HWND_NOTOPMOST = -2;
public const int HWND_TOPMOST = -1;
public const int SWP_NOSIZE = 0x1;
public const int SWP_NOMOVE = 0x2; public const int STANDARD_RIGHTS_REQUIRED = 0xF0000;
public const int SYNCHRONIZE = 0x100000;
public const int SPECIFIC_RIGHTS_ALL = 0xFFFF;
public const int STANDARD_RIGHTS_ALL = 0x1F0000; public const int PAGE_EXECUTE_READ = 0x20;
public const int PAGE_EXECUTE_READWRITE = 0x40;
} public class Types
{
private Types()
{
} [StructLayout(LayoutKind.Sequential)]
public struct POINTAPI
{
public int x;
public int y;
}
} public class Declares
{
private Declares()
{
}
[DllImport("user32.dll", EntryPoint="FindWindow")]
public static extern int FindWindow (
string lpClassName,
string lpWindowName
); [DllImport("user32.dll", EntryPoint="SetWindowPos")]
public static extern int SetWindowPos (
int hwnd,
int hWndInsertAfter,
int x,
int y,
int cx,
int cy,
int wFlags
); [DllImport("user32.dll", EntryPoint="mouse_event")]
public static extern void mouse_event (
int dwFlags,
int dx,
int dy,
int cButtons,
int dwExtraInfo
); [DllImport("user32.dll", EntryPoint="GetDC")]
public static extern int GetDC (
int hwnd
); [DllImport("gdi32.dll", EntryPoint="GetPixel")]
public static extern int GetPixel (
int hdc,
int x,
int y
); [DllImport("user32.dll", EntryPoint="ReleaseDC")]
public static extern int ReleaseDC (
int hwnd,
int hdc
); [DllImport("user32.dll", EntryPoint="GetCursorPos")]
public static extern int GetCursorPos (
ref Types.POINTAPI lpPoint
); [DllImport("user32.dll", EntryPoint="SetCursorPos")]
public static extern int SetCursorPos (
int x,
int y
); [DllImport("kernel32.dll", EntryPoint="WriteProcessMemory")]
public static extern int WriteProcessMemory (
int hProcess,
ref int lpBaseAddress,
ref int lpBuffer,
int nSize,
ref int lpNumberOfBytesWritten
); [DllImport("kernel32.dll", EntryPoint="WriteProcessMemory")]
public static extern int WriteProcessMemory (
int hProcess,
ref int lpBaseAddress,
ref char[] lpBuffer,
int nSize,
ref int lpNumberOfBytesWritten
); [DllImport("kernel32.dll", EntryPoint="ReadProcessMemory")]
public static extern int ReadProcessMemory (
int hProcess,
ref int lpBaseAddress,
ref int lpBuffer,
int nSize,
ref int lpNumberOfBytesWritten
); [DllImport("kernel32.dll", EntryPoint="ReadProcessMemory")]
public static extern int ReadProcessMemory (
int hProcess,
ref int lpBaseAddress,
ref byte[] lpBuffer,
int nSize,
ref int lpNumberOfBytesWritten
); [DllImport("kernel32.dll", EntryPoint="ReadProcessMemory")]
public static extern int ReadProcessMemory (
int hProcess,
ref int lpBaseAddress,
ref byte lpBuffer,
int nSize,
ref int lpNumberOfBytesWritten
); [DllImport("user32.dll", EntryPoint="GetWindowThreadProcessId")]
public static extern int GetWindowThreadProcessId (
int hwnd,
ref int lpdwProcessId
); [DllImport("kernel32.dll", EntryPoint="OpenProcess")]
public static extern int OpenProcess (
int dwDesiredAccess,
int bInheritHandle,
int dwProcessId
); [DllImport("kernel32.dll", EntryPoint="CloseHandle")]
public static extern int CloseHandle (
int hObject
); [DllImport("user32.dll", EntryPoint="GetMessageExtraInfo")]
public static extern int GetMessageExtraInfo (); [DllImport("kernel32.dll", EntryPoint="VirtualProtectEx")]
public static extern int VirtualProtectEx (
int hProcess,
ref int lpAddress,
int dwSize,
int flNewProtect,
ref int lpflOldProtect
); [DllImport("kernel32.dll", EntryPoint="GetModuleHandle")]
public static extern int GetModuleHandle (
string lpModuleName
); [DllImport("user32.dll", EntryPoint="SendMessage")]
public static extern int SendMessage (
int hwnd,
int wMsg,
int wParam,
ref int lParam
); }
}
using System.Diagnostics;
using System.Runtime.InteropServices;namespace ProcessMemoryReaderLib
{
class ProcessMemoryReaderApi
{
[Flags]
public enum ProcessAccessType
{
PROCESS_TERMINATE = (0x0001),
PROCESS_CREATE_THREAD = (0x0002),
PROCESS_SET_SESSIONID = (0x0004),
PROCESS_VM_OPERATION = (0x0008),
PROCESS_VM_READ = (0x0010),
PROCESS_VM_WRITE = (0x0020),
PROCESS_DUP_HANDLE = (0x0040),
PROCESS_CREATE_PROCESS = (0x0080),
PROCESS_SET_QUOTA = (0x0100),
PROCESS_SET_INFORMATION = (0x0200),
PROCESS_QUERY_INFORMATION = (0x0400)
}
[DllImport("kernel32.dll")]
public static extern IntPtr OpenProcess(UInt32 dwDesiredAccess, Int32 bInheritHandle, UInt32 dwProcessId); [DllImport("kernel32.dll")]
public static extern Int32 CloseHandle(IntPtr hObject); [DllImport("kernel32.dll")]
public static extern Int32 ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress,[In, Out] byte[] buffer, int size, out IntPtr lpNumberOfBytesRead);
[DllImport("kernel32.dll")]
public static extern Int32 WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress,[In, Out] byte[] buffer, int size, out IntPtr lpNumberOfBytesWritten);
} public class ProcessMemoryReader
{ public ProcessMemoryReader()
{
}
public Process ReadProcess
{
get
{
return m_ReadProcess;
}
set
{
m_ReadProcess = value;
}
} private Process m_ReadProcess = null; private IntPtr m_hProcess = IntPtr.Zero; public void OpenProcess()
{
// m_hProcess = ProcessMemoryReaderApi.OpenProcess(ProcessMemoryReaderApi.PROCESS_VM_READ, 1, (uint)m_ReadProcess.Id);
ProcessMemoryReaderApi.ProcessAccessType access;
access = ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_READ
| ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_WRITE
| ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_OPERATION;
m_hProcess = ProcessMemoryReaderApi.OpenProcess((uint)access, 1, (uint)m_ReadProcess.Id);
} public void CloseHandle()
{
int iRetValue;
iRetValue = ProcessMemoryReaderApi.CloseHandle(m_hProcess);
if (iRetValue == 0)
throw new Exception("CloseHandle failed");
} public byte[] ReadProcessMemory(IntPtr MemoryAddress, int bytesToRead, out int bytesRead)
{
byte[] buffer = new byte[bytesToRead];
IntPtr ptrBytesRead;
ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess,MemoryAddress,buffer ,bytesToRead,out ptrBytesRead);
bytesRead = ptrBytesRead.ToInt32(); return buffer;
} public void WriteProcessMemory(IntPtr MemoryAddress, byte[] bytesToWrite ,out int bytesWritten)
{
IntPtr ptrBytesWritten;
ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess,MemoryAddress,bytesToWrite,bytesToWrite.Length,out ptrBytesWritten);
bytesWritten = ptrBytesWritten.ToInt32();
}
}
}
Imports WinAPIHelper.Declares
Imports WinAPIHelper.Consts
Imports WinAPIHelper.TypesPublic Class Form1
Inherits System.Windows.Forms.Form#Region " Windows 窗体设计器生成的代码 " Public Sub New()
MyBase.New() '该调用是 Windows 窗体设计器所必需的。
InitializeComponent() '在 InitializeComponent() 调用之后添加任何初始化 End Sub '窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub 'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer '注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents NumericUpDown1 As System.Windows.Forms.NumericUpDown
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Timer1 As System.Timers.Timer
Friend WithEvents Button2 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.NumericUpDown1 = New System.Windows.Forms.NumericUpDown
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Timer1 = New System.Timers.Timer
Me.Button2 = New System.Windows.Forms.Button
CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Timer1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(8, 112)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(88, 40)
Me.Button1.TabIndex = 0
Me.Button1.Text = "启动"
'
'NumericUpDown1
'
Me.NumericUpDown1.Location = New System.Drawing.Point(8, 32)
Me.NumericUpDown1.Maximum = New Decimal(New Integer() {100000, 0, 0, 0})
Me.NumericUpDown1.Minimum = New Decimal(New Integer() {10, 0, 0, 0})
Me.NumericUpDown1.Name = "NumericUpDown1"
Me.NumericUpDown1.Size = New System.Drawing.Size(56, 21)
Me.NumericUpDown1.TabIndex = 1
Me.NumericUpDown1.Value = New Decimal(New Integer() {100, 0, 0, 0})
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(8, 8)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(79, 17)
Me.Label1.TabIndex = 2
Me.Label1.Text = "扫描间隔时间"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(72, 40)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(29, 17)
Me.Label2.TabIndex = 3
Me.Label2.Text = "毫秒"
'
'Timer1
'
Me.Timer1.Interval = 10
Me.Timer1.SynchronizingObject = Me
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(8, 64)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(88, 40)
Me.Button2.TabIndex = 4
Me.Button2.Text = "去除QQ反作弊"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(106, 175)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.NumericUpDown1)
Me.Controls.Add(Me.Button1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "Form1"
Me.Text = "对对碰工具"
Me.TopMost = True
CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Timer1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False) End Sub#End Region
Private Const FOX_POINT1_COLOR As Integer = 15187901
Private Const FOX_POINT2_COLOR As Integer = 13862016
Private Const PANDA_POINT1_COLOR As Integer = 0
Private Const PANDA_POINT2_COLOR As Integer = 5000268
Private Const CHICKEN_POINT1_COLOR As Integer = 5493503
Private Const CHICKEN_POINT2_COLOR As Integer = 1964541
Private Const CAT_POINT1_COLOR As Integer = 9539985
Private Const CAT_POINT2_COLOR As Integer = 14211288
Private Const FROG_POINT1_COLOR As Integer = 16777215
Private Const FROG_POINT2_COLOR As Integer = 16777215
Private Const MONKEY_POINT1_COLOR As Integer = 16777215
Private Const MONKEY_POINT2_COLOR As Integer = 6733055
Private Const COW_POINT1_COLOR As Integer = 8447487
Private Const COW_POINT2_COLOR As Integer = 11382961 Private Const DUIITEM_ROW As Integer = 7
Private Const DUIITEM_COL As Integer = 7
Private Const DUIITEM_WIDTH As Integer = 48
Private Const DUIITEM_HEIGHT As Integer = 48 Private Const GAME_WINDOW_LEFT As Integer = 0
Private Const GAME_WINDOW_TOP As Integer = 0
Private Const GAME_TABLE_LEFT As Integer = GAME_WINDOW_LEFT + 175
Private Const GAME_TABLE_TOP As Integer = GAME_WINDOW_TOP + 101
Private Const POINT_POS_LEFT_1 As Integer = 15
Private Const POINT_POS_LEFT_2 As Integer = 30
Private Const POINT_POS_TOP As Integer = 20
Private Const GAME_WINDOW_TITLE As String = "对对碰" '"对对碰" Private Const BASE As Integer = &H408520 ' Public Enum DuiItemType
No
Fox
Panda
Chicken
Cat
Frog
Monkey
Cow
End Enum Public Enum ClickArow
Up
Down
Left
Right
End Enum Public Structure DuiItem
Dim x As Integer
Dim y As Integer
Dim ct As DuiItemType '单元类型
Dim arow As ClickArow '与该单元格互换的单元格所在的方向
End Structure Private DuiItems(DUIITEM_ROW, DUIITEM_COL) As DuiItem
Private g_hwnd As Integer = 0
Private screenWidth As Integer
Private screenHeight As Integer Private Function GetPixelColor(ByVal x As Integer, ByVal y As Integer) As Integer
Dim color As Integer
If g_hwnd <> 0 Then
Dim dc As Integer
dc = GetDC(0)
color = GetPixel(dc, x, y)
ReleaseDC(g_hwnd, dc)
End If
Return color
End Function Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim desktopSize As Size
desktopSize = System.Windows.Forms.SystemInformation.PrimaryMonitorSize
screenHeight = desktopSize.Height
screenWidth = desktopSize.Width
End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Me.Button1.Text = "启动" Then
Me.Timer1.Interval = Me.NumericUpDown1.Value
Me.Timer1.Start()
Me.NumericUpDown1.Enabled = False
Me.Button1.Text = "停止"
Else
Me.Timer1.Stop()
Me.NumericUpDown1.Enabled = True
Me.Button1.Text = "启动"
End If
End Sub
g_hwnd = FindWindow(vbNullString, GAME_WINDOW_TITLE)
If g_hwnd <> 0 Then
Me.Timer1.Stop()
SetWindowPos(g_hwnd, HWND_TOPMOST, GAME_WINDOW_LEFT, GAME_WINDOW_TOP, 0, 0, SWP_NOSIZE)
InitDuiItems() '获取当前图片中所有单元格
Dim c As DuiItem = GetDuiItem() '获取符合交换条件的单元格
If c.ct <> DuiItemType.No Then
'获取成功后模拟点击鼠标进行图片交换
Dim x As Integer = c.x
Dim y As Integer = c.y MouseClick(x, y) Select Case c.arow
Case ClickArow.Down
y = y + DUIITEM_HEIGHT
Case ClickArow.Left
x = x - DUIITEM_WIDTH
Case ClickArow.Right
x = x + DUIITEM_WIDTH
Case ClickArow.Up
y = y - DUIITEM_HEIGHT
End Select MouseClick(x, y)
System.Threading.Thread.Sleep(Me.NumericUpDown1.Value)
End If
Me.Timer1.Start()
End If
End Sub '模拟鼠标点击
Public Sub MouseClick(ByVal x As Integer, ByVal y As Integer) Dim p As POINTAPI GetCursorPos(p) mouse_event(MOUSEEVENTF_MOVE Or MOUSEEVENTF_ABSOLUTE, 65535 * x / screenWidth, 65535 * y / screenHeight, 0, GetMessageExtraInfo())
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, GetMessageExtraInfo())
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, GetMessageExtraInfo()) SetCursorPos(p.x, p.y) End Sub Private Function GetDuiItem() As DuiItem
Dim i As Integer
Dim j As Integer
Try
For i = 0 To DUIITEM_ROW - 1
For j = 0 To DUIITEM_COL - 1
'与右边两连
If DuiItems(i, j).ct = DuiItems(i, j + 1).ct And DuiItems(i, j).ct <> DuiItemType.No Then
'左
If j > 1 Then
If (DuiItems(i, j - 2).ct = DuiItems(i, j).ct) Then
DuiItems(i, j - 2).arow = ClickArow.Right
Return DuiItems(i, j - 2)
End If
End If
'左上
If i > 0 And j > 0 Then
If (DuiItems(i - 1, j - 1).ct = DuiItems(i, j).ct) Then
DuiItems(i - 1, j - 1).arow = ClickArow.Down
Return DuiItems(i - 1, j - 1)
End If
End If
'左下
If i < DUIITEM_ROW And j > 0 Then
If (DuiItems(i + 1, j - 1).ct = DuiItems(i, j).ct) Then
DuiItems(i + 1, j - 1).arow = ClickArow.Up
Return DuiItems(i + 1, j - 1)
End If
End If
'右
If j < DUIITEM_COL - 2 Then
If (DuiItems(i, j + 3).ct = DuiItems(i, j).ct) Then
DuiItems(i, j + 3).arow = ClickArow.Left
Return DuiItems(i, j + 3)
End If
End If
'右上
If i > 0 And j < DUIITEM_COL - 1 Then
If (DuiItems(i - 1, j + 2).ct = DuiItems(i, j).ct) Then
DuiItems(i - 1, j + 2).arow = ClickArow.Down
Return DuiItems(i - 1, j + 2)
End If
End If
'右下
If i < DUIITEM_ROW And j < DUIITEM_COL - 1 Then
If (DuiItems(i + 1, j + 2).ct = DuiItems(i, j).ct) Then
DuiItems(i + 1, j + 2).arow = ClickArow.Up
Return DuiItems(i + 1, j + 2)
End If
End If
End If
If DuiItems(i, j).ct = DuiItems(i + 1, j).ct And DuiItems(i, j).ct <> DuiItemType.No Then
'上
If i > 1 Then
If (DuiItems(i - 2, j).ct = DuiItems(i, j).ct) Then
DuiItems(i - 2, j).arow = ClickArow.Down
Return DuiItems(i - 2, j)
End If
End If
'上左
If i > 0 And j > 0 Then
If (DuiItems(i - 1, j - 1).ct = DuiItems(i, j).ct) Then
DuiItems(i - 1, j - 1).arow = ClickArow.Right
Return DuiItems(i - 1, j - 1)
End If
End If
'上右
If i > 0 And j < DUIITEM_COL - 1 Then
If (DuiItems(i - 1, j + 1).ct = DuiItems(i, j).ct) Then
DuiItems(i - 1, j + 1).arow = ClickArow.Left
Return DuiItems(i - 1, j + 1)
End If
End If
'下
If i < DUIITEM_ROW - 2 Then
If (DuiItems(i + 3, j).ct = DuiItems(i, j).ct) Then
DuiItems(i + 3, j).arow = ClickArow.Up
Return DuiItems(i + 3, j)
End If
End If
'下左
If i < DUIITEM_ROW - 1 And j > 0 Then
If (DuiItems(i + 2, j - 1).ct = DuiItems(i, j).ct) Then
DuiItems(i + 2, j - 1).arow = ClickArow.Right
Return DuiItems(i + 2, j - 1)
End If
End If
'下右
If i < DUIITEM_ROW - 1 And j < DUIITEM_COL - 1 Then
If (DuiItems(i + 2, j + 1).ct = DuiItems(i, j).ct) Then
DuiItems(i + 2, j + 1).arow = ClickArow.Left
Return DuiItems(i + 2, j + 1)
End If
End If
End If
'与右间隔两连
If j < DUIITEM_COL - 1 Then
If DuiItems(i, j).ct = DuiItems(i, j + 2).ct And DuiItems(i, j).ct <> DuiItemType.No Then
'上
If i > 0 Then
If (DuiItems(i - 1, j + 1).ct = DuiItems(i, j).ct) Then
DuiItems(i - 1, j + 1).arow = ClickArow.Down
Return DuiItems(i - 1, j + 1)
End If
End If
'下
If i < DUIITEM_ROW Then
If (DuiItems(i + 1, j + 1).ct = DuiItems(i, j).ct) Then
DuiItems(i + 1, j + 1).arow = ClickArow.Up
Return DuiItems(i + 1, j + 1)
End If
End If
End If
End If
'与下间隔两连
If i < DUIITEM_ROW - 1 Then
If DuiItems(i, j).ct = DuiItems(i + 2, j).ct And DuiItems(i, j).ct <> DuiItemType.No Then
'左
If j > 0 Then
If (DuiItems(i + 1, j - 1).ct = DuiItems(i, j).ct) Then
DuiItems(i + 1, j - 1).arow = ClickArow.Right
Return DuiItems(i + 1, j - 1)
End If
End If
'下
If j < DUIITEM_COL Then
If (DuiItems(i + 1, j + 1).ct = DuiItems(i, j).ct) Then
DuiItems(i + 1, j + 1).arow = ClickArow.Left
Return DuiItems(i + 1, j + 1)
End If
End If
End If
End If
Next
Next
Catch ex As Exception End Try
Dim result As DuiItem
result.ct = DuiItemType.No
Return result
End FunctionPrivate Sub InitDuiItems()
Dim color1 As Integer
Dim color2 As Integer For i As Integer = 0 To DUIITEM_ROW
For j As Integer = 0 To DUIITEM_COL
With DuiItems(i, j)
.x = GAME_TABLE_LEFT + j * DUIITEM_WIDTH + POINT_POS_LEFT_1
.y = GAME_TABLE_TOP + i * DUIITEM_HEIGHT + POINT_POS_TOP
color1 = GetPixelColor(.x, .y)
color2 = GetPixelColor(.x + POINT_POS_LEFT_2 - POINT_POS_LEFT_1, .y)
If color1 = CAT_POINT1_COLOR And color2 = CAT_POINT2_COLOR Then
.ct = DuiItemType.Cat
ElseIf color1 = CHICKEN_POINT1_COLOR And color2 = CHICKEN_POINT2_COLOR Then
.ct = DuiItemType.Chicken
ElseIf color1 = FOX_POINT1_COLOR And color2 = FOX_POINT2_COLOR Then
.ct = DuiItemType.Fox
ElseIf color1 = FROG_POINT1_COLOR And color2 = FROG_POINT2_COLOR Then
.ct = DuiItemType.Frog
ElseIf color1 = MONKEY_POINT1_COLOR And color2 = MONKEY_POINT2_COLOR Then
.ct = DuiItemType.Monkey
ElseIf color1 = PANDA_POINT1_COLOR And color2 = PANDA_POINT2_COLOR Then
.ct = DuiItemType.Panda
ElseIf color1 = COW_POINT1_COLOR And color2 = COW_POINT2_COLOR Then
.ct = DuiItemType.Cow
Else
.ct = DuiItemType.No
End If
End With
Next
Next
End Sub '在默认情况下,对对碰游戏对鼠标输入进行了检测,如果为模拟输入则会忽略掉,所以如果不修改内存则调用MouseClick无效
'这里就是修改对对碰 &H408520 地址,将其检测鼠标的指令cmp eac,0x166d5c9改为cmp eax,eax加三条空指令nop,nop,nop
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim pArray As Process() = Process.GetProcessesByName("twin")
If pArray.Length = 0 Then
MsgBox(GAME_WINDOW_TITLE & "没有运行")
Exit Sub
End If Dim pReader As New ProcessMemoryReaderLib.ProcessMemoryReader
pReader.ReadProcess = pArray(0)
pReader.OpenProcess()
Dim writeBytes As Integer Dim buffer() As Byte = {&H39, &HC0, &H90, &H90, &H90}
pReader.WriteProcessMemory(New IntPtr(BASE), buffer, writeBytes)
pReader.CloseHandle() End SubEnd Class
public static extern Int32 ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress,[In, Out] byte[] buffer, int size, out IntPtr lpNumberOfBytesRead);[DllImport("kernel32.dll")]
public static extern Int32 WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress,[In, Out] byte[] buffer, int size, out IntPtr lpNumberOfBytesWritten);主要这两个函数我在vb里面始终定义不出来,所以用C#包装了一下
http://www.czvc.com/bbs/它支持最大附件160KB
好人有好报!===============================
CSDN小助手 是一款脱离浏览器也可以使用csdn论坛的
软件!
界面: http://qqwwee.com/
下载: http://qqwwee.com/csdn.rar 包含源代码