VB WriteProcessMemory问题。。。请指教

来源:百度知道 编辑:UC知道 时间:2024/07/08 10:29:46
模块:
Option Explicit
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long
Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
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
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Const

Private Sub Check1_Click()
Gamehwnd1 = FindWindow(vbNullString, "Yuri's Revenge")
GetWindowThreadProcessId Gamehwnd1, ID
hProces1 = OpenProcess(PROCESS_ALL_ACCESS, False, ID)
If (Gamehwnd1 = 0) Then
Else
If Check1.Value = 1 Then
Dim Str1(12) As Byte, nSize As Long
Str1(0) = &HBC
Str1(1) = &H5F
Str1(2) = &HBA
Str1(3) = &HE4
Str1(4) = &HFE
Str1(5) = &HD2
Str1(6) = &H25
Str1(7) = &HC7
Str1(8) = &H7B
Str1(9) = &H90
Str1(10) = &H16
Str1(11) = &H52
WriteProcessMemory hProces1, ByVal &H897F50, ByVal VarPtr(Str1(0)), 12, nSize
Else

Str1(0) = &H99
Str1(1) = &HA8
Str1(2) = &HFB
Str1(3) = &HC1
Str1(4) = &H44
Str1(5) = &HDD
Str1(6) = &HF
Str1(7) = &HCE
Str1(8) = &H8
Str1(10) = &HEA
Str1(11) = &H71
WriteProcessMemory hProces1, ByVal &H897F50, ByVal VarPtr(Str1(0)), 12, nSize
End If
End If

End