by ndesktop » Wed May 23, 2018 12:48 am
NPAPI plugins are not supported for some time (I assume you are using an older version of CEF).
So, assuming your app is named app.exe, the plugin process should be app.exe --type=plugin (if I remember well).
Normally the plugin subprocess should terminate, but if this is not the case, here is what I've done in the past:
- have a cleanup process (say appcp.exe - CP = cleanup process)
- appcp.exe is launched from app.exe (appcp --pid=app.exe PID) => app.exe PID
- appcp.exe uses the app.exe PID to opens a handle to app.exe (browser, main instance) and waits indefinitely (WaitForSingleObject INFINITE)
- when app.exe closes, the handle is signaled to appcp.exe
- appcp.exe enumerates the processes (CreateToolhelpSnapshot) which (1) have the same path as app.exe and (2) have the parent process PID the one used to launch appcp.exe)
- collects the "orphans" app.exe PIDs, if any
- for each orphan process, appcp.exe
1. (optional) gets the command line if needed (some ntdll things are needed here if you really want to check also if --type=plugin is present in the command line of the orphan process)
this if you need to really validate is a plugin process
2. for each orphan process kill the orphan PID (OpenProcess with TERMINATE and then call TerminateProcess)
I know, is not pleasant, but if for some reason you need this to be done, this is what I've done.