Hi, as the Topic already says, i have problems to get pathname.
I think I have to use a specify command. Can someone help me please ?
Posted on 2003-03-06 13:27:52 by Forginforcer
Moved your post to main and shortened the topic title (please don't include thinks like 'please help' etc. in the topic title). To answer your question, look into the toolhelp API. It can enumerate all processes, just find the right ID in the list and get the process filename.

Thomas
Posted on 2003-03-06 13:35:37 by Thomas
Sere's some C source I found a while ago, maybe that'll help.
Posted on 2003-03-06 14:55:36 by Tola
Posted on 2003-03-06 15:02:11 by Hiroshimator
Look into psapi\asm\Example\enumproc.asm
Posted on 2003-03-06 17:05:23 by Eviloid
Dear Thomas, I did not find, what i want. Can you help me again ?
I search for it, but cant find.

mfg R-F
Posted on 2003-03-07 05:51:07 by Forginforcer
Thomas is referring to CreateToolhelp32Snapshot and related API's. They are also mentioned in Hiro's link.
Posted on 2003-03-07 06:15:44 by Qweerdy
Hi, this is a very pretty board !
Thanks a lot !
Posted on 2003-03-07 08:35:08 by Forginforcer
hello here, i stick.
Can someone help me again ?
hProcess i found out to get, but what i have to do now ?
I tryed to use the commands, written in "Eviloid" source.

terminate PROC
LOCAL hProcess:dword
LOCAL hMod:dword

INVOKE lstrcpy, EDI, ADDR terminatetemp
mov edi, eax
xor ecx, ecx
invoke lstrlen, eax
.while ecx!=eax
.if byte ptr ==" "
inc edi
mov , edi
.break
.endif
inc ecx
inc edi
.endw
cmp ecx, eax
je done
mov , sizeof uProcess
invoke CreateToolhelp32Snapshot, 2, 0
mov , eax
invoke Process32First, eax, ADDR uProcess
.while eax
xor ecx, ecx
lea edi,
mov ebx, edi
dec ebx
invoke lstrlen, edi
add edi, eax
.while edi!=ebx
invoke lstrcmpi, edi,
.if !eax
invoke OpenProcess, PROCESS_TERMINATE, 1,
mov hProcess, eax
invoke TerminateProcess, eax, 0
jmp done
.endif
; optimize this
dec edi
.endw
invoke Process32Next, , ADDR uProcess
.endw
done: invoke CloseHandle,
ret
terminate ENDP
Posted on 2003-03-07 09:56:05 by Forginforcer
If you already have a good process handle, you can just invoke TerminateProcess,hProcess,0

Actually this is exactly what the source you posted tries to do. Is this the code you're trying to get to work, or is this what you're basing your code on?

If this is the code please post the declarations for the globals you're using in this code (pszParam, uProcess)
Posted on 2003-03-07 11:16:03 by Qweerdy
That code is only good on W9X/WME.

BTW, the pspsi.zip gives what you need for NT,W2K & XP.

Regards, P1
Posted on 2003-03-07 12:01:32 by Pone
yup, thats the whole source now. Perhaps someone can say me, i use the GetModuleFilename according to my source:

terminate PROTO

.data
terminatetemp db "explorer.exe", 0
terminate1 db "hostess.exe hostess.exe", 0

.data?
pszParam dd ?
hSnapshot dd ?
uProcess PROCESSENTRY32 <>
szProcessName db MAX_PATH dup (?)
cbNeeded dword ?

.code
INVOKE lstrcpy, ADDR terminatetemp, ADDR terminate1
INVOKE terminate

terminate PROC
LOCAL hProcess:dword

INVOKE lstrcpy, EDI, ADDR terminatetemp
mov edi, eax
xor ecx, ecx
invoke lstrlen, eax
.while ecx!=eax
.if byte ptr ==" "
inc edi
mov , edi
.break
.endif
inc ecx
inc edi
.endw
cmp ecx, eax
je done
mov , sizeof uProcess
invoke CreateToolhelp32Snapshot, 2, 0
mov , eax
invoke Process32First, eax, ADDR uProcess
.while eax
xor ecx, ecx
lea edi,
mov ebx, edi
dec ebx
invoke lstrlen, edi
add edi, eax
.while edi!=ebx
invoke lstrcmpi, edi,
.if !eax
invoke OpenProcess, PROCESS_TERMINATE, 1,
mov hProcess, eax
invoke TerminateProcess, eax, 0
jmp done
.endif
; optimize this
dec edi
.endw
invoke Process32Next, , ADDR uProcess
.endw
done: invoke CloseHandle,
ret
terminate ENDP

MfG: Red Forginforcer
Posted on 2003-03-07 15:04:12 by Forginforcer