 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
angerist Grandmaster Cheater Supreme
Reputation: 0
Joined: 18 Jun 2007 Posts: 1011 Location: Australia.
|
Posted: Fri Jul 04, 2008 12:50 am Post subject: [C++] Calling functions within a process |
|
|
Alright as you see bellow this is the source that I've created in about 30 minutes. I compiled it successfully and without error. I've been researching dll's and how they work, and calling functions within a process.
Addy I used
| Code: | | SpamHack1: 0x0046EC10 |
I get no response when injecting the dll to MapleStory.exe. What is my error. Thank you fellow Cef members
Final Source:
| Code: | #include "stdafx.h"
#include "dos.h"
void MainLoop()
{
void *addyres = (void*)0x0046EC10;
MessageBox(0,"About to call the function..","Calling",MB_OK);
__asm
{
call [addyres]
}
return;
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch(ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hModule);
CreateThread(NULL, 0, (unsigned long(__stdcall*)(void*))MainLoop, NULL, 0, NULL);
}
return TRUE;
} |
_________________
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Fri Jul 04, 2008 1:22 am Post subject: |
|
|
Call GetLastError() and debug
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Fri Jul 04, 2008 1:38 am Post subject: |
|
|
Don't define your address that way, define it this way.
| Code: |
LPVOID addyres = 0x0046EC10;
|
Also, is your function address a dynamic address, and I'm not quite sure, but you maybe should try:
I believe that you can do a singe line of assembly like that.
And you should use CreateThrread like this (if you have your function defined in dos.h which I assume you do, then just use it like this and leave out your assembly and address declaration.
| Code: |
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)SpamHack1, NULL, 0);
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
Last edited by oib111 on Fri Jul 04, 2008 1:43 am; edited 1 time in total |
|
| Back to top |
|
 |
angerist Grandmaster Cheater Supreme
Reputation: 0
Joined: 18 Jun 2007 Posts: 1011 Location: Australia.
|
Posted: Fri Jul 04, 2008 1:42 am Post subject: |
|
|
I'll test those suggestions and reply. Thanks you two.
I've researched the little snippet you gave me and didn't find much. But I tried it and got the following error . " error C2440: 'initializing' : cannot convert from 'const int' to 'void *". Oh well. Im sure we can figure it out. I'll do some more googling and post any useful info that I find.
| Code: | #include "stdafx.h"
#include "dos.h"
void MainLoop()
{
LPVOID addyres = 0x0046EC10;
MessageBox(0,"About to call the function..","Calling",MB_OK);
__asm
{
call [addyres]
}
return;
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch(ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hModule);
CreateThread(NULL, 0, (unsigned long(__stdcall*)(void*))MainLoop, NULL, 0, NULL);
}
return TRUE;
} |
_________________
|
|
| Back to top |
|
 |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Fri Jul 04, 2008 10:28 am Post subject: |
|
|
void* func() = 0x0046EC10;
func();
No need for ASM.
Are you sure it doesn't take any arguments and doesn't return anything?
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Fri Jul 04, 2008 11:35 am Post subject: |
|
|
Ok, where is SpamHack1 defined? If it is defined in dos.h just do this:
| Code: |
#include "stdafx.h"
#include "dos.h"
BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call,
LPVOID lpReserved)
{
if(ul_reason_for_call == DLL_PROCESS_ATTACH) {
DisableThreadLibraryCalls(hModule);
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)SpamHack1, NULL, 0, NULL);
}
return TRUE;
}
|
Edit:
Are you using Visual Studio or Dev-C++?
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
angerist Grandmaster Cheater Supreme
Reputation: 0
Joined: 18 Jun 2007 Posts: 1011 Location: Australia.
|
Posted: Fri Jul 04, 2008 9:28 pm Post subject: |
|
|
Im coding in VS++ . I'll try those things out. And repost.
_________________
|
|
| Back to top |
|
 |
|
|
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
|
|