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 


DLL

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

Joined: 27 Dec 2010
Posts: 32

PostPosted: Tue Apr 01, 2014 6:49 pm    Post subject: DLL Reply with quote

Hey, I have some problem for long time

When I call class function in cheat engine it's all fine, but when I'm trying to call it in Dev-C++ (C project, not C++) the DLL won't be even able to inject, but it compiles with no problem.

Dev C++ Code:

Code:
void someFunction()
{
     __asm(
           "mov (0x553110),%ecx;"
           "mov 0xf3c(%ecx),%ecx;"
           "mov 0xc54(%ecx),%ecx;"
           "call *0x4A242A;"
           );
}

BOOL APIENTRY DllMain (HINSTANCE hInst,DWORD reason,LPVOID reserved)
{
    switch (reason)
    {
      case DLL_PROCESS_ATTACH:
           someFunction();
        break;
       
        case DLL_PROCESS_DETACH:
        break;
    }
    return TRUE;
}


ECX is ofcourse address of the class

Any solutions? :/
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Tue Apr 01, 2014 11:23 pm    Post subject: Reply with quote

The way you are trying to call it is never going to work because you are just injecting, and calling.

You are just messing up the registers entirely with your code given that you are not preserving what is already there, as well as that you are just assuming what ever is currently in ECX is going to be what you need.

Another thing to note, Dev-C++ is years old, unsupported, unmaintained, and uses an extremely old compiler. You are better off upgrading to something else, such as Visual Studio.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Demolish
Cheater
Reputation: 0

Joined: 27 Dec 2010
Posts: 32

PostPosted: Wed Apr 02, 2014 10:51 pm    Post subject: Reply with quote

Oh My God, this is so retarded, now i got it to work
Code:
void someFunction(){
     int CallAddress=0x4A242A;
     __asm(
           "movl (0x553110),%ecx;"
           "movl 0xf3c(%ecx),%ecx;"
           "movl 0xc54(%ecx),%ecx;"
           "call *-4(%ebp);"
           );
}


Idk why this method works, and why my previous tries are "bad".
But I can agree that Dev-C++ is little out of date.


AND 1 MORE QUESTION
Is it possile to call __thiscall in any other way?
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Thu Apr 03, 2014 3:05 pm    Post subject: Reply with quote

You can make __thiscall calls by converting them to __fastcall. You can also use type casting on pointers to make calls to the address instead of inline ASM.

I still encourage you greatly to change compilers/IDEs though since you are using extremely dated stuff.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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