简体   繁体   中英

How to get all the processes with a specified name in NSIS installer

I want to kill RunDll32 process which is started from my install directory.

So if I use

${nsProcess::KillProcess} "rundll32.exe" $R0

It kills all the rundll32 processes on the system which I don't want to happen.

IMO, I have two options to fix this, 1. Identify interested process from commandline parameters 2. Identify from process startup directory (current directory).

I see there are few plugins to find the process but what they do is they just return found or not found. Instead I want IDs of the processes or list of these processes and then I'll check each process for command line or startup directory information and will act on the the required process.

BTW, I checked following plugins

http://nsis.sourceforge.net/FindProcDLL_plug-in

http://nsis.sourceforge.net/Processes_plug-in

http://forums.winamp.com/showthread.php?t=230998

Thanks

If you control the .dll then the best option is to provide some sort of way to shutdown the app in a clean way. Perhaps you could find a window based on its class name and send it a WM_CLOSE message.

If you just need to shutdown the application during upgrade/uninstall then the LockedList plug-in is much better than just killing processes...

I fixed by using wmic query as follows:

StrCpy $1 "wmic Path win32_process where $\"name  like 'Rundll32.exe' and CommandLine like '%$0%'$\" Call Terminate"
nsExec::Exec $1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM