我爱秘籍论坛

 找回密码
 加入论坛

QQ登录

只需一步,快速开始

扫一扫,访问微社区

CE:最优秀的游戏修改工具入门:修改器制作傻瓜教程说说:你最想要找的修改器以前游戏玩我们,现在我们玩游戏
进阶:游戏修改视频教程导航必备:超2400款游戏秘籍下载:超5000款游戏修改器必读:论坛金币获得方法
查看: 1533645|回复: 247

[VB] VB实现CE的aobscan功能(代码已发)

  [复制链接]
发表于 2010-7-22 09:12:03 | 显示全部楼层 |阅读模式
本帖最后由 wxt51 于 2010-7-22 12:12 编辑

经过一晚上的努力,终于实现了CE的aobscan功能,稍后我会放出该函数的源代码
这是看大象做第四个视频那个音乐游戏后,想用VB实现CE的功能,
1.jpg
搜索字节数组,在ce中的命令是aobscan,用于搜索关键信息后用计算偏移量实现数据的修改,vb实现查找功能如下图
3.jpg
奶奶滴。累死俺了,弄了好几个小时
下面是程序代码,回复可见,哇哈哈哈 ,我太邪恶了



  1. '这里的东西写模块里面,具体怎么写,我不告诉你
  2. Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
  3. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  4. Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
  5. Private Declare Function GetProcessMemoryInfo Lib "PSAPI.DLL" (ByVal hProcess As Long, ppsmemCounters As PROCESS_MEMORY_COUNTERS, ByVal cb As Long) As Long
  6. Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
  7. Public Declare Function VirtualQueryEx Lib "kernel32" (ByVal hProcess As Long, ByVal lpAddress As Long, lpBuffer As MEMORY_BASIC_INFORMATION, ByVal dwLength As Long) As Long
  8. Public Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long

  9. Public Type MEMORY_BASIC_INFORMATION
  10. BaseAddress As Long
  11. AllocationBase As Long
  12. AllocationProtect As Long
  13. RegionSize As Long
  14. State As Long
  15. Protect As Long
  16. lType As Long
  17. End Type
  18. Type PROCESS_MEMORY_COUNTERS
  19. cb As Long
  20. PageFaultCount As Long
  21. PeakWorkingSetSize As Long
  22. WorkingSetSize As Long
  23. QuotaPeakPagedPoolUsage As Long
  24. QuotaPagedPoolUsage As Long
  25. QuotaPeakNonPagedPoolUsage As Long
  26. QuotaNonPagedPoolUsage As Long
  27. PagefileUsage As Long
  28. PeakPagefileUsage As Long
  29. End Type

  30. Public Function GetPid(lpClassName As String, lpWindowName As String) As Long
  31. GetWindowThreadProcessId FindWindow(lpClassName, lpWindowName), GetPid
  32. End Function

  33. Public Function GetMemoryByPID(ByVal Pid As Integer) As String
  34. Dim tPMC As PROCESS_MEMORY_COUNTERS
  35. Dim lProcessID
  36. Dim hProcess
  37. lProcessID = Pid
  38. hProcess = OpenProcess(&H1F0FFF, False, lProcessID)
  39. If (GetProcessMemoryInfo(hProcess, tPMC, Len(tPMC)) <> 0) Then
  40. GetMemoryByPID = Hex(tPMC.WorkingSetSize)
  41. End If
  42. CloseHandle hProcess
  43. End Function
复制代码

  1. '程序窗体定义一个局部变量
  2. Dim GamePid As String
  3. Dim Rst(2000000) As Long
  4. Private Sub Form_Load()
  5. GamePid = GetPid(vbNullString, "程序名写到这里,你知道的!")
  6. End Sub


  7. '把字节数组转换的函数
  8. Function Fz(Str As String) As String
  9. Dim a As String
  10. a = Replace(Str, " ", "")
  11. Dim i As Integer
  12. Dim b As String
  13. For i = Len(a) To 2 Step -2
  14. b = b & Mid(a, i - 1, 2)

  15. Next
  16. Fz = b
  17. End Function
复制代码


下面是关键搜索函数


  1. Function AobScan(Pid As String, ZJSZ As String) As String
  2. ReDim da(1023) As Byte
  3. Dim z As Long
  4. Dim zr As Long
  5. Dim Srge As Long
  6. Dim hpid As Long
  7. Dim Minf As MEMORY_BASIC_INFORMATION
  8. Dim Mbsize As Long
  9. Dim Dda(100) As Byte
  10. Dim Zfr As Long
  11. Dim Zed As Long
  12. Dim Siz As Integer
  13. Dim Csiz As Integer
  14. Dim Shsiz As Integer
  15. Dim Mlng As Long
  16. Mbsize = Len(Minf)
  17. Zfr = 0
  18. Zed = CLng("&H" & GetMemoryByPID(GamePid))
  19. LRsc = Rsc
  20. Rsc = -1
  21. Siz = 2
  22. Shsiz = 2
  23. mstr = Fz(ZJSZ)
  24. '循环看数组的长度,并转换成字节数组
  25. Dim i As Integer
  26. For i = Len(mstr) To 2 Step -2
  27. Dda((i / 2) - 1) = CInt("&h" & Mid$(mstr, Len(mstr) - i + 1, 2))
  28. Next
  29. hpid = OpenProcess(&H1F0FFF, False, CLng(Pid))
  30. z = Zfr '设置开始内存
  31. Do While z < Zed - 1 '判断是否小于结束内存
  32. ret = VirtualQueryEx(hpid, z, Minf, Mbsize) '查询地址空间中内存地址的信息
  33. If ret = 0 Then
  34. Srge = 1023
  35. zr = z
  36. Else
  37. Srge = Minf.RegionSize - 1
  38. zr = Minf.BaseAddress

  39. If (Minf.Protect And 4) And Minf.State = 4096 Then
  40. ReDim da(Srge) As Byte
  41. a = ReadProcessMemory(hpid, zr, da(0), Srge + 1, ByVal 0&)
  42. If a <> 0 Then
  43. For zz = 0 To Srge Step Shsiz
  44. If Srge - zz < Siz - 1 Then Exit For
  45. For bj = 0 To Siz - 1
  46. If da(zz + bj) <> Dda(bj) Then Exit For
  47. Next bj
  48. If bj = Siz Then Rsc = Rsc + 1: Rst(Rsc) = zr + zz
  49. Next zz
  50. End If
  51. End If

  52. End If
  53. z = zr + Srge + 1
  54. DoEvents
  55. Loop
  56. CloseHandle (hpid)
  57. AobScan = Hex$(Rst(0))
  58. End Function
复制代码



调用方法如下


  1. Private Sub Command3_Click()
  2.       MsgBox AobScan(GamePid, "1d 8e 25 00 19")
  3. End Sub
复制代码

评分

参与人数 3金币 +22 鲜花 +1 收起 理由
a12345678665 + 1 好阿!!
12345678 + 1 含金量挺高的
我爱秘籍 + 20 + 1 鼓励分享

查看全部评分

发表于 2015-2-18 15:46:52 | 显示全部楼层
好吧,下载没人上缴1个金币,我太邪恶了,晚上公布吧,还有好多需要优化一下,至于搜索的速度,,秒杀
回复 支持 反对

使用道具 举报

发表于 2013-6-29 16:54:26 | 显示全部楼层
支持楼主         
回复 支持 反对

使用道具 举报

发表于 2018-1-18 21:02:32 | 显示全部楼层

很好很强大,果然很强大,仰慕仰慕,
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-7-22 09:15:28 | 显示全部楼层
自己沙发吧,省的别人有强我的
发表于 2010-7-22 09:21:08 | 显示全部楼层
高手~
发表于 2010-7-22 09:23:59 | 显示全部楼层
很好很强大,果然很强大,仰慕仰慕,很强大
发表于 2010-7-22 09:29:30 | 显示全部楼层
好东西
发表于 2010-7-22 09:31:56 | 显示全部楼层
恩  不错
发表于 2010-7-22 10:02:58 | 显示全部楼层
不錯不錯  這樣我就不用找了=.=
 楼主| 发表于 2010-7-22 10:13:49 | 显示全部楼层
回复 7# 小白勝


    我在考虑是不是要收取点费用
发表于 2010-7-22 10:18:55 | 显示全部楼层
回复 8# wxt51


你辛苦找的  
都然是由你決定摟!!
 楼主| 发表于 2010-7-22 10:25:28 | 显示全部楼层
回复 9# 小白勝


    好吧,下载没人上缴1个金币,我太邪恶了,晚上公布吧,还有好多需要优化一下,至于搜索的速度,,秒杀
发表于 2010-7-22 10:35:18 | 显示全部楼层
回复 10# wxt51


哈哈!!
那我就等你發搂!!
发表于 2010-7-23 02:58:41 | 显示全部楼层
支持,我就是来学习的,呵呵
发表于 2010-7-23 03:17:07 | 显示全部楼层
看看学习一下
发表于 2010-7-23 09:51:55 | 显示全部楼层
看看

也学习下
发表于 2010-7-23 09:52:48 | 显示全部楼层
发表于 2010-7-29 17:36:33 | 显示全部楼层
这个关键的地方是必须看的
发表于 2010-8-14 18:11:42 | 显示全部楼层
强大!!!
发表于 2010-8-27 16:22:57 | 显示全部楼层
学习看看
发表于 2010-9-1 17:34:17 | 显示全部楼层
我也要看....................
发表于 2010-9-1 20:30:33 | 显示全部楼层
看看,学习之后我用C语言写一个
您需要登录后才可以回帖 登录 | 加入论坛

本版积分规则

QQ|Archiver|手机版|小黑屋|我爱秘籍论坛  

GMT+8, 2019-4-19 13:51 , Processed in 0.156523 second(s), 37 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表