Modify

Opened 13 years ago

Closed 13 years ago

#2197 closed Bug (Duplicate)

#RequireAdmin creates a critical error, if the user doesn't start it as local admin

Reported by: jmalmgren@… Owned by:
Milestone: Component: AutoIt
Version: 3.3.8.1 Severity: None
Keywords: Cc:

Description

#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=C:\Temp\CriticalError.exe
#AutoIt3Wrapper_Res_Description=Critical error using #RequireAdmin
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=© 2012: J. Malmgren, wwww.tryware.dk
#AutoIt3Wrapper_Res_Language=1033
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

;	***** WARNING: Don't compile and run this script, because it restarts itself thousands of times with new PID's, so you can't stop it again using TaskManager.exe
;	There is only 2 ways to stop it again: Restart your computer, or rename C:\Temp\CriticalError.exe to something else using explorer.exe
;
;	The reason is kind of described in the help file: "As this function launch a new process, some functions as Consolewrite() cannot be captured"
;
;	Yes it certainly launch a new process, launch a new process, launch a new process, launch a new process, launch a new process, launch a new process, launch a new process


	Local $_sMsg = "If #RequireAdmin is used, but the user isn't local administrator, and doesn't rightclick and select 'another user' being local administrator, "
	$_sMsg = $_sMsg & "then the script calls itself thousands of times, no matter what you have below, so the MsgBox function below isn't shown!" & @CRLF & @CRLF
	$_sMsg = $_sMsg & "But if you do nothing else than removing the first line with #RequireAdmin, this script works!"

	MsgBox(16,"Critical error:",$_sMsg)

Exit


Change History (9)

comment:1 Changed 13 years ago by jmalmgren@…

;	***** WORK-AROUND UNTIL IT'S FIXED:

	Global $_bOsXp = True
	Local $_iPos = StringInstr(StringUpper(@OSVersion),"XP")
	If $_iPos = 0 Then $_bOsXp = False


	If NOT IsAdmin() Then $_bStatus = _RunAsAdmin($_sMsg)

Exit

Func _RunAsAdmin($_sMsg)

	Local $_bStatus

	If $_bOsXp = True Then
			$_sMsg & "Please logoff, and logon again as being member of the local administrator group, and run my "& @ScriptName & " again!"
		Else
			$_sMsg & "Please hold the SHIFT key, while you rightclick my "& @ScriptName & ", and select run as 'another user' being lmember "
			$_sMsg = $_sMsg & "of the local administrator group, and then run my "& @ScriptName & " again!"
	Endif

	$_bStatus = MsgBox(16,"Critical error:",$_sMsg)
EndFunc

comment:2 Changed 13 years ago by jmalmgren@…

I tried with no luck to use this combined with #RequireAdmin

#AutoIt3Wrapper_Res_requestedExecutionLevel=highestAvailable

comment:3 Changed 13 years ago by Valik

I'm not really interested in all those AutoIt3Wrapper statements. I'd also like an actual description of your problem in text rather than just a wall of code. You've left out a lot of important details. From what I gather though this sounds more like a user error than an AutoIt error.

comment:4 Changed 13 years ago by anonymous

Hi Valik

Just copy paste my code, compile it and run it, then I have explained perfectly what the issue is about

comment:5 Changed 13 years ago by anonymous

you only need to logon as a user that's NOT a local admin, and use these lines, and you won't see the MsgBox:

#RequireAdmin

Local $_sMsg = "Hi Valik"

MsgBox(16,"Critical error:",$_sMsg)

Exit

comment:6 Changed 13 years ago by Valik

You haven't explained it perfectly. You still haven't told us what OS we are supposed to test this on.

comment:7 Changed 13 years ago by anonymous

From the second block of code, I'd guess Windows XP (NT 5.1)...

comment:8 Changed 13 years ago by Valik

The more I see this bug report the more annoyed I get at the reporter. What a shitty bug report, whether it turns out to be real or not.

comment:9 Changed 13 years ago by trancexx

  • Resolution set to Duplicate
  • Status changed from new to closed

See #1498

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.