几乎所有修饰符都会用到 6 个主要函数c 游戏修改器制作,如下所述: 1. FindWindow(ClassName, WindowTitle) - FindWindow 返回与指定类名 (ClassName) 和窗口名称 (WindowTitle) 匹配的窗口句柄。 对于我们来说,我们可以将 ClassName 留空 (Null),只给出游戏的 WindowTitle。 该函数应该这样声明: Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long 2. GetWindowThreadProcessId(WindowHandle, ProcessId) - 这里我们使用在中获得的句柄FindWindow函数作为参数c 游戏修改器制作音乐,获取进程标识符(ProcessId)。 声明如下: Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long 3. OpenProcess(DesiredAccess, Inherit, ProcessId) - 该函数将返回我们的目标进程的句柄创作人,可以是用于对目标执行操作。 读取和写入操作。
DesiredAccess 参数的值确定进程句柄的访问权限。 对于我们来说,我们使用PROCESS_ALL_ACCESS(完全访问权限)。 Inherit 应该始终为 False。 ProcessId是从GetWindowThreadProcessId函数获取的。 声明函数 OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long、ByVal bInheritHandle As Long、ByVal dwProcessId As Long) As Long 4. CloseHandle(ProcessHandle) - 必须通过调用此函数来关闭每个打开的句柄。 声明 Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long 5. WriteProcessMemory(ProcessHandle, Address, Value, SizeofValue, BytesWritten) - 将指定值 Value 写入由 Address 指定的目标地址。
声明函数 WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long 6. ReadProcessMemory(ProcessHandle, Address, Value, SizeofValue, BytesWritten) - Put Address 指定的目标地址的值存储在 Value 位置的变量中。 声明函数 WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long、ByVal lpBaseAddress As Any、ByVal lpBuffer As Any、ByVal nSize As Long、lpNumberOfBytesWritten As Long) As Long