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 
  • 相关阅读:
    て和で用法的总结
    假如程序员上热搜是什么样的?网友:毫无违和感!
    一年精通,三年熟悉,五年了解,十年用过!C++真的这么难吗?
    新手上路,“hello word”其实是在告诉计算机又有菜鸟来了!
    从原理到方法,一步到位,教你如何应对C语言内存泄露!
    冰冷的英语字母,枯燥的编程教程,果断选择了放弃!真的吗?
    只有了解程序员的黑话,和他们打成一片获得buff加成,产品才能尽早上线!
    C语言编程小游戏「石头剪刀布」!源码分享~
    一行代码卖出570美元,什么样的代码能这么值钱?带你揭秘天价代码的内幕!
    源码解剖HashMap
  • 原文地址:https://www.cnblogs.com/xxaxx/p/1655472.html
Copyright © 2011-2022 走看看