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 


Need help with inline assembly in C++

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Zombi3
Expert Cheater
Reputation: 0

Joined: 02 Aug 2007
Posts: 144

PostPosted: Fri Oct 05, 2007 10:02 am    Post subject: Need help with inline assembly in C++ Reply with quote

Well i can't really find any inline assembly tutorials for C++ when it come to building trainers and what not.I usually put my opcodes in an array. Example...
Code:
   byte jmp[] ={0xE9,0xE4,0x79,0x01,0x00,0x90};
   byte code[]={0xFE,0x05,0x80,0x5E,0x44,0x00,0x80,
                0x3D,0x80,0x5E,0x44,0x00,0x02,0x0F,
                0x85,0x45,0x86,0xFE,0xFF,0x8D,0x4C,
                0x24,0x4C,0xE9,0x01,0x86,0xFE,0xFF

and thats just for doing this.
Quote:
JE 437d62
nop

inc byte ptr[445e80]
cmp byte ptr[445e80],2
jnz 4203ba
lea ecx,dword ptr ss:[esp+4c]
jmp 42037f

I have tried multiple times to getting _asm to work in C++ but for some reason writeprocessmemory writes the wrong opcodes like for example.

Code:
void _declspec(naked) Script()
{
         __asm
         {
            nop
            nop
         };         
}

with WriteProcessMemory(pi.hProcess,(LPVOID)address2,&Script,2,0)
gives me 0xE9 and 0x19.

_________________
Tutorial On Api hooking

unsigned char sh4llcode[] ="\xx0r\xsucks"
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Fri Oct 05, 2007 3:16 pm    Post subject: Reply with quote

&Script isn't pointing to the address of "void _declspec(naked) Script()". Do some debugging and you'll notice. It's pointing to the very beginning of your .exe. I'm a bit lost with terminology, so I can't say what's that table. Anyway, it has jumps to all the functions you're using. It can be found at 401005h.

0xE9 is a far jmp, isn't it :)
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