zoukankan      html  css  js  c++  java
  • 制作自己的修改器.

     1 Option Explicit 
     2 Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As StringAs Long 
     3 Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As LongAs Long 
     4 Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As LongAs Long 
     5 Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As LongAs Long 
     6 Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As LongAs Long 
     7 Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As LongAs Long 
     8 Private Const PROCESS_ALL_ACCESS = &H1F0FFF 
     9 Private hProcess As Long 
    10 '下面的函数用于查找游戏 
    11 Function FindGame() As Boolean 
    12 Dim PID As Long, Gamehwnd As Long 
    13 FindGame = False 
    14 Gamehwnd = FindWindow(vbNullString, "蜘蛛"'查找游戏的句柄 
    15 If (Gamehwnd = 0Then '如果找不到(例如游戏未运行)就退出函数 
    16 MsgBox "没有找到蜘蛛游戏" 
    17 Exit Function 
    18 End If 
    19 GetWindowThreadProcessId Gamehwnd, PID '取得进程ID 
    20 hProcess = OpenProcess(PROCESS_ALL_ACCESS, False, PID) '以全部权力打开进程 
    21 If (hProcess = 0Then '打开进程失败 
    22 MsgBox "没有打开进程" 
    23 Exit Function 
    24 End If 
    25 FindGame = True '成功!! 
    26 End Function 
    27 '回到VB的窗口设计模式,在窗体上放上两个按钮和一个文本框 
    28 '一个按钮为"读取"一个为"写入",分别用于读取和写入数据 
    29 '把Text1的Text设为空白 
    30 Private Sub Command1_Click() 
    31 Dim retV%, r& 
    32 'Dim retV%, r&=Dim retV As Integer, r As Long 
    33 If FindGame Then 
    34 = ReadProcessMemory(hProcess, &H1011F20, retV, 20'这里重要,&H1011F20为内存地址. 
    35 If r = 0 Then 
    36 MsgBox "读取内存不成功!" 
    37 Else 
    38 Text1 = retV 
    39 End If 
    40 End If 
    41 End Sub 
    42 
    43 Private Sub Command2_Click() 
    44 Dim r& 
    45 If FindGame Then 
    46 = WriteProcessMemory(hProcess, &H1011F20, CInt(Val(Text1)), 20
    47 '参数与上面的基本相同 
    48 'cInt(Val(Text1))是防止输入的过程有误,,例如,输入了字母,,如果不处理程序就会出错 
    49 If r = 0 Then 
    50 MsgBox "写内存不成功!" 
    51 Else 
    52 MsgBox "OK" 
    53 End If 
    54 End If 
    55 End Sub
    56 
  • 相关阅读:
    Oracle11g备份与恢复-手工备份与恢复
    undo段及区的状态和使用
    图解一个事务操作流程
    Oracle11g备份与恢复
    undo表空间概述-1
    事务的隔离级别
    事务概述
    系统改变号(SCN)详解
    实例崩溃恢复原理--检查点队列的作用
    Oracle-检查点队列
  • 原文地址:https://www.cnblogs.com/xxaxx/p/1655472.html
Copyright © 2011-2022 走看看