How can i find process handle if i only know it's name, is it there some API?
Posted on 2006-06-07 12:14:14 by SET
You would have to do a process walk and check against each process. If you know the window caption or class name you can find it by obtaining a handle to the window and using GetWindowThreadProcessID
Posted on 2006-06-07 12:35:44 by donkey
Well if I understand you correctly, you want to open a process but you only know the process' name. You can use something like this to get a process id and then open the process using OpenProcess.

MAX_PROC equ 256

frame szProcess
local dwBytes, szModule:b, aProcess:d

push ebx

invoke EnumProcesses, offset aProcess, MAX_PROC*4, offset dwBytes

mov ebx,

invoke OpenProcess, PROCESS_ALL_ACCESS, 0,
or eax, eax
jz > .next

push ebx
mov ebx, eax

invoke GetModuleBaseNameA, eax, 0, offset szModule, MAX_PATH
invoke lstrcmpA, offset szModule,
push eax

push ebx
call CloseHandle

pop eax, ebx
or eax, eax
jz > .found

sub ebx, 4
or ebx, ebx
jnz L1

pop ebx


mov eax,
pop ebx


Posted on 2006-06-07 12:38:02 by mr.schyte
thnx, this is whot i need )
Posted on 2006-06-07 14:21:27 by SET