Go Back   FileForums > Games > Game Coders
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-10-2007, 07:31
Valkyrr Valkyrr is offline
Junior Member
 
Join Date: Jul 2006
Location: TN
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Valkyrr is on a distinguished road
Question A little help, hint, or suggestion please?

Ok, first I want to say thanks to everyone for the very educational posts in here. DABhand et. al.

Tools:
Cheat Engine (x.x version - can't remember)
TMK

Now, the question i have is this.

I have a game that uses DMA.

I found the memory address that writes the code I want to change and its something like this (I'm doing this from memory as I don't have my notes with me):

00c22848 - xx xx xx mov [esi+054h], eax (again I think this is similar to the actual code but not exact)

EAX in this case is 00000000. But I want it to be 00000001.

So I create a code cave (using Cheat Engine) and create:

00491919 - mov [esi+054h],00000001
xxxxxxxx - nop
xxxxxxxx - ret
xxxxxxxx - nop

However, when I go back to 00c22848 and change the mov stmt to:

00c22848 - call 00491919

I get the following msg in Cheat Engine:
(Paraphrasing here):

The NEW code is 5 bytes long, but the REPLACED code is only 3 bytes long. Do you want to replace the unused bytes with NOP. (Again, paraphrased)

Obviously I can't do the replacement because it will overwrite the code that exists in the 4th and subsequent bytes right? I think there's a jmp that comes right after the commands at 00c22848 that gets overwritten.

How can I get to my code cave and back?? Is this an advanced subject or am I missing something?

A lil help?
Reply With Quote
Sponsored Links
  #2  
Old 09-10-2007, 08:43
TippeX's Avatar
TippeX TippeX is offline
zeroes and ones.....
 
Join Date: Jan 2003
Posts: 3,842
Thanks: 2
Thanked 33 Times in 23 Posts
TippeX is on a distinguished road
you're replacing say...
mov [esi+054h], eax
with a call to your caved code right

mov [esi+54h], eax is indeed 3 bytes - you should have seen this in the disassembly
its 89 46 54

you need to grab the next line(s) too, and also copy that to your cave code
until you have 5 (or more bytes) to work in

say the code is

89 46 54 mov [esi+54], eax
33 c0 xor eax, eax
40 inc eax

you need 5 bytes to put in the call, so that will be in place of the 89 46 54 33 c0
it'll be come e8 xx xx xx xx (call to your cave)

your code will then have...
mov [esi+54], 1 (your replacment)
then the other copied lines (33 c0 in this example)
and then a ret...

makes sense?
__________________
bleh
DO NOT PM me with questions, leave that in the forums...ESPECIALLY if i dont know you...
Reply With Quote
  #3  
Old 09-10-2007, 08:51
Valkyrr Valkyrr is offline
Junior Member
 
Join Date: Jul 2006
Location: TN
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Valkyrr is on a distinguished road
Yes thats exactly right. I did see it in the assembly, but didn't note it until I received the message.

Your solution makes perfect sense, i.e., it makes me realize how much a noob I am at code caving.

I cannot believe I didn't think of this

Thanks!!
Reply With Quote
  #4  
Old 09-10-2007, 10:21
DABhand DABhand is offline
Banned
 
Join Date: Nov 2004
Location: Near my PC
Posts: 5,406
Thanks: 0
Thanked 3 Times in 3 Posts
DABhand is on a distinguished road
Guess I dont have to give an answer now :P

But yeah you always want to make sure that any destroyed opcodes are replaced in your code cave.

Always going to be 5 bytes, for a call or jmp so make sure you have everything covered.
Reply With Quote
  #5  
Old 09-10-2007, 11:24
Valkyrr Valkyrr is offline
Junior Member
 
Join Date: Jul 2006
Location: TN
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Valkyrr is on a distinguished road
Thanks again guys!

Edit: Actually I was pretty stoked that I could pick it up again after not having done it for a year or so. Funny how some things come back to you, kind of like riding a bike I guess...
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
suggestion anybody... acon PC Games 0 25-06-2002 22:46
Need suggestion for the best racing/rally games for LAN multiplayer... NabiRonK PC Games 5 14-06-2002 12:03
Any suggestion?? Lucano PS2 Games 3 17-02-2002 19:00
Suggestion for a new burner SepticDeath CD/DVD-Writers 8 23-04-2001 12:16
a littel HINT to everyone that has waste alot of CD and cant get the burning right...... Mantus DC Games 0 09-12-2000 08:51



All times are GMT -7. The time now is 08:00.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com