View previous topic :: View next topic |
Author |
Message |
Demolish Cheater
Reputation: 0
Joined: 27 Dec 2010 Posts: 32
|
Posted: Tue Apr 01, 2014 6:49 pm Post subject: DLL |
|
|
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 |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Tue Apr 01, 2014 11:23 pm Post subject: |
|
|
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 |
|
 |
Demolish Cheater
Reputation: 0
Joined: 27 Dec 2010 Posts: 32
|
Posted: Wed Apr 02, 2014 10:51 pm Post subject: |
|
|
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 |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Thu Apr 03, 2014 3:05 pm Post subject: |
|
|
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 |
|
 |
|