[windows 98]
How do I go about killing a process running, which is not visible in the Windows Task Manager, when I have the process file name? (i.e.) mega.exe . (I want to be able to do this with my program).
[windows 98]
How do I go about killing a process running, which is not visible in the Windows Task Manager, when I have the process file name? (i.e.) mega.exe . (I want to be able to do this with my program).
Use the kill method:
http://msdn.microsoft.com/library/de...skilltopic.asp
That's only if you're using .NET, I believe.
http://www.google.com/search?hl=en&i...=Google+Search
I'd like to help you more, but my mind's drawing a blank. I believe there's a TerminateProcess() function in windows.h, but I know you need the handle of the process, and I can't remember how to get that. Sorry.
hmm i'm not sure either, it said windows98 in the platform list so i assumed it would, i think theres a line like
hProcess = openprocess(CLOSE_PROCESS, TRUE, <name of process)
something like that, i know i've seen it. Lemme look round google some.
I would use EnumProcesses() to get the process ID, then OpenProcess() to get it's handle, then TerminateProcess() to kill it, but I'd have to have a really good reason for doing so as it can be dangerous.
Look at those functions in the help or MSDN.
Of course, if I wanted to run a process that could not be tracked, I would have "mega.exe" just create and launch another process, so the process name had nothing in common with the file name.
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
You could also enumerate processes with Process32First() and Process32Next().Originally posted by adrianxw
I would use EnumProcesses() to get the process ID, then OpenProcess() to get it's handle, then TerminateProcess() to kill it, but I'd have to have a really good reason for doing so as it can be dangerous.
This is better because the structure returned by these functions contains the name of the exe file.
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
>>> You could also enumerate processes with Process32First() and Process32Next().
Yup, you certainly could, but again, if you only know the name of the executable your launched, you may not find it in the current processes. If I was being "stealthy" I would have the launched process basically a dummy who's sole purpose in life was to launch other processes. Kill the launcher - but the spy is still there, <fx> X files music </fx>.
I tend to use EnumProcesses() because that is always the way I have done it. In many cases, there are more than one way to do things with mature operating systems. I don't know, but I wouldn't mind guessing that Process32First() does what I am doing internally.
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
Yeah, you could take a snapshot using CreateToolhelp32Snapshot.
Then, use Process32First and after that, use Process32Next.
When going through the Processes, check if the process name equals the one that you are looking for.
If you find it, use OpenProcess with the Process ID that is in your PROCESSENTRY32 struct to open the process.
From here, call TerminateProcess with the handle that you get from OpenProcess.
For an explanation, check here