Snarl

Questions and comments specific to a particular plugin should go here.
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Snarl

Post by Pako » Fri Jan 23, 2015 5:35 pm

blackwind wrote:Confirmed fixed.
Thank you.
Downloadable file is corrected.

Pako

User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

Re: Snarl

Post by blackwind » Thu Sep 17, 2015 1:11 am

In Windows 10, I'm not getting events from Snarl. I do get them if I set Snarl to run as administrator, but most of my Snarl extensions don't work in this mode. I'm assuming this occurs because I'm running EventGhost as administrator, but a ton of programs won't launch from EG if I run it normally. Is there a workaround?
/bw

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Snarl

Post by Pako » Sun Sep 20, 2015 4:26 pm

I'm sorry, but I have no opportunity to use Windows 10.

Pako

User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

Re: Snarl

Post by blackwind » Sun Sep 20, 2015 7:34 pm

Welcome back, Pako. :)

I believe Windows 8 employs the same security model. Do you have access to Windows 8?

The best workaround I was able to come up with myself is disabling UAC entirely (via the "EnableLUA" registry hack), which works 100%, but the trade-off is that you can't run Windows Store apps with UAC disabled. Not the biggest deal in the world for me, but I'd still like to find a solution without caveats.
/bw

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Snarl

Post by Pako » Mon Sep 21, 2015 3:27 pm

I think you're right on all counts.
Unfortunately, I know of no workaround.

Pako

User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

Re: Snarl

Post by blackwind » Mon Sep 21, 2015 7:34 pm

Then all that remains, I guess, would be to add a "Run as Administrator" checkbox to the Start Program action, thereby not requiring you to run EventGhost as Administrator in the first place. Feasible?
/bw

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Snarl

Post by Pako » Tue Sep 22, 2015 11:11 am

blackwind wrote:I guess, would be to add a "Run as Administrator" checkbox to the Start Program action
I can try it, but there already exists a ready solution: Re: How to "Start Application" as Administrator?

Pako

User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

Re: Snarl

Post by blackwind » Tue Sep 22, 2015 7:41 pm

With the Windows security model being what it now is, there definitely needs to be a built-in way to do this. I've seen far too many threads on here where "just run EventGhost as Administrator" is the solution, and apparently that now carries too many caveats to be useful advice.

I had a look at your workaround, and needless to say, I'm deeply uncomfortable with storing my password in plain-text. If you could figure out how to reduce this to a checkbox in the Start Program action (without requiring a password), that would be a great service indeed for all EG users.
/bw

User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

Re: Snarl

Post by blackwind » Tue Sep 22, 2015 11:55 pm

Possible solution: Create an application manifest including this line:

Code: Select all

<requestedExecutionLevel level="highestAvailable" uiAccess="true" />
It sounds like this will allow elevated programs to run if user is an administrator, without enabling "Run as Administrator". As an added bonus, setting "uiAccess" to true will allow hotkeys to interact with elevated programs. Currently, if you try to press one of your EG keyboard macros with Task Manager focused, for example, EG doesn't receive notification that the macro was pressed.

For this to work, the executable will also need to be signed. You can obtain a free certificate from Let's Encrypt when it launches in the coming weeks. In the meantime, a self-signed certificate can be used for testing purposes.
/bw

User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

Re: Snarl

Post by blackwind » Tue Oct 06, 2015 12:54 am

I tested the manifest trick today, and I found that:
  • level="highestAvailable" is functionally no different than running EG as Administrator, so that doesn't help us.
  • uiAccess="true" solves the hotkey interaction issue, which does help us.
After further research, here's the final solution I'm proposing:
  • Convert the "Start Program" action from CreateProcess (which can't launch elevated programs) to ShellExecuteEx (which can). Instructions available here.
  • Add uiAccess="true" to the manifest. If you're not actually recompiling EventGhost.exe when you produce new builds, Resource Hacker can be used to update the manifest EventGhost.exe already contains.
  • Sign the executable. Instructions available here.
/bw

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Snarl

Post by Pako » Thu Oct 08, 2015 7:27 am

Thank you for the detailed instructions.
I'll certainly try.
However, it has no relevance to issue a new release (yet) if each user would need to generate a self-signed certificate.
Perhaps I understood correctly.

Pako

User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

Re: Snarl

Post by blackwind » Thu Oct 08, 2015 6:45 pm

The ShellExecuteEx change doesn't require a cert, so I recommend pushing that one out as soon as possible, but you're correct that the manifest portion doesn't warrant a release until Let's Encrypt launches and you can get a cert.
/bw

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Snarl

Post by Pako » Sun Oct 11, 2015 6:49 am

Here is a modified Execute.py file.
Please carry out thorough tests!
Including complex command lines.

Pako
Attachments
Execute.py
(16.14 KiB) Downloaded 107 times

User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

Re: Snarl

Post by blackwind » Sun Oct 11, 2015 7:24 am

Thanks, I'll test this over the next 24 hours.

After a quick read-through of the code, I'd like to make one small suggestion: It appears as though the only thing CreateProcess can do that ShellExecuteEx can't is setting priority. I recommend stripping out CreateProcess and the useShellExecute option entirely and simply setting process priority after execution with SetPriorityClass. There's no sense in giving users the option to stick with CreateProcess if it provides no tangible benefit.
/bw

User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

Re: Snarl

Post by blackwind » Mon Oct 12, 2015 4:16 am

Lookin' good on this end. ShellExecuteEx appears to be the perfect solution to this long-standing issue.

It's important that useShellExecute be removed before release, as it'll screw up configs if you remove it later. If it turns out that people end up needing CreateProcess for some reason (which, based on what I've read today, seems unlikely), the option can always be re-added in the release after.

One final suggestion: Convert Windows Command to ShellExecuteEx and add a "Run as Administrator" checkbox to its options as well. Be sure to work from the version of Windows Command I posted here. If you'd like, I'd be happy to test both modified files before release.
/bw

Post Reply