 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Fri Apr 09, 2010 6:15 pm Post subject: SendMessage |
|
|
My SendMessage hookhop won't work, do you see any errors in my code?
| Code: |
DWORD SendMessageAddress = (DWORD) GetProcAddress(GetModuleHandle(_T("user32.dll")), "SendMessage") + 5;
LRESULT SendMessageX(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
__asm
{
MOV EDI,EDI
PUSH EBP
MOV EBP,ESP
JMP [SendMessageAddress]
}
}
|
| Quote: |
Unhandled exception at 0x00000005 in Run.exe: 0xC0000005: Access violation.
|
|
|
| Back to top |
|
 |
Deine Mutter Expert Cheater
Reputation: 1
Joined: 05 Apr 2006 Posts: 181
|
Posted: Fri Apr 09, 2010 6:41 pm Post subject: |
|
|
I think you have to get the address of "SendMessageA" or "SendMessageW" (A = ANSI, W = UNICODE), since a function named "SendMessage" is not exported by user32.dll, but im not really sure.
_________________
|
|
| Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Fri Apr 09, 2010 6:49 pm Post subject: |
|
|
@Deine Mutter
| Quote: |
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
|
| Code: |
DWORD SendMessageAddress = (DWORD) GetProcAddress(GetModuleHandle(_T("user32.dll")), "SendMessageA") + 5;
LRESULT SendMessageX(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
__asm
{
mov edi,edi
push ebp
mov esp, ebp
jmp [SendMessageAddress]
}
}
|
|
|
| Back to top |
|
 |
Deine Mutter Expert Cheater
Reputation: 1
Joined: 05 Apr 2006 Posts: 181
|
Posted: Fri Apr 09, 2010 6:55 pm Post subject: |
|
|
| Code: | __declspec(naked) LRESULT SendMessageX(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
__asm
{
mov edi,edi
push ebp
mov esp, ebp
jmp [SendMessageAddress]
}
} |
try this
_________________
|
|
| Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Sat Apr 10, 2010 10:31 am Post subject: |
|
|
My program encounters a breakpoint if I use that code, hmm, this is wierd. I looked in the user32 dll and I looked at the opcodes and it was right, I don't see what causing a problem.
| Code: |
DWORD SendMessageAddress = (DWORD) GetProcAddress(GetModuleHandleA("user32.dll"), "SendMessageA") + 5;
__declspec(naked) LRESULT WINAPI SendMessageX(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
__asm
{
mov edi,edi
push ebp
mov esp, ebp
jmp [SendMessageAddress]
}
}
|
EDIT
| Code: |
DWORD SendMessageAddress = (DWORD) GetProcAddress(GetModuleHandleA("user32.dll"), "SendMessageA") + 5;
LRESULT WINAPI SendMessageX(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
__asm
{
mov edi,edi
push ebp
mov esp, ebp
jmp [SendMessageAddress]
}
}
|
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sat Apr 10, 2010 11:58 am Post subject: |
|
|
| iPromise wrote: | | My program encounters a breakpoint if I use that code, hmm, this is wierd. I looked in the user32 dll and I looked at the opcodes and it was right, I don't see what causing a problem. |
the rest of your code that you didn't copy from somewhere : post it
|
|
| 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
|
|