mIRC Home    About    Download    Register    News    Help

Print Thread
$isadmin #266146 10/10/19 04:57 AM
Joined: Jan 2004
Posts: 1,212
maroon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,212
In coordination with /run -a, it might be useful to have an identifier to indicate whether mIRC itself is running with elevated privileges. Perhaps $isadmin or $iselevated.

The status of mIRC itself has an effect on the /run -a command. If mIRC itself is running as admin already, /run's -a switch doesn't trigger the UAC prompt.

Also, if mIRC itself is running as administrator, then programs launched with the /run command seem to be given admin privileges automagically, regardless whether using the -a switch. I hadn't realized launched programs were also inheriting admin mode since the UAC prompt didn't pop up. I assume that's the default and it's not feasible to have a switch to not let the target program inherit the admin privileges possessed by mIRC itself running in admin mode.

Re: $isadmin [Re: maroon] #266150 10/10/19 08:00 PM
Joined: Oct 2017
Posts: 13
D
DooMaster Offline
Pikka bird
Offline
Pikka bird
D
Joined: Oct 2017
Posts: 13
That sounds very useful , nice idea!

Re: $isadmin [Re: maroon] #266151 11/10/19 04:00 AM
Joined: Feb 2003
Posts: 2,666
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,666
Wha'... you don't like my $isadmin alias? I'm sure I shared it. :P

Code
; Usage:  if ($isadmin) { blah }
IsAdmin { var %file = $+($regsubex($envvar(SystemDrive),/\\?$/,\),TestIsAdmin_,$ticks,$r(1,99999999999999),.$$$) | .fopen -no admintest $qt(%file) | .fclose admintest | var %rslt = $exists(%file) | if (%rslt) .remove $qt(%file) | if (!$isid) echo -a * IsAdmin: %rslt | return %rslt } ; by Raccoon 2017-Feb


Well. At least I won lunch.
Good philosophy, see good in bad, I like!