AJUDA COM WRITESTRING
A seguir meu código:
Citação:[ô]Form
[ô]--------------------------------------------------------------------------------------------------------------
Private Declare Function FindWindow Lib [Ô]user32[Ô] Alias [Ô]FindWindowA[Ô] (ByVal Classname As String, ByVal WindowName As String) As Long
Private Declare Function GetWindowThreadProcessId Lib [Ô]user32[Ô] (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Sub Command1_Click()
Dim hwnd As Long
Dim pid As Long
hwnd = FindWindow(vbNullString, [Ô]Tibia[Ô])
GetWindowThreadProcessId hwnd, pid
changeip (pid)
End Sub
Citação:[ô]Módulo
[ô]--------------------------------------------------------------------------------------------------------------
Private 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
Private Declare Function CloseHandle Lib [Ô]kernel32[Ô] (ByVal hObject As Long) As Long
Public Function changeip(ByVal IDofProcess As Long) As Boolean
Const PROCESS_ALL_ACCESS = &H1F0FFF
Dim ax1 As Long
Dim ax2 As String
Dim phandle As Long
phandle = OpenProcess(PROCESS_ALL_ACCESS, False, IDofProcess)
For ax1 = 1 To Len(frmIP.Text1.Text)
ax2 = ax2 & Asc(Mid$(frmIP.Text1.Text, ax1, 1))
Next
ax1 = 0
If Not frmIP.Text1.Text = [Ô][Ô] Then
WriteProcessMemory phandle, &H7947F8, ax2 & Chr(0), Len(ax2) + 1, 0&
WriteProcessMemory phandle, &H7947F8, ax2 & Chr(0), Len(ax2) + 1, 0&
WriteProcessMemory phandle, &H794868, ax2 & Chr(0), Len(ax2) + 1, 0&
WriteProcessMemory phandle, &H7948D8, ax2 & Chr(0), Len(ax2) + 1, 0&
WriteProcessMemory phandle, &H794948, ax2 & Chr(0), Len(ax2) + 1, 0&
WriteProcessMemory phandle, &H7949B8, ax2 & Chr(0), Len(ax2) + 1, 0&
WriteProcessMemory phandle, &H794A28, ax2 & Chr(0), Len(ax2) + 1, 0&
WriteProcessMemory phandle, &H794A98, ax2 & Chr(0), Len(ax2) + 1, 0&
WriteProcessMemory phandle, &H794B08, ax2 & Chr(0), Len(ax2) + 1, 0&
WriteProcessMemory phandle, &H794B78, ax2 & Chr(0), Len(ax2) + 1, 0&
WriteProcessMemory phandle, &H794BE8, ax2 & Chr(0), Len(ax2) + 1, 0&
Else
MsgBox [Ô]Digite um IP primeiro![Ô], vbCritical, [Ô]Erro![Ô]
End If
CloseHandle phandle
End Function
------------------------------------------------------------------------------------------------------------------
Desde já agradeço.
Citação::
Não entendi.. o teu código não está funcionando?
é assim, o tibia tem alguns endereços de memória onde o ip é gravado. Primeiro o programa converte a escrita da textbox para bytes. Depois ela muda estes endereços do tibia para o valor em bytes da textbox, porém esse valor é mudado para caracteres estranhos e não o texto que escrevi na textbox (Verifiquei pelo cheat engine).
Acho que o erro esta aqui:
Citação:For ax1 = 1 To Len(frmIP.Text1.Text)
ax2 = ax2 & Asc(Mid$(frmIP.Text1.Text, ax1, 1))
Next
ax1 = 0
bytes = StrConv(txt, vbFromUnicode)