ProcessHandle

c++ / delphi package - dll injection and api hooking
Post Reply
Taner
Posts: 13
Joined: Sun Oct 24, 2004 8:14 am

ProcessHandle

Post by Taner »

I want to Hook Winsock in my running Process with Inject Library, but I need the processHandle for it. How can I get it? The exe-name is tibia.exe and the class-name is 'tibiaclient'
Coffein
Posts: 3
Joined: Sat Oct 23, 2004 3:22 pm

Post by Coffein »

FindWindow would be the easy way to go.
Try
var h : cardinal;
h := FindWindow('tibiaclient', nil);
InjectLibrary(h, 'yourdll.dll');
Taner
Posts: 13
Joined: Sun Oct 24, 2004 8:14 am

Post by Taner »

FindWindow returns the HWND (Window Handle) not the Process Handle.
Coffein
Posts: 3
Joined: Sat Oct 23, 2004 3:22 pm

Post by Coffein »

Ah, I'm sorry it's like this:

var h : cardinal;
ph, pid : cardinal;
begin
h := FindWindow('tibiaclient', nil);
GetWindowThreadProcessID(h, @pid);
ph := OpenProcess(PROCESS_ALL_ACCESS, false, pid);
InjectLibrary(ph, 'yourdll.dll');
Sirmabus
Posts: 89
Joined: Fri May 28, 2004 6:20 pm

Post by Sirmabus »

"GetCurrentProcess()"

MSDN reference is your friend :D

I take it this is for: http://www.tibia.com

You shouldn't hook send()/recv() globaly and then determin where it's comming from.
Why not directly hook them in "tibia.exe"?
Not only is it easier then, it's more efficent.
nildo
Posts: 249
Joined: Mon Mar 22, 2004 11:32 am
Contact:

Post by nildo »

declare MadKernel and use: Process( 'tibia.exe' ).Handle or .ID for the ProcessID
Post Reply