It is currently October 17th, 2018, 8:32 am

[Suggestion] Run as Administrator

Report bugs with the Rainmeter application and suggest features.
oZone
Posts: 54
Joined: May 14th, 2018, 4:46 pm

[Suggestion] Run as Administrator

oZone » May 15th, 2018, 1:09 pm

Hi,
it is possible to add option to force program to run as administrator

Code: Select all

LeftMouseUpAction=[!RunasAdmin "path to program" "additional parameters"] 
User avatar
jsmorley
Developer
Posts: 18088
Joined: April 19th, 2009, 11:02 pm
Location: Mt. Vernon, Virginia, USA

Re: [Suggestion] Run as Administrator

jsmorley » May 15th, 2018, 1:09 pm

It is not. You would need to set that attribute on the Rainmeter.exe executable.
oZone
Posts: 54
Joined: May 14th, 2018, 4:46 pm

Re: [Suggestion] Run as Administrator

oZone » May 15th, 2018, 1:32 pm

I am not proficient in c++
but couldn't you use this

Code: Select all

SHELLEXECUTEINFO sh;

sh.lpVerb = _T("runas");
sh.lpFile = _T("path to program")
sh.lpParameters = "additional parameters";

ShellExecuteEx(&sh);
to elevate children process
User avatar
jsmorley
Developer
Posts: 18088
Joined: April 19th, 2009, 11:02 pm
Location: Mt. Vernon, Virginia, USA

Re: [Suggestion] Run as Administrator

jsmorley » May 15th, 2018, 2:23 pm

oZone wrote:I am not proficient in c++
but couldn't you use this

Code: Select all

SHELLEXECUTEINFO sh;

sh.lpVerb = _T("runas");
sh.lpFile = _T("path to program")
sh.lpParameters = "additional parameters";

ShellExecuteEx(&sh);
to elevate children process
We are just never going to encourage "authors" to distribute skins that can elevate themselves to administrator, even with a User Account Control prompt from the OS, which any given user may have turned off. This is entirely up to the skin "user", who must specifically set the attribute on Rainmeter.exe. If any skin EVER prompted me for Administrator access to my system, I would say "no", unload it and delete it immediately. I wouldn't even look at the code, because I don't care, it has stepped way over the line.

If you want this for yourself, by all means, set "Run as administrator" on Rainmeter.exe and go nuts.
oZone
Posts: 54
Joined: May 14th, 2018, 4:46 pm

Re: [Suggestion] Run as Administrator

oZone » May 15th, 2018, 4:54 pm

I only asked, you don't have to be angry.

Running rainmeter as administrator is not option, as I want to run program as administrator only when I need.
User avatar
jsmorley
Developer
Posts: 18088
Joined: April 19th, 2009, 11:02 pm
Location: Mt. Vernon, Virginia, USA

Re: [Suggestion] Run as Administrator

jsmorley » May 15th, 2018, 5:26 pm

oZone wrote:I only asked, you don't have to be angry.

Running rainmeter as administrator is not option, as I want to run program as administrator only when I need.
;-) I'm certainly not angry about it... Just wanted to be clear and firm about where we stand.
oZone
Posts: 54
Joined: May 14th, 2018, 4:46 pm

Re: [Suggestion] Run as Administrator

oZone » May 15th, 2018, 5:38 pm

Now that I think about it, it makes sense to not add this feature.

And I found a workaround using powershell so I don't need it anymore.