简单的游戏修改 魔法门之英雄无敌3末日之刃
Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpAddress As Integer, ByVal lpBuffer As Byte(), ByVal nSize As Integer, ByVal lpNumberOfBytesWritten As Integer) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Ja As System.Diagnostics.Process() = Process.GetProcessesByName("Heroes3")
If Ja.Length > 0 Then
Dim A() As Byte = returnHexToByte(1, 4)
WriteProcessMemory(Ja(0).Handle, &H16D0BEC, A, A.Length, 0)
End If
Me.Close()
End Sub
Public Function returnHexToByte(ByVal setNumer As Integer, ByVal nSize As Integer) As Byte()
Try
Dim ReturnByte() As Byte
ReDim ReturnByte(nSize)
'转换十六进制并如为奇数在左边补上0
Dim HexNuner As String = Hex(setNumer)
If HexNuner.Length Mod 2 = 1 Then
HexNuner = HexNuner.PadLeft(HexNuner.Length + 1, "0")
End If
Dim A As Integer = HexNuner.Length / 2
Dim B As Integer = 0
Do While A > 0
ReturnByte(B) = "&H" & Mid(HexNuner, A * 2 - 1, 2)
A -= 1
B += 1
If B > nSize Then
Return Nothing '错误的字节 数太大了超出了字节范围
End If
Loop
Return ReturnByte
Catch ex As Exception
MsgBox(ex.Message)
Return Nothing
End Try