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 


[Resolved] WriteProcessMemory

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Configuration
Newbie cheater
Reputation: 0

Joined: 09 May 2009
Posts: 19

PostPosted: Sun Feb 14, 2010 3:49 pm    Post subject: [Resolved] WriteProcessMemory Reply with quote

Hi, I found the hex address to something I would like to change:

Picture (remove the space between http: and //):
http: //img519.imageshack.us/img519/8844/hexopcodes.png

Basically, I want to change:
96 56 00 08 05 08 5b 08 4d 07 03 to
96 56 00 08 05 08 5b 08 4d 07 63


What I'm changing is the source code of a flash game (as2) inside my browser's memory. I would like to write an executable trainer to edit the address every time the flash game is loaded in my web browser.

What is the best way (preferably simplest too) to go about writing a trainer to edit the hex addresses? If some programming is involved, such as the use of the writeprocessmemory function, I would prefer an example script for this in VB6.


Last edited by Configuration on Mon Feb 15, 2010 12:08 am; edited 2 times in total
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: Sun Feb 14, 2010 4:25 pm    Post subject: Reply with quote

well, try writeprocessmemory, or if you want to save the change, use ollydbg
_________________
+~
Back to top
View user's profile Send private message
e!ns7e!n
Cheater
Reputation: 0

Joined: 06 Sep 2007
Posts: 30

PostPosted: Sun Feb 14, 2010 4:31 pm    Post subject: Reply with quote

Just use WriteProcessMemory to change the byte from 03 to 63 at adress 0x0B05F221. Wink
Back to top
View user's profile Send private message
Configuration
Newbie cheater
Reputation: 0

Joined: 09 May 2009
Posts: 19

PostPosted: Sun Feb 14, 2010 4:47 pm    Post subject: Reply with quote

e!ns7e!n wrote:
Just use WriteProcessMemory to change the byte from 03 to 63 at adress 0x0B05F221. Wink


The address changes every time the flash game is reloaded in my browser (though not significantly, usually only the xx in address 0BxxF221 changes slightly). I would use WriteProcessMemory, but is there an alternative method to changing the hex values without having to worry about pointers and such? My programming knowledge is not that good.
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: Sun Feb 14, 2010 5:06 pm    Post subject: Reply with quote

Configuration wrote:
e!ns7e!n wrote:
Just use WriteProcessMemory to change the byte from 03 to 63 at adress 0x0B05F221. Wink


The address changes every time the flash game is reloaded in my browser (though not significantly, usually only the xx in address 0BxxF221 changes slightly). I would use WriteProcessMemory, but is there an alternative method to changing the hex values without having to worry about pointers and such? My programming knowledge is not that good.


You must find the pointer, no where it points to, so you can do something like
(only if you are in the same context, else, use writeprocessmemory):

*(DWORD*)(*(DWORD*)base)+offset = VALUE;

_________________
+~
Back to top
View user's profile Send private message
Configuration
Newbie cheater
Reputation: 0

Joined: 09 May 2009
Posts: 19

PostPosted: Sun Feb 14, 2010 6:33 pm    Post subject: Reply with quote

^Thanks! I got that part figured out now.

Ok, here's my attempt at using WriteProcessMemory in Vb6. The code is not mine. The only minor thing I need figuring out is the correct syntax usage for ReadProcessMemory.


Shortened Module omitting the public declarations for readprocessmemory and openprocess, etc:

Code:
Public Sub WriteAInt(Address As Long, Value As Long, ByteLength As Long)
Dim hwnd As Long, classname As Long, pid As Long, phandle As Long

hwnd = FindWindow(vbNullString, WinName)

If (hwnd <> 0) Then
GetWindowThreadProcessId hwnd, pid
phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
If (phandle <> 0) Then
WriteProcessMemory phandle, Address, Value, ByteLength, 0&
End If
CloseHandle phandle
End If

End Sub



Form1:

Code:
Private Sub Command1_Click()
If ReadProcessMemory(&HB05F221) = 3 Then
Call WriteAInt(&HB05F221, 99, 4)

End Sub

Private Sub Form_Load()
Module1.WinName = "Trainer.exe"
End Sub



What is the correct way of fixing the following:
Code:
If ReadProcessMemory(&HB05F221) = 3 Then
Call WriteAInt(&HB05F221, 99, 4)

Basically if address 0B05F221's value is 3, it will change it to 99
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: Sun Feb 14, 2010 6:55 pm    Post subject: Reply with quote

my opinion is .net is not good at this compared to win32 programming, use C or delphi
_________________
+~
Back to top
View user's profile Send private message
Configuration
Newbie cheater
Reputation: 0

Joined: 09 May 2009
Posts: 19

PostPosted: Mon Feb 15, 2010 12:07 am    Post subject: Reply with quote

I'm aware, but it was easier to do it in VB6 so I just stuck with it. I fixed my script, and now it works perfectly. Thanks for all your help! Thread title has been renamed to resolved.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Mon Feb 15, 2010 12:31 am    Post subject: Reply with quote

VB6 isn't .NET, it's a dead language that has no support.
Back to top
View user's profile Send private message
ralphmigcute
Newbie cheater
Reputation: 0

Joined: 10 Jan 2010
Posts: 16

PostPosted: Sun Aug 01, 2010 3:26 am    Post subject: dude.. Reply with quote

can you help me in vb8 array of bytes ^^ reading ?
_________________
hello ralph
Back to top
View user's profile Send private message
Jesper
Grandmaster Cheater Supreme
Reputation: 9

Joined: 21 Feb 2007
Posts: 1156

PostPosted: Sun Aug 01, 2010 6:16 am    Post subject: Reply with quote

I'd switch to C#.Net if I were you, simply because it has more functionality but still is no harder than VB.
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