Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[HELP] - Address Pointer in VB 6.0

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
walktalk
How do I cheat?
Reputation: 0

Joined: 05 Dec 2011
Posts: 1

PostPosted: Wed Apr 18, 2012 3:03 pm    Post subject: [HELP] - Address Pointer in VB 6.0 Reply with quote

Hello, I have a project here in visual basic 6.0 using cheat engine addresses ...
most want to know how can I use the address:

EAX = 0C0FD360
Offset = 1A

0C0FD360 = 0018f074 + 1A
is the point address ...

Function in CommandButton:
Code:
Call WriteALong("GAME", &Haddress , Value)


MODULE:
Code:
Public Const PROCESS_ALL_ACCESS = &H1F0FFF
Dim f1holder As Integer
Dim timer_pos As Long
Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal SomeValueIsStoredHere 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 CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal Classname As String, ByVal WindowName As String) As Long
Public Declare Function GetKeyPress Lib "user32" Alias "GetAsyncKeyState" (ByVal key As Long) As Integer
Public Declare Function ReadProcessMem Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByRef lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Public Function WriteALong(TheGame As String, TheAddress As Long, ThisIsTheValue As Long)
Dim SomeValueIsStoredHere As Long
Dim SomeValueIsStoredHereToo As Long
Dim SomeValue As Long
SomeValueIsStoredHere = FindWindow(vbNullString, TheGame)
GetWindowThreadProcessId SomeValueIsStoredHere, SomeValueIsStoredHereToo
SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, SomeValueIsStoredHereToo)
If (SomeValue = 0) Then
Exit Function
End If
WriteProcessMemory SomeValue, TheAddress, ThisIsTheValue, 4, 0&
CloseHandle hProcess
End Function
Public Function ReadALong(TheGame As String, TheAddress As Long, TheValue As Long)
Dim SomeValueIsStoredHere As Long
Dim SomeValueIsStoredHereToo As Long
Dim SomeValue As Long
SomeValueIsStoredHere = FindWindow(vbNullString, TheGame)
GetWindowThreadProcessId SomeValueIsStoredHere, SomeValueIsStoredHereToo
SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, SomeValueIsStoredHereToo)
If (SomeValue = 0) Then
Exit Function
End If
ReadProcessMem SomeValue, TheAddress, TheValue, 4, 0&
CloseHandle hProcess
End Function
Public Function ReadAFloat(TheGame As String, TheAddress As Long, TheValue As Single)
Dim SomeValueIsStoredHere As Long
Dim SomeValueIsStoredHereToo As Long
Dim SomeValue As Long
SomeValueIsStoredHere = FindWindow(vbNullString, TheGame)
GetWindowThreadProcessId SomeValueIsStoredHere, SomeValueIsStoredHereToo
SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, SomeValueIsStoredHereToo)
If (SomeValue = 0) Then
Exit Function
End If
ReadProcessMem SomeValue, TheAddress, TheValue, 4, 0&
CloseHandle hProcess
End Function
Public Function WriteAFloat(TheGame As String, TheAddress As Long, ThisIsTheValue As Single)
Dim SomeValueIsStoredHere As Long
Dim SomeValueIsStoredHereToo As Long
Dim SomeValue As Long
SomeValueIsStoredHere = FindWindow(vbNullString, TheGame)
GetWindowThreadProcessId SomeValueIsStoredHere, SomeValueIsStoredHereToo
SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, SomeValueIsStoredHereToo)
If (SomeValue = 0) Then
Exit Function
End If
WriteProcessMemory SomeValue, TheAddress, ThisIsTheValue, 4, 0&
CloseHandle hProcess
End Function
Back to top
View user's profile Send private message
force1758
How do I cheat?
Reputation: -1

Joined: 21 Feb 2011
Posts: 4
Location: venezuela

PostPosted: Thu Apr 19, 2012 8:11 am    Post subject: Reply with quote

hi here a code to see if it helps
private funcion
[code]
Private Const PROCESS_ALL_ACCESS = &H1F0FFF
Private Declare Function InitCommonControls Lib "comctl32.dll" () As Long
Private Declare Function GetAsyncKeyState Lib "User32" (ByVal vKey As Long) As Integer
Private Declare Function GetKeyPress Lib "User32" Alias "GetAsyncKeyState" (ByVal key As Long) As Integer
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 Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private 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
Private Declare Function ReadProcessMem Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByRef lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long[/code]


declare pointer
[code]
Private Function WritePointer(gamewindowtext As String, AddressBase As Long, OffsetX As Long, Value As Long)
Dim hwnd As Long
Dim PID As Long
Dim PHandle As Long
Dim Val As Long
Dim Val2 As Long
hwnd = FindWindow(vbNullString, gamewindowtext)
If (hwnd = 0) Then
Exit Function
End If
GetWindowThreadProcessId hwnd, PID
PHandle = OpenProcess(PROCESS_ALL_ACCESS, False, PID)
If (PHandle = 0) Then
MsgBox "Can't get ProcessId", vbCritical, "Error"
Exit Function
End If
ReadProcessMemory PHandle, AddressBase, Val, 4, 0&
Val2 = Val + OffsetX
WriteProcessMemory PHandle, Val2, Value, 4, 0&
CloseHandle hProcess
End Function[/code]


create module name module ( APICodigo)
[code]
Option Explicit
Public Const MAX_PATH = 260
Public Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * MAX_PATH
End Type
Public Type MODULEENTRY32
dwSize As Long
th32ModuleID As Long
th32ProcessID As Long
GlblcntUsage As Long
ProccntUsage As Long
modBaseAddr As Long
modBaseSize As Long
hModule As Long
szModule As String * 256
szExePath As String * MAX_PATH
End Type
Public Const TH32CS_SNAPMODULE = &H8
Public Const TH32CS_SNAPHEAPLIST = &H1
Public Const TH32CS_SNAPPROCESS = &H2
Public Const TH32CS_SNAPTHREAD = &H4
Public Const TH32CS_SNAPALL = (TH32CS_SNAPHEAPLIST + TH32CS_SNAPPROCESS + TH32CS_SNAPTHREAD + TH32CS_SNAPMODULE)
Public Const PROCESS_ALL_ACCESS As Long = &H1F0FFF
Public Const PROCESS_VM_READ = &H10&
Public Const PROCESS_QUERY_INFORMATION = &H400
Public Const MEM_DECOMMIT = &H4000
Public Const MEM_RELEASE = &H8000
Public Const MEM_COMMIT = &H1000
Public Const MEM_RESERVE = &H2000
Public Const MEM_RESET = &H80000
Public Const MEM_TOP_DOWN = &H100000
Public Const PAGE_READONLY = &H2
Public Const PAGE_READWRITE = &H4
Public Const PAGE_EXECUTE = &H10
Public Const PAGE_EXECUTE_READ = &H20
Public Const PAGE_EXECUTE_READWRITE = &H40
Public Const PAGE_GUARD = &H100
Public Const PAGE_NOACCESS = &H1
Public Const PAGE_NOCACHE = &H200
Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Public Declare Sub CloseHandle Lib "kernel32" (ByVal hPass As Long)
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 CreateToolhelp32Snapshot Lib "kernel32" (ByVal lFlags As Long, ByVal lProcessID As Long) As Long
Public Declare Function Process32First Lib "kernel32" (ByVal hSnapShot As Long, lppe As Any) As Long
Public Declare Function Process32Next Lib "kernel32" (ByVal hSnapShot As Long, lppe As Any) As Long
Public Declare Function Module32First Lib "kernel32" (ByVal hSnapShot As Long, lpMe32 As MODULEENTRY32) As Long
Public Declare Function Module32Next Lib "kernel32" (ByVal hSnapShot As Long, lpMe32 As MODULEENTRY32) 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 WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, ByVal lpNumberOfBytesWritten As Long) As Long
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDest As Any, pSrc As Any, ByVal ByteLen As Long)
Public Declare Function VirtualProtectEx Lib "Kernel32.dll" (ByVal hProcess As Long, lpAddress As Any, ByVal dwSize As Long, ByVal flNewProtect As Long, lpflOldProtect As Long) As Long
Public Function GetArrayDimensions(ByVal arrPtr As Long) As Integer
Dim Address As Long
CopyMemory Address, ByVal arrPtr, ByVal 4

If Address <> 0 Then
CopyMemory GetArrayDimensions, ByVal Address, 2
End If
End Function
Public Function VarPtrArray(arr As Variant) As Long

CopyMemory VarPtrArray, ByVal VarPtr(arr) + 8, ByVal 4

End Function
Public Function ByteArray(ParamArray vArray() As Variant) As Byte()
Dim vValues() As Variant
Dim bArray() As Byte
vValues = vArray
If (GetArrayDimensions(VarPtrArray(vValues())) > 0) And (UBound(vValues) >= 0) Then
Dim X As Long
ReDim bArray(UBound(vValues) - LBound(vValues)) As Byte
For X = LBound(vValues) To UBound(vValues)
bArray(X) = CByte(vValues(X))
Next X
ByteArray = bArray
Else
Exit Function
End If

End Function


[/code]

funtion command button1
Call WritePointer(game, &Haddress, &Hoffset, &Hvalue)
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
walktalk
How do I cheat?
Reputation: 0

Joined: 05 Dec 2011
Posts: 1

PostPosted: Thu Apr 19, 2012 7:21 pm    Post subject: Reply with quote

That's what I want friend !

just have a problem ...

the address I'm using is float, not bytes ...

What can I change the codes to work well the value I use?

Thanks you for help!
Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites