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 


How do i make a Hex Address Editor of my own?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
InuyashaITB
Newbie cheater
Reputation: 0

Joined: 06 Sep 2009
Posts: 21
Location: california

PostPosted: Tue Sep 22, 2009 11:28 pm    Post subject: How do i make a Hex Address Editor of my own? Reply with quote

Ok, the subject does get the gist of what i want to do down.

Say i already have an address that i want to edit. All i want to know is how to change a hex address using VB.NET or C.

Here is a better example:
I have an address: 006912BE
Its value is: 1000
description: health

That is all the stuff that i would Already have on hand, FROM THERE, how do i use VB.NET to change the value of 006912BE to say 9999? (and may be freeze it?)
Back to top
View user's profile Send private message AIM Address MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Sep 22, 2009 11:39 pm    Post subject: Reply with quote

WriteProcessMemory
Back to top
View user's profile Send private message
InuyashaITB
Newbie cheater
Reputation: 0

Joined: 06 Sep 2009
Posts: 21
Location: california

PostPosted: Tue Sep 22, 2009 11:49 pm    Post subject: Reply with quote

Hmm, do you have a little more specific of an example? like also how to open a currently running processes to write to?
Back to top
View user's profile Send private message AIM Address MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Sep 22, 2009 11:51 pm    Post subject: Reply with quote

OpenProcess
Back to top
View user's profile Send private message
igoticecream
Grandmaster Cheater Supreme
Reputation: 0

Joined: 23 Apr 2006
Posts: 1807
Location: 0x00400000

PostPosted: Tue Sep 22, 2009 11:57 pm    Post subject: Reply with quote

in other words, slovach is trying to say OpenProcess return the handle of target process needed for WriteProcessMemory
Back to top
View user's profile Send private message
InuyashaITB
Newbie cheater
Reputation: 0

Joined: 06 Sep 2009
Posts: 21
Location: california

PostPosted: Wed Sep 23, 2009 12:08 am    Post subject: Reply with quote

I still dont quite get it, can you give specific example of code?
Back to top
View user's profile Send private message AIM Address MSN Messenger
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Wed Sep 23, 2009 4:07 am    Post subject: Reply with quote

what can't u understand?!
did u even read about writeprocessmemory?!
it's write the specific bytes you want to a specific address
Back to top
View user's profile Send private message
InuyashaITB
Newbie cheater
Reputation: 0

Joined: 06 Sep 2009
Posts: 21
Location: california

PostPosted: Wed Sep 23, 2009 9:26 am    Post subject: Reply with quote

lol...
this is what i have so far:
Code:

Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal blnheritHandle As Boolean, ByVal dwAppProcessId As IntPtr) As IntPtr
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As IntPtr, ByRef lpdwProcessId As IntPtr) As IntPtr
Private Const PROCESS_VM_READ = (&H10)

Public Sub TestOpenProcess(ByVal hwnd As IntPtr)

      Dim lRet As IntPtr
      Dim pid As IntPtr
      Dim hProcess as IntPtr

      ' Assign a value to pid - this part works fine
      lRet = GetWindowThreadProcessId(hwnd, pid)

      ' Try to open the process for reading
      hProcess = OpenProcess(PROCESS_VM_READ, False, pid)

      ' At this point:
      ' hProcess = 0
      ' Err.LastDllError = 87 (Parameter incorrect or something like that)     
      Debug.Writeline("Error: " & Err.LastDllError)
     
End Sub


But where do i go from there...
Back to top
View user's profile Send private message AIM Address MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Sep 23, 2009 11:37 am    Post subject: Reply with quote

1. You don't need to use GetWindowThreadProcessId()
Where is your hwnd coming from anyway?

You can just use the System.Diagnostics.Process class
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.getprocessesbyname.aspx


2. What do you mean where do you go from there? Implement a clever way to feed information to WriteProcessMemory()...
Back to top
View user's profile Send private message
InuyashaITB
Newbie cheater
Reputation: 0

Joined: 06 Sep 2009
Posts: 21
Location: california

PostPosted: Thu Sep 24, 2009 5:11 pm    Post subject: Reply with quote

Ok, here is my ... plan i geuss you can say:
I want to make a trainer of my own for the game Counter-Strike: Source. Its process name is HL2.EXE i want to be able to freeze and address using my own coding, but i do not know how to open the process for editing, how to inject my own data into the addresses that i want, nor do i know how to keep an address from changing values (freezing it).

Could someone give me a specific code example for VB 2008 that could do this?
Back to top
View user's profile Send private message AIM Address MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Thu Sep 24, 2009 9:07 pm    Post subject: Reply with quote

http://www.pinvoke.net/default.aspx/kernel32/OpenProcess.html
http://www.pinvoke.net/default.aspx/kernel32/WriteProcessMemory.html
Back to top
View user's profile Send private message
InuyashaITB
Newbie cheater
Reputation: 0

Joined: 06 Sep 2009
Posts: 21
Location: california

PostPosted: Thu Sep 24, 2009 10:07 pm    Post subject: Reply with quote

Ok i have been working on this and this is what i have:
Code:

Public Class Form1
    Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByRef lpBaseAddress As Object, _
                                                        ByRef lpBuffer As Object, ByVal nSize As Integer, ByRef _
                                                        lpNumberOfBytesWritten As Integer) As Integer

    Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, _
                                                         ByVal blnheritHandle As Boolean, _
                                                         ByVal dwAppProcessId As IntPtr) As IntPtr
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
    Private Declare Function GetWindowThreadProcessId Lib "user32" Alias "GetWindowThreadProcessId" (ByVal hwnd As Integer, ByRef lpdwProcessId As Integer) As Integer
    Private Declare Function CloseHandle Lib "kernel32" Alias "CloseHandle" (ByVal hObject As Integer) As Integer
    Private Declare Function TerminateProcess Lib "kernel32" Alias "TerminateProcess" (ByVal hProcess As Integer, ByVal uExitCode As Integer) As Integer
    Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
    Private Const SYNCHRONIZE As Integer = &H100000
    Private Const PROCESS_TERMINATE As Integer = &H1
    Private Const WM_CLOSE As Integer = &H10

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim ProcessList As System.Diagnostics.Process()
        Dim target_hwnd, target_process_id, target_process_handle As Integer

        ProcessList = System.Diagnostics.Process.GetProcesses()
        target_hwnd = FindWindow(vbNullString, "Counter-Strike Source")
        If (target_hwnd = 0) Then
            MsgBox("Error finding Target Window Handle")
            Me.Close()
        End If
        target_process_id = 0
        GetWindowThreadProcessId(target_hwnd, target_process_id)
        If (target_process_id = 0) Then
            MsgBox("Error finding Target Process ID")
            Me.Close()
        End If
        target_process_handle = OpenProcess(SYNCHRONIZE, 1, target_process_id)
        If (target_process_handle = 0) Then
            MessageBox.Show("Error finding target process handle")
            Me.Close()
        End If

    End Sub
End Class


It gets to the Target_Process_handle and it can't find the process handle, but it seems to find everything else just fine.
Back to top
View user's profile Send private message AIM Address MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Thu Sep 24, 2009 10:38 pm    Post subject: Reply with quote

Just do this instead of FindWindow() etc

Code:
Process[] proc = Process.GetProcessesByName("notepad");
int butt = proc[0].Id;
Back to top
View user's profile Send private message
InuyashaITB
Newbie cheater
Reputation: 0

Joined: 06 Sep 2009
Posts: 21
Location: california

PostPosted: Fri Sep 25, 2009 1:08 am    Post subject: Reply with quote

that came up with a huge list of errors.
Back to top
View user's profile Send private message AIM Address MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Fri Sep 25, 2009 1:45 am    Post subject: Reply with quote

Probably because it's C# because I somehow forgot we were discussing VB.NET code and this is what I meant to write


Code:
Dim proc As Process() = Process.GetProcessesByName("notepad")
Dim butt As Integer = proc(0).Id


problem solved
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
Goto page 1, 2  Next
Page 1 of 2

 
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