Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding
You last visited: Today at 05:45

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Having trouble hooking WM messages

Discussion on Having trouble hooking WM messages within the General Coding forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jun 2010
Posts: 1
Received Thanks: 0
Having trouble hooking WM messages

Basically i need some sort of trigger to make my injected dll do what it needs to do, at first i used createremotethread but it soon became apparent to me that its not a viable option as the target program likes to move its memory around alot and constantly renewing the function handle would be very tedious. So i figured id go for something more high level and decided to try and hook windows messages. Heres whats inside the injected dll:

Code:
LRESULT CALLBACK MyWndProc(UINT Msg, WPARAM wParam, LPARAM lParam)
{
	if (Msg == WM_USER+100) 
	{
		UnHook;
	} else if (Msg == WM_USER+101) {
		SendMessage(HWND_BROADCAST, 0, 0x1337, 0x1337);
	}
  return CallNextHookEx(MsgHook, Msg, wParam, lParam);
}
	MsgHook = SetWindowsHookEx(WH_CALLWNDPROC, (HOOKPROC)MyWndProc, (HINSTANCE)hInst, GetCurrentThreadId());
When i inject the thing everything seems ok, the unhook seems to work but when i try to send a message with WM_USER+101 the target program crashes, hard(like 3 crash messages!)

any ideas?

EDIT: ok appears the crashing was a secondary problem caused by something totally unrelated, now that it doesent crash tho it just does nothing at all, i tried changing message to 0 (WM_NULL) to see if it even gets anything but it doesent :/
hazarada is offline  
Old 07/01/2010, 20:27   #2
 
elite*gold: 20
Join Date: Sep 2006
Posts: 1,100
Received Thanks: 184
dewd, what do you think will GetCurrentThreadId() return in a thread created by create remote thread?
use your brain and you'll understand why your windowhook does nothing at all.
Bot_interesierter is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
C++ D3D Hooking
08/24/2009 - C/C++ - 12 Replies
Hallo zusammen, ich stehe gerade vor folgendem Problem: ich habe eine DLL und einen Loader gecoded, jedoch will ich anstelle des Loader einen Injecter haben, sprich: das spiel, in das injected werden soll, soll schon laufen. Natürlich hab ich das ganze schon probiert, jedoch werden die D3D-funktionen nicht wirklich gehookt, da die DLL auf ein Direct3DCreate9 wartet. Da diese Funktion aber wahrscheinlich direkt beim Starten des "Opfer-Spiels" ausgeführt wird, werden deswegen die anderen...
D3D Hooking [autoit]?
04/17/2009 - GW Bots - 11 Replies
edited
hooking lua_CFunctions
04/27/2008 - WoW Exploits, Hacks, Tools & Macros - 10 Replies
leute die damit was anfangen können ^^ hier schenk ich euch, ich danke kynox da er so freundlich war mir das mitzuteilen 2 parameters: eax = addresse von der CFunction, ecx = name das lua verwendet 00692440 > 55 PUSH EBP 00692441 8BEC MOV EBP,ESP 00692443 56 PUSH ESI 00692444 E8 A7FFFFFF CALL WoW.006923F0 ; mov eax, L ( the lua_State ) 00692449 8BF0 MOV ESI,EAX 0069244B 8B45 0C MOV...
[BIETE] API Hooking
06/18/2006 - Tutorials - 2 Replies
http://xalonsspace.xa.funpic.de/api-hooking.html Viel Spaß,würde mich über Feedback freuen ;)



All times are GMT +1. The time now is 05:46.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.