- Код: Выделить всё
Public Class Main
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByVal lpBuffer As Byte(), ByVal nSize As System.UInt32, ByRef lpNumberOfBytesWritten As Int32) As Boolean
Private Declare Function ReadProcessMemory 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 CloseHandle Lib "kernel32" (ByVal hObject As Integer) As Integer
Dim hProc As Integer = 0
Private Sub Main_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Leave
CloseHandle(hProc)
Process.LeaveDebugMode()
End Sub
Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Process.EnterDebugMode()
getusername()
End Sub
Private Sub gethproc()
Dim war3() As Process = Process.GetProcessesByName("war3")
If war3.Length = 0 Then MessageBox.Show("Couldn't find Warcraft") : End
CloseHandle(hProc)
hProc = war3(0).Handle
End Sub
Private Function getoffset()
gethproc()
Dim buffer As Integer = 0
ReadProcessMemory(hProc, &H6FAE3CDC, buffer, 4, 0)
If buffer = 0 Then MessageBox.Show("You have to be logged in to use this tool") : End
Return buffer + &H21C
End Function
Private Sub getusername()
txtcname.Text = ""
Dim buffer As Integer = 0, offset As Integer = getoffset()
For i As Integer = 0 To 15
ReadProcessMemory(hProc, offset + i, buffer, 1, 0)
txtcname.Text &= Chr(buffer)
Next
End Sub
Private Sub updateusername()
Dim offset As Integer = getoffset(), buffer(15) As Byte
For i As Integer = 0 To txtnname.Text.Length - 1
buffer(i) = Asc(txtnname.Text.Substring(i, 1))
Next
WriteProcessMemory(hProc, offset, buffer, 16, 0)
getusername()
End Sub
Private Sub cmdcolor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdcolor.Click
If cdialog.ShowDialog() = Windows.Forms.DialogResult.OK Then
If txtnname.Text.Length > 6 Then txtnname.Text = txtnname.Text.Substring(0, 6)
txtnname.Text = "|c" & cdialog.Color.ToArgb().ToString("x") & txtnname.Text
End If
End Sub
Private Sub cmdupdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdupdate.Click
updateusername()
End Sub
End Class