Hi, i have some trouble with the api-funktion terminate process.
I searched after tuts, but didnt find anything.

Can someone tell me how exactly use zhis funktion ?

for example, we want to terminate hostesse.exe. - How get the file path and terminate this prog.

Posted on 2003-02-28 13:24:42 by Forginforcer
Moved from MASM32...
Posted on 2003-02-28 13:55:20 by bazik
Red Forginforcer,

I just worked this out for some of my code. On a NT/W2K/XP box you get the right type of process handle otherwise it will not terminate. OpenProcess must be called with the PROCESS_TERMINATE flag ONLY or the handle will not function with TerminateProcess.

W9X is not so picky.

KillNT: mov eax,hProc
invoke OpenProcess, PROCESS_TERMINATE, 1, eax
invoke TerminateProcess, eax, TRUE

Kill9X: invoke OpenProcess, PROCESS_VM_OPERATION, 1, l_PROCESSENTRY32.th32ProcessID
invoke TerminateProcess, eax, TRUE

Regards, P1

PS: Let me know, if you need a larger code snippet. And what OS it's for. I will check back on Monday.
Posted on 2003-02-28 15:29:43 by Pone
Thx, the Problem ist half slved.
You kan see the code, i used under my Tread last tread, ist shouldn hart to find.

I have an exe-file running, named MXTask.exe but i cant terminate ist, with the Taksmanager it works, but with my ode not.
Posted on 2003-03-01 03:21:36 by Forginforcer