View previous topic :: View next topic |
Author |
Message |
selethd How do I cheat?
Reputation: 0
Joined: 20 May 2009 Posts: 3
|
Posted: Mon Aug 22, 2011 8:20 pm Post subject: Help getting window handle from inside injected dll |
|
|
I have a .dll that is injected into a game process, when the game loads.
once the.dll is loaded, in its init, it.....
hooks the send and recieve functions of the game
creates a thread
in the thread it creates a window to display the contents of the hooked send and recv winsock functions
What I would like is for my .dll's created window, to position itself alongside the game's window, and if hte game's window is moved, for the dll's window to move also.
So I need a way to have my thread check the position of the host games window.
How can I get a handle to this window from the Init phase of my injected .dll?
I have searched all over the net, and people say to send the windows handle by letting the injector get the handle and pass it to the .dll, but the game itself loads my dll. So I really need the .dll to get this from within the process.
im using c++ on a windows system 32bit win7
thanks for any help, im still sort of a noob at all of this injectiion and hooking stuff.
|
|
Back to top |
|
 |
atom0s Moderator
Reputation: 204
Joined: 25 Jan 2006 Posts: 8579 Location: 127.0.0.1
|
Posted: Mon Aug 22, 2011 9:04 pm Post subject: |
|
|
You could go about it a few ways:
Use FindWindow with a specific class / window name that you are sure of belongs to the game. Typically you wont run into issues with things having the same class name if you plan on cheating a single client game. (Things that wont have multiple clients open etc.)
Use EnumWindows to enumerate the windows on the machine to attempt to locate the one that matches the game. You can use the window title to try to find a match.
Use EnumThreadWindows with the processes main thread id so you can directly iterate through the current processes windows only.
You can also hook CreateWindowExA/CreateWindowExW (or whatever it uses to create the window) and store the handle after it is created inside your dll.
_________________
- Retired. |
|
Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Wed Aug 24, 2011 3:40 pm Post subject: |
|
|
subclass the window so when it gets a wm_move, it forwards it to your window then calls the next procedure in the hook chain
|
|
Back to top |
|
 |
|