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 


HookHopping Problem

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
ralphmigcute
Newbie cheater
Reputation: 0

Joined: 10 Jan 2010
Posts: 16

PostPosted: Wed May 30, 2012 11:51 am    Post subject: HookHopping Problem Reply with quote

Quote:

DWORD Tors = (DWORD)GetProcAddress(GetModuleHandle("user32.dll"), "SendMessageA" ) +5;

_declspec(naked) BOOL WINAPI XSendMessage(__in HWND hWnd, __in UINT Msg, __in WPARAM wParam, __in LPARAM lParam)
{
_asm
{
mov edi,edi
push ebp
mov ebp,esp
jmp [Tors]
}

}


It crashes my program Sad what is the mistake?

_________________
hello ralph
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25831
Location: The netherlands

PostPosted: Wed May 30, 2012 12:30 pm    Post subject: Reply with quote

At what part does it crash? When you call XSendMessage or at another part ?

here are some possibilities:

If not yet hooked:
Perhaps your program is compiled as 64-bit

If hooked:
perhaps the hook starts at the push ebp
Perhaps sendmessage has been hooked in kernelmode and relies on the usermode part to provide a special key

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
ralphmigcute
Newbie cheater
Reputation: 0

Joined: 10 Jan 2010
Posts: 16

PostPosted: Wed May 30, 2012 1:10 pm    Post subject: Sir Reply with quote

Dark Byte wrote:
At what part does it crash? When you call XSendMessage or at another part ?

here are some possibilities:

If not yet hooked:
Perhaps your program is compiled as 64-bit

If hooked:
perhaps the hook starts at the push ebp
Perhaps sendmessage has been hooked in kernelmode and relies on the usermode part to provide a special key


I am using x86 and i am compiling using x86 but still crashes Sad

When i call XSendMessage in WM_CREATE:

I am using Visual C++ 2010 i am coding a dll.

_________________
hello ralph


Last edited by ralphmigcute on Wed May 30, 2012 1:14 pm; edited 1 time in total
Back to top
View user's profile Send private message
Obitio
Advanced Cheater
Reputation: 0

Joined: 09 Apr 2012
Posts: 68
Location: null

PostPosted: Wed May 30, 2012 1:14 pm    Post subject: Re: Sir Reply with quote

ralphmigcute wrote:
Dark Byte wrote:
At what part does it crash? When you call XSendMessage or at another part ?

here are some possibilities:

If not yet hooked:
Perhaps your program is compiled as 64-bit

If hooked:
perhaps the hook starts at the push ebp
Perhaps sendmessage has been hooked in kernelmode and relies on the usermode part to provide a special key


I am using x86 and i am compiling using x86 but still crashes Sad

I am using Visual C++ 2010 i am coding a dll.

lol whenever I try to hook stuff I can't do it either.I guess it may be a problem with 86-bit?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25831
Location: The netherlands

PostPosted: Wed May 30, 2012 3:53 pm    Post subject: Reply with quote

Go through it with a debugger and see if you can find out why it goes wrong
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
ralphmigcute
Newbie cheater
Reputation: 0

Joined: 10 Jan 2010
Posts: 16

PostPosted: Thu May 31, 2012 1:05 am    Post subject: Dark Reply with quote

Dark Byte wrote:
Go through it with a debugger and see if you can find out why it goes wrong


i found the problem:

(DWORD)GetProcAddress(GetModuleHandle(L"user32.dll"),"SendMessageW");

does not return any value but always 0 Sad

_________________
hello ralph
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25831
Location: The netherlands

PostPosted: Thu May 31, 2012 2:49 am    Post subject: Reply with quote

Try
GetModuleHandleA("user32.dll")

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
ralphmigcute
Newbie cheater
Reputation: 0

Joined: 10 Jan 2010
Posts: 16

PostPosted: Thu May 31, 2012 2:52 am    Post subject: still 0 Reply with quote

Dark Byte wrote:
Try
GetModuleHandleA("user32.dll")



Still 0 Sad and already tried GetModuleHandleW

_________________
hello ralph
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25831
Location: The netherlands

PostPosted: Thu May 31, 2012 3:01 am    Post subject: Reply with quote

Does GetModuleHandle return 0 or GetProcAddress ? (split into 2 lines to see)
If GetModuleHandle returns 0, try LoadLibrary

If GetProcAddress returns 0, go parse the pe header manually (it's base address of module+virtual address of export)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
ralphmigcute
Newbie cheater
Reputation: 0

Joined: 10 Jan 2010
Posts: 16

PostPosted: Thu May 31, 2012 3:46 am    Post subject: dark Reply with quote

Dark Byte wrote:
Does GetModuleHandle return 0 or GetProcAddress ? (split into 2 lines to see)
If GetModuleHandle returns 0, try LoadLibrary

If GetProcAddress returns 0, go parse the pe header manually (it's base address of module+virtual address of export)


LoadLibrary and GetModuleHandle is not working Sad always return 00000000

is there any alternative? sir?

i did this:

HINSTANCE hmod = LoadLibrary(TEXT("user32.dll"));

still 00000000

_________________
hello ralph
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25831
Location: The netherlands

PostPosted: Thu May 31, 2012 4:51 am    Post subject: Reply with quote

Does your code even execute ?
Also, try using getlasterror to find the errorcode and look up why it fails

Also, if you're loading it in your dll entrypoint, you must use LoadLibraryA("user32.dll")

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
ralphmigcute
Newbie cheater
Reputation: 0

Joined: 10 Jan 2010
Posts: 16

PostPosted: Thu May 31, 2012 5:48 am    Post subject: Sir Reply with quote

thanks for all sir Dark Smile i already fixed it Smile
_________________
hello ralph
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