【原创】VB超强游戏外挂帮助类,封装了很多方法
''' <summary>
''' a very nice file that can be used on other projects
''' </summary>
''' <remarks></remarks> Module ReadWritingMemory
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer Private Declare Function WriteProcessMemory1 Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Private Declare Function WriteProcessMemory2 Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Single, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Single
Private Declare Function WriteProcessMemory3 Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Long, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Long Private Declare Function ReadProcessMemory1 Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Private Declare Function ReadProcessMemory2 Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Single, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Single
Private Declare Function ReadProcessMemory3 Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Long, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Long Const PROCESS_ALL_ACCESS = &H1F0FF Public Function WriteDMAInteger(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Value As Integer, ByVal Level As Integer, Optional ByVal nsize As Integer = 4) As Boolean
Try
Dim lvl As Integer = Address
For i As Integer = 1 To Level
lvl = ReadInteger(Process, lvl, nsize) + Offsets(i - 1)
Next
WriteInteger(Process, lvl, Value, nsize)
Return True
Catch ex As Exception
Return False
End Try
End Function Public Function ReadDMAInteger(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Level As Integer, Optional ByVal nsize As Integer = 4) As Integer
Try
Dim lvl As Integer = Address
For i As Integer = 1 To Level
lvl = ReadInteger(Process, lvl, nsize) + Offsets(i - 1)
Next
Dim vBuffer As Integer
vBuffer = ReadInteger(Process, lvl, nsize)
Return vBuffer
Catch ex As Exception End Try
End Function Public Function WriteDMAFloat(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Value As Single, ByVal Level As Integer, Optional ByVal nsize As Integer = 4) As Boolean
Try
Dim lvl As Integer = Address
For i As Integer = 1 To Level
lvl = ReadInteger(Process, lvl, nsize) + Offsets(i - 1)
Next
WriteFloat(Process, lvl, Value, nsize)
Return True
Catch ex As Exception
Return False
End Try
End Function Public Function ReadDMAFloat(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Level As Integer, Optional ByVal nsize As Integer = 4) As Single
Try
Dim lvl As Integer = Address
For i As Integer = 1 To Level
lvl = ReadFloat(Process, lvl, nsize) + Offsets(i - 1)
Next
Dim vBuffer As Single
vBuffer = ReadFloat(Process, lvl, nsize)
Return vBuffer
Catch ex As Exception End Try
End Function Public Function WriteDMALong(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Value As Long, ByVal Level As Integer, Optional ByVal nsize As Integer = 4) As Boolean
Try
Dim lvl As Integer = Address
For i As Integer = 1 To Level
lvl = ReadLong(Process, lvl, nsize) + Offsets(i - 1)
Next
WriteLong(Process, lvl, Value, nsize)
Return True
Catch ex As Exception
Return False
End Try
End Function Public Function ReadDMALong(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Level As Integer, Optional ByVal nsize As Integer = 4) As Long
Try
Dim lvl As Integer = Address
For i As Integer = 1 To Level
lvl = ReadLong(Process, lvl, nsize) + Offsets(i - 1)
Next
Dim vBuffer As Long
vBuffer = ReadLong(Process, lvl, nsize)
Return vBuffer
Catch ex As Exception End Try
End Function Public Sub WriteNOPs(ByVal ProcessName As String, ByVal Address As Long, ByVal NOPNum As Integer)
Dim C As Integer
Dim B As Integer
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Sub
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Sub
End If B = 0
For C = 1 To NOPNum
Call WriteProcessMemory1(hProcess, Address + B, &H90, 1, 0&)
B = B + 1
Next C
End Sub Public Sub WriteXBytes(ByVal ProcessName As String, ByVal Address As Long, ByVal Value As String)
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Sub
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Sub
End If Dim C As Integer
Dim B As Integer
Dim D As Integer
Dim V As Byte B = 0
D = 1
For C = 1 To Math.Round((Len(Value) / 2))
V = Val("&H" & Mid$(Value, D, 2))
Call WriteProcessMemory1(hProcess, Address + B, V, 1, 0&)
B = B + 1
D = D + 2
Next C End Sub Public Sub WriteInteger(ByVal ProcessName As String, ByVal Address As Integer, ByVal Value As Integer, Optional ByVal nsize As Integer = 4)
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Sub
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Sub
End If Dim hAddress, vBuffer As Integer
hAddress = Address
vBuffer = Value
WriteProcessMemory1(hProcess, hAddress, CInt(vBuffer), nsize, 0)
End Sub Public Sub WriteFloat(ByVal ProcessName As String, ByVal Address As Integer, ByVal Value As Single, Optional ByVal nsize As Integer = 4)
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Sub
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Sub
End If Dim hAddress As Integer
Dim vBuffer As Single hAddress = Address
vBuffer = Value
WriteProcessMemory2(hProcess, hAddress, vBuffer, nsize, 0)
End Sub Public Sub WriteLong(ByVal ProcessName As String, ByVal Address As Integer, ByVal Value As Long, Optional ByVal nsize As Integer = 4)
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Sub
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Sub
End If Dim hAddress As Integer
Dim vBuffer As Long hAddress = Address
vBuffer = Value
WriteProcessMemory3(hProcess, hAddress, vBuffer, nsize, 0)
End Sub Public Function ReadInteger(ByVal ProcessName As String, ByVal Address As Integer, Optional ByVal nsize As Integer = 4) As Integer
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Function
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Function
End If Dim hAddress, vBuffer As Integer
hAddress = Address
ReadProcessMemory1(hProcess, hAddress, vBuffer, nsize, 0)
Return vBuffer
End Function Public Function ReadFloat(ByVal ProcessName As String, ByVal Address As Integer, Optional ByVal nsize As Integer = 4) As Single
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Function
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Function
End If Dim hAddress As Integer
Dim vBuffer As Single hAddress = Address
ReadProcessMemory2(hProcess, hAddress, vBuffer, nsize, 0)
Return vBuffer
End Function Public Function ReadLong(ByVal ProcessName As String, ByVal Address As Integer, Optional ByVal nsize As Integer = 4) As Long
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Function
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Function
End If Dim hAddress As Integer
Dim vBuffer As Long hAddress = Address
ReadProcessMemory3(hProcess, hAddress, vBuffer, nsize, 0)
Return vBuffer
End Function End Module
【原创】VB超强游戏外挂帮助类,封装了很多方法的更多相关文章
- Linux socket 类封装 (面向对象方法)
/* * socketfactory.h * * Created on: 2014-7-19 * Author: root */ #ifndef SOCKETFACTORY_H_ #define SO ...
- .Net Core ORM选择之路,哪个才适合你 通用查询类封装之Mongodb篇 Snowflake(雪花算法)的JavaScript实现 【开发记录】如何在B/S项目中使用中国天气的实时天气功能 【开发记录】微信小游戏开发入门——俄罗斯方块
.Net Core ORM选择之路,哪个才适合你 因为老板的一句话公司项目需要迁移到.Net Core ,但是以前同事用的ORM不支持.Net Core 开发过程也遇到了各种坑,插入条数多了也特别 ...
- 一步步用python制作游戏外挂【转】
转自:http://www.cnblogs.com/xsmhero/archive/2013/01/03/2842973.html 玩过电脑游戏的同学对于外挂肯定不陌生,但是你在用外挂的时候有没有想过 ...
- (转载) 百度地图工具类封装(包括定位,附近、城市、范围poi检索,反地理编码)
目录视图 摘要视图 订阅 赠书 | 异步2周年,技术图书免费选 程序员8月书讯 项目管理+代码托管+文档协作,开发更流畅 百度地图工具类封装(包括定位,附近.城市.范围poi检索, ...
- Python论做游戏外挂,Python输过谁?
玩过电脑游戏的同学对于外挂肯定不陌生,但是你在用外挂的时候有没有想过如何做一个外挂呢? 我打开了4399小游戏网,点开了一个不知名的游戏,唔,做寿司的,有材料在一边,客人过来后说出他们的要求,你按照菜 ...
- salesforce 零基础学习(四十八)自定义列表分页之Pagination基类封装 ※※※
我们知道,salesforce中系统标准列表页面提供了相应的分页功能,如果要使用其分页功能,可以访问http://www.cnblogs.com/zero-zyq/p/5343287.html查看相关 ...
- 【Unity3D】Unity3D之 注册表动态存取游戏存档——PlayerPrefs类
[Unity3D]Unity3D之 注册表动态存取游戏存档--PlayerPrefs类 1.Unity3D提供了一个用于本地持久化保存与读取的类--PlayerPrefs.工作原理非常简单,以键值对的 ...
- Redis操作Set工具类封装,Java Redis Set命令封装
Redis操作Set工具类封装,Java Redis Set命令封装 >>>>>>>>>>>>>>>>& ...
- Redis操作List工具类封装,Java Redis List命令封装
Redis操作List工具类封装,Java Redis List命令封装 >>>>>>>>>>>>>>>> ...
随机推荐
- 长沙雅礼中学集训-------------------day3
今天的收获还是蛮大的,终于体会了一波在知识的海洋中遨游的美滋滋的快感. T1:给你N个点的位置和他们的速度,这些点向一个方向移动,求前M次超越者的集合A和被超越者的集合B(集合为这些点的速度),以及从 ...
- Linux系统查看系统硬件配置信息
1.查看CPU信息 # 查看cpu负载 uptime # cpu使用率 (没有sar 则yum -y install sysstat) sar top bn1 |grep %Cpu # 每个cpu使用 ...
- CSS3 圆角属性 border-radius和-webkit-border-radius使用
CSS3 圆角属性 border-radius 在 CSS3 中新增了一个 border-radius 边框半径属性,即大家常用的圆角效果.这使得制作圆角将不再麻烦,只需对所用对象加一个 border ...
- 经典算法 BFPRT算法详解
内容: 1.原始问题 => O(N*logN) 2.BFPRT算法 => O(N) 1.原始问题 问题描述:给你一个整型数组,返回其中第K小的数 普通解法: 这道题可以利用 ...
- Java内存原型分析:基本知识
转载: Java内存原型分析:基本知识 java虚拟机内存原型 寄存器:我们在程序中无法控制 栈:存放基本类型的数据和对象的引用,但对象本身不存放在栈中,而是存放在堆中 堆:存放用new产生的数据 静 ...
- 知识picture
- 代码: 日期和时间 datepicker
bootstrap 的相关的时间插件 http://www.bootcss.com/p/bootstrap-datetimepicker/ jquery ui的日期插件 http://www.w3cs ...
- 使用Apache POI处理excel公式不更新的解决办法
使用poi更新excel时,如果单元格A设置了公式,当其依赖的其他单元格填充了值之后,导出的excel中A仍为公式而不是自动计算的值,如图: Paste_Image.png 分值小计没有更新成计算结果 ...
- 1.Redis的应用场景
转自:http://www.runoob.com/redis/redis-tutorial.html Redis开创了一种新的数据存储思路,使用Redis,我们不用在面对功能单调的数据库时,把精力放在 ...
- Celery ---- 分布式队列神器 ---- 入门
原文:http://python.jobbole.com/87238/ 参考:https://zhuanlan.zhihu.com/p/22304455 Celery 是什么? Celery 是一个由 ...