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 


[HELP] inlining ASM to c++

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

Joined: 15 Sep 2009
Posts: 5

PostPosted: Thu Dec 03, 2009 11:54 pm    Post subject: [HELP] inlining ASM to c++ Reply with quote

i know a little bit in putting asm in VC++
But im stucked in the loadbinary thingy....
like this:


Code:
[enable]
alloc(newmem,2048)
alloc(dump,3140018) // Dump size
LABEL(ret)
loadbinary(dump, ew.CEM)

newmem:
cmp ecx,00400000
jb @f
cmp ecx,00A00000
ja @f
add ecx, dump-00400000
@@:
// Original code
MOV EAX,[EBP+10]
DB 56 57
JMP ret


00499CEB:
jmp newmem // Jump to hook

[disable]
00499CEB:
mov eax,[ebp+10]
push esi
push edi

dealloc(newmem)
dealloc(blaaaa)


i now that in asm i should write like this:

void__declspec(naked) __stdcall ...()
{
_asm

{
newmem:
cmp ecx,00400000
jb @f
cmp ecx,00A00000
ja @f
add ecx, dump-00400000
@@:
// Original code
MOV EAX,[EBP+10]
DB 56 57
JMP ret}

}

but i know its lacking because the loadbinary() is not there......

Please any one help...

or if you could directly convert the code that i posted in C++ i would be happy for me to learn and see how it is made....

Thanks
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Fri Dec 04, 2009 3:57 am    Post subject: Reply with quote

Read the file to unsigned char array and there you go. For C++, that is std::fstream
Back to top
View user's profile Send private message
`unknown
Grandmaster Cheater
Reputation: 0

Joined: 20 Nov 2006
Posts: 658
Location: You lost the game.

PostPosted: Fri Dec 04, 2009 6:04 pm    Post subject: Reply with quote

Trying to bypass CRC in the game which is not to be named here any longer I see, that isn't the right function to hook but anyway...

Code:

LPVOID __stdcall LoadBinary(__in size_t len)
{
   LPVOID lpvRet;
   lpvRet = VirtualAlloc(NULL, len, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
   // feel free to change the protection if needed

   if(lpvRet == NULL)
      return NULL;
   
   __try {
      // feel free to change this too
      memcpy(lpvRet, (void*)0x400000, len);
   }

   __except(1)
   {
      return NULL;
   }

   return lpvRet;
}

LPVOID lpvCopy = LoadBinary(0x600000);
if(lpvCopy == NULL)
{
   // Error handling here
}
Back to top
View user's profile Send private message MSN Messenger
rod143
How do I cheat?
Reputation: 0

Joined: 15 Sep 2009
Posts: 5

PostPosted: Sat Dec 05, 2009 6:46 am    Post subject: Reply with quote

thanks..... LPVOID __stdcall.... can it be written as VOID __stdcall?

........ how do i call that script from the inline?
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Sat Dec 05, 2009 7:07 am    Post subject: Reply with quote

LPVOID = void*
and you just call the function's name
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