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 


SendMessage

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Fri Apr 09, 2010 6:15 pm    Post subject: SendMessage Reply with quote

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
View user's profile Send private message MSN Messenger
Deine Mutter
Expert Cheater
Reputation: 1

Joined: 05 Apr 2006
Posts: 181

PostPosted: Fri Apr 09, 2010 6:41 pm    Post subject: Reply with quote

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
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Fri Apr 09, 2010 6:49 pm    Post subject: Reply with quote

@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
View user's profile Send private message MSN Messenger
Deine Mutter
Expert Cheater
Reputation: 1

Joined: 05 Apr 2006
Posts: 181

PostPosted: Fri Apr 09, 2010 6:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Sat Apr 10, 2010 10:31 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Sat Apr 10, 2010 11:58 am    Post subject: Reply with quote

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
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