Bitsum Community Forum

General Category => Process Lasso => Topic started by: Autumner on August 05, 2019, 07:03:54 PM

Title: Watchdog/execute: allow any type of file?
Post by: Autumner on August 05, 2019, 07:03:54 PM
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.
Title: Re: Watchdog/execute: allow any type of file?
Post by: Jeremy Collake on August 05, 2019, 07:10:30 PM
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!
Title: Re: Watchdog/execute: allow any type of file?
Post by: Autumner on August 08, 2019, 11:43:40 AM
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.

Title: Re: Watchdog/execute: allow any type of file?
Post by: Jeremy Collake on August 08, 2019, 12:05:04 PM
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.
Title: Re: Watchdog/execute: allow any type of file?
Post by: Autumner on August 09, 2019, 05:54:51 PM
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.
Title: Re: Watchdog/execute: allow any type of file?
Post by: Jeremy Collake on August 10, 2019, 01:59:02 PM
Sure, I agree a graceful close should be added and will get that done soon!