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 


problem with reading\wrting to pionter with offsets VB

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

Joined: 11 Jul 2012
Posts: 7

PostPosted: Tue Jul 17, 2012 12:08 pm    Post subject: problem with reading\wrting to pionter with offsets VB Reply with quote

i have try manny option`s to read the right value..

here is the code

module for reading and writing to memorie:

Code:
Imports System.Runtime.InteropServices

Module Module1
    Public Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Int32) As UShort
    Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
    Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
    Public Declare Function WriteFloatMemory Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Single, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
    Public Declare Function Write64Memory Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Int64, ByVal lpBaseAddress As Int64, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
    Public Declare Function ReadFloat Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByRef buffer As Single, ByVal size As Int32, ByRef lpNumberOfBytesRead As Int32) As Boolean
    Public 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
    Public Declare Function ReadProcessMemory Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Int64, ByVal lpBaseAddress As Int64, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
    Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Integer) As Integer
    Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
    Public Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As IntPtr, ByVal lpBaseAddress As Int32, ByRef lpBuffer As Int32, ByVal nSize As Int32, ByVal lpNumberOfBytesWritten As Int32) As Long
    Public Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As IntPtr, ByVal lpBaseAddress As Int32, ByRef lpBuffer As Byte(), ByVal nSize As Int32, ByVal lpNumberOfBytesWritten As Int32) As Long
    Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As IntPtr, ByVal lpBaseAddress As Int32, ByVal lpBuffer() As Byte, ByVal nSize As Int32, ByVal lpNumberOfBytesWritten As Int32) As Long
    Public Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAccess As UInteger, ByVal bInheritHandle As Integer, ByVal dwProcessId As UInteger) As IntPtr
    Public Declare Function CloseHandle Lib "kernel32.dll" (ByVal hHandle As IntPtr) As Boolean



the code for trying to read pionter DX3DRipper.exe+10D730 with offset 3e8
this is the target.
Code:

Public Class Form1



    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim MyAddress As Integer = GetAddress("DX3DRipper.exe+00112844", "DX3DRipper")
        Dim p As Process() = Process.GetProcessesByName("DX3DRipper")
'no error message here.
        MessageBox.Show(MyAddress)
        Dim processHandle As Integer = OpenProcess(&H1F0FFF, 0, p(0).Id)
        Dim amount As Integer
        Dim save As Integer

        Dim read As Integer = ReadProcessMemory(processHandle, MyAddress, amount, 4, save)
        MessageBox.Show(amount)
        Dim writte As Integer = MyAddress + &H3E8
        Dim read2 As Integer = ReadProcessMemory(processHandle, writte, amount, 4, save)
        If read = 0 Then
            MessageBox.Show("error reading")
        End If
        MessageBox.Show(amount)
        'Dim adrr2 As Integer = MyAddress + &H3E8
        'Dim read3 As Integer = ReadProcessMemory(processHandle, adrr2, amount, 1, save)

        Dim write As Integer = WriteProcessMemory(processHandle, writte, TextBox1.Text, 4, save)
        If write = 0 Then
            MessageBox.Show("error writing")
        End If

        'Dim save1 As Integer = MyAddress + &H2DC
        'Dim adrr1 As Integer = ReadProcessMemory(processHandle, save1, amount, 4, save)
        'Dim save2 As Integer = save1 + &H8
        'Dim adrr2 As Integer = ReadProcessMemory(processHandle, save2, amount, 4, save)
        'Dim save3 As Integer = save2 + &H13C
        'Dim adrr3 As Integer = ReadProcessMemory(processHandle, save3, amount, 4, save)
        'Dim write As Integer = WriteProcessMemory(processHandle, save3, 100, 4, save)
        'MessageBox.Show(save1)
        'MessageBox.Show(save2)

        MessageBox.Show(amount)

        CloseHandle(processHandle)
    End Sub
End Class


i have found out how to it look at this code
Code:

    Public Function P4Bytes(ByVal Base As Integer, ByVal Offset As Short, ByVal Value As Long)
        Dim fullAddress As Long
        Dim LookUp As Process() = Process.GetProcessesByName("YOUR GAME's PROCESS")
        If LookUp.Length = 0 Then
            End
        End If
        Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
        ReadProcessMemory(processHandle, Base, RBuff, 4, Nothing)
        fullAddress = RBuff + Offset
        WriteProcessMemory(processHandle, fullAddress, Value, 4, Nothing)
        CloseHandle(processHandle)
    End Function
'now you now how it works


sorry about this
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