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 


[Delphi] Auto assemble some code

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

Joined: 09 Feb 2011
Posts: 7

PostPosted: Sun Feb 13, 2011 6:11 am    Post subject: [Delphi] Auto assemble some code Reply with quote

Hello, whats up guys? As I hate pretty much the long threads I will post something just to know what I am searching for. Well, I have code for infinite nitro for the NFS MW. The code is compiling fine and works great in Auto assamble, but I can't figure it out how could I inject the code from Delphi without using CE at all. So I want to auto assamble the same code from Delphi and inject that code into the process "speed.exe". I really couldn't find anything on the net, not even on the board. This is the code:

Code:

[ENABLE]
  Alloc(Mem, 4)
 
  Mem:
    dd 3F800000
   
  00692A96:
    Fld Dword Ptr [Mem]
   
  00692AFA:
    Fld Dword Ptr [Mem]
 
[DISABLE]
  Dealloc(Mem)
 
  00692A96:
    Fld Dword Ptr [Esi+000000F8]
   
  00692AFA:
    Fld Dword Ptr [Esi+000000F8]


The problem is that I can not use "asm" in procedure because this is not a normal assemble but auto assamble by Sven Harvey (I think). Any help would be thankful.

All the best,
dn5.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25288
Location: The netherlands

PostPosted: Sun Feb 13, 2011 11:02 am    Post subject: Reply with quote

use writeprocessmemory
and instead of alloc(mem) you could try writing the value 3f800000 to a location you know exists (e.g 00400500)

else use virtualallocex and fill in the address in the bytes you write yourself

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
0wn3d
How do I cheat?
Reputation: 0

Joined: 09 Feb 2011
Posts: 7

PostPosted: Sun Feb 13, 2011 12:41 pm    Post subject: Reply with quote

I could use WriteProcessMemory, but I don't know what should I change instead of 3f800000. Or should I only WriteProcessMemory and change the value to always be 100 (like putting into timer or something). Now what about other codes:

Code:

  00692A96:
    Fld Dword Ptr [Mem]
   
  00692AFA:
    Fld Dword Ptr [Mem]

What do they actually mean?! And If this is enable, what [DISABLE] do? And should I use it in Delphi or WriteProcessMemory is enough without messing with codes in [DISABLE]?

Thanks for the answer, DB!
Back to top
View user's profile Send private message
0wn3d
How do I cheat?
Reputation: 0

Joined: 09 Feb 2011
Posts: 7

PostPosted: Tue Feb 15, 2011 7:58 am    Post subject: Reply with quote

I can't believe that I need to bump this. Anyone?! DB you must know it Rolling Eyes
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Tue Feb 15, 2011 10:38 am    Post subject: Reply with quote

Dark Byte already told you the two main API you will need, WriteProcessMemory and VirtualAlloEx. You need to go research how to use those API. Begging for code isn't going to teach you anything.

As for your actual issue converting the code:
Code:

  00692A96:
    Fld Dword Ptr [Mem]
   
  00692AFA:
    Fld Dword Ptr [Mem]


Just go to those addresses in Cheat Engines memory viewer while attached to the game. Enable your cheat and look at the bytes for the functions.

You'll end up with something like this:
01000147 D9 05 34123412 fld dword ptr [12341234]

Meaning you need to write:
D9 05 FF FF FF FF

Where FF FF FF FF is the address you allocated for your new value with VirtualAllocEx.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
0wn3d
How do I cheat?
Reputation: 0

Joined: 09 Feb 2011
Posts: 7

PostPosted: Tue Feb 15, 2011 11:52 am    Post subject: Reply with quote

I pretty much know to use WriteProcessMemory, and VirtualAlloEx, the problem is that that I was sceptic about [DISABLE] tag. Thanks I got it! I will reply as soon as possible and will back you with results. All the best.
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Fri Feb 18, 2011 12:01 pm    Post subject: Reply with quote

Button1.Enable:
const
lpBuffer : array [0..3] of byte = ($3F, $80, $80, $80); // Modified Opcodes
begin
WriteProcessMemory( ..., Ptr($00692A96), lpBuffer, SizeOf(lpBuffer), ... );
WriteProcessMemory( ..., Ptr($00692AFA), lpBuffer, SizeOf(lpBuffer), ... );
end;



Button2.Disable:
const
lpBuffer : array [0..3] of byte = ($XX, $XX, $XX, $XX); // Original Opcodes (View them using CE)
begin
WriteProcessMemory( ..., Ptr($00692A96), lpBuffer, SizeOf(lpBuffer), ... );
WriteProcessMemory( ..., Ptr($00692AFA), lpBuffer, SizeOf(lpBuffer), ... );
end;



http://msdn.microsoft.com/en-us/library/ms681674(v=vs.85).aspx <-- look here to fill missing params.
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