Watchdog/execute: allow any type of file?

Started by Autumner, August 05, 2019, 07:03:54 PM

Previous topic - Next topic

Autumner

Hello everyone,

Trying out the brilliant Process Watchdog. I noticed that when selecting "execute", only .exe files are allowed for execution in the launch path box. Would it be feasible to lift this restriction? It would be very helpful being able to also run various scripts, shortcut files etc.

As a workaround, I tried to simply paste the path to a non-exe file inside the launch path box - but it doesn't work.

Jeremy Collake

I'll definitely take a look at it, and probably change that in short order.

For the moment, I'd advise to launch a script (or other file type) by way of its executable handler, e.g. 'cmd.exe /C mybatch.bat' or 'powershell.exe -File myscript.ps1'

Thanks for the feedback!
Software Engineer. Bitsum LLC.

Autumner

Thank you for the tip. After some trial & error, I think I got something working although I still hope it won't be too much work for you to lift that restriction.

I've seen this restriction (only .exe files allowed) on other programs too (totally unrelated to PL) and wondered why, perhaps it's a security measure to prevent users from making questionable selections? Perhaps it's something else.


Jeremy Collake

It is a restriction on the API used (CreateProcess). Switching to non-exe requires a different API (ShellExecute); it resolves the executable handler for that type (stored in registry) and launches it.

There are definitely more potential security concerns with ShellExecute.

In this case, I would enable Powershell (ps1) and Batch (cmd/bat) support by inserting their interpretor EXEs in the back-end, rather than switching to ShellExecute. Thus limiting support to those specific types.
Software Engineer. Bitsum LLC.

Autumner

Thanks for the extra info. I'll throw in a semi-related request here.

Could be wrong, but I think Process Watchdog's 'terminate process' forcibly terminates it (as per "taskkill /f"). It would be nice to also have the option to gracefully close the process, which should be similar to the same taskkill command without the /f switch.

My reason for asking: when /f terminating a process with a tray icon, that icon will not disappear from the tray. It lingers there, until you mouse-hover it. Don't know it it's a Windows glitch or by design.

If the process is gracefully terminated, the tray icon goes away too.

Jeremy Collake

Sure, I agree a graceful close should be added and will get that done soon!
Software Engineer. Bitsum LLC.