Jump to content

Cannot Automate Win 10 Driver Confirmation Dialog Box


autolyl
 Share

Recommended Posts

After upgrading to Windows 10, I found that even if I run the compiled autoit exe as administrator (sometimes required in win10), I cannot send anything to the Windows Security Dialog box at all.

No response to controlclick(), controlsend() , send() to active windows. But ControlGetText () can retrieve the button text.

The relevant lines of the code i used are extracted here : 

Local Const $winDrvWinTitle="Windows Security"
Local Const $windrvVisibleText="You should only install driver software from publishers you trust"

WinActivate($winDrvWinTitle, $windrvVisibleText)
WinWaitActive($winDrvWinTitle, $windrvVisibleText)

ControlFocus( $winDrvWinTitle, $windrvVisibleText, "[CLASS:Button; INSTANCE:1]")
ControlSend ( $winDrvWinTitle, $windrvVisibleText, "[CLASS:Button; INSTANCE:1]", "+{TAB}" )
ControlSend ( $winDrvWinTitle, $windrvVisibleText, "[CLASS:Button; INSTANCE:1]", "!a" )
ControlClick( $winDrvWinTitle, $windrvVisibleText, "[CLASS:Button; INSTANCE:1]", "left" ) 
send("!a")

(button instance 1 is the "install" button, button instance2 is the 'Don't Install')

Any idea?

The Windows Security dialog is displayed by the system thru calling a function in pnpui.dll using rundll32.exe. The command line extracted by process explorer is this:

rundll32.exe C:\Windows\system32\pnpui.dll,InstallSecurityPromptRunDllW 20 Global\{0fd3782d-7da3-ad49-87ba-33dfce9a61e3} Global\{a6994297-ff95-ba46-96b3-c95416403e52} C:\Windows\System32\DriverStore\Temp\{36a70f88-fff2-6b42-ab2f-3800e730fffa}\VBoxUSB.inf C:\Windows\System32\DriverStore\Temp\{36a70f88-fff2-6b42-ab2f-3800e730fffa}\VBoxUSB.cat

I was installing virtual box but that should be irrelevant.

driver confirm.png

Link to comment
Share on other sites

if it's a XAML based form, you will need special tools. Search for IUIAutomation in this forum.

Anyway, can you use the AutoIt Info Tool and focus it on the button you want to click and post the information the tool finds? Post a screenshot of that tool on the Control tab please. Screeshot a capture of that form too, the Windows Security form

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

More information. 

The Dialog Box was the one displayed by Windows 10 for confirmation when someone installs a device driver. So to test it, one need to install a device driver. But, once a driver is installed, windows may not prompt the dialog box again. So, it is best to test it in a windows 10 running under a virtual machine where we can restore the image back to before the driver was installed.

The information returned by Autoit Info Tool are included below. Note the check box next to the "always trust ...." is something created by the DirectUIHWND control.  It is not a standard checkbox. The 2 buttons are ordinary button control (Class:Button).

Here my test script that shows that the ControlGetText() works while ControlClick()/ ControlFocus()/send() doesn't. The script was compiled in a exe and run as administrator.

AutoItSetOption("WinTitleMatchMode",2) ;substring
AutoItSetOption ("TrayIconHide",0) ; show icon
AutoItSetOption("MustDeclareVars",1) ; must declare
Local Const $winDrvWinTitle="Windows Security"
Local Const $windrvVisibleText="You should only install driver software from publishers you trust"
Local Const $InstallButton = "[CLASS:Button; INSTANCE:1]"
Local Const $DontInstallButton = "[CLASS:Button; INSTANCE:2]"
Local Const $AlwaysTrustCheckBox="[CLASS:DirectUIHWND; INSTANCE:1]"
Local Const $NamePublisherText="[CLASS:DirectUIHWND; INSTANCE:2]"
Local Const $WarningText="[CLASS:SysLink; INSTANCE:3]"

Local $Hwnd=WinActivate($winDrvWinTitle, $windrvVisibleText)
Local $text
WinWaitActive($Hwnd,"")
;=== test 1 get the text string of buttons, this should work
$text=ControlGetText ($Hwnd, "", $InstallButton)
MsgBox(0,"", $text)
$text=ControlGetText ($Hwnd, "", $DontInstallButton)
MsgBox(0,"", $text)
$text=ControlGetText ($Hwnd, "", $WarningText)
MsgBox(0,"", $text)
;=== test 2 set focus, this doesnt work
ControlFocus( $Hwnd,"", $InstallButton)
Sleep(100)
;=== test 3 click some controls, this doesnt work
ControlClick( $Hwnd, "", $AlwaysTrustCheckBox, "left" )
Sleep(200)
ControlClick( $Hwnd, "", $DontInstallButton, "left" )

;=== test 4 press tab/ alt A in the active window, doesn't work
send("{TAB}")
Sleep(200)
send("{TAB}")
Sleep(200)
send("{TAB}")
Sleep(200)
send("!a")

 

bottom Text.png

DontInstallButton.png

Install Button.png

NamePublisher.png

top control.png

Link to comment
Share on other sites

Hello This works for me in Windows 10x64

#RequireAdmin
WinActivate("Windows Security")
ControlClick("Windows Security","","Button1")

Saludos

Link to comment
Share on other sites

20 hours ago, Danyfirex said:

Hello This works for me in Windows 10x64

#RequireAdmin
WinActivate("Windows Security")
ControlClick("Windows Security","","Button1")

Saludos

nope......doesn't work for my Windows 10 Enterprise x64.   Just the same thing, it responds to the 2nd line and activates the dialog box. but no response to ControlClick.

What else could affect the result in different win 10 systems? I am using AutoIt v3.3.14.2

Edited by autolyl
more info
Link to comment
Share on other sites

It is not possible to automate any of Windows 10 security dialog  boxes. If you think about it you will see that it would be a very bad idea to allow a script to bypass any security warnings. 

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

10 hours ago, Bowmore said:

It is not possible to automate any of Windows 10 security dialog  boxes. If you think about it you will see that it would be a very bad idea to allow a script to bypass any security warnings. 

But one member indicated he/she did able to automate the dialog box. Could it be related to security settings in Windows 10? Also any ideas what mechanisms were used by win10 to prevent automation in security related dialog boxes? Afterall, it is about sending custom messages to the target windows

Edited by autolyl
Link to comment
Share on other sites

how about installing virtual box silently?

https://www.virtualbox.org/manual/ch02.html#idm743

VirtualBox-<version>-<revision>-Win.exe -extract
msiexec /i VirtualBox-<version>-<revision>-MultiArch_<x86|amd64>.msi /qn

could use the RunAs command

engineers get creative. lol I am not testing this one and poisoning my system with oracle anything. ugh. you reminded me. I have to install VMware Workstation 14

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

As far as I am aware you can allways move your mouse and click with either

https://www.autoitscript.com/autoit3/docs/functions/MouseMove.htm

https://www.autoitscript.com/autoit3/docs/functions/MouseClick.htm

https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_Keybd_Event.htm

  • most likely you have to click position image based as controls in itself not recognizable
  • Below you could also base on the size of your dialog
mousemove_perc("50%","50%")

func mousemove_perc($x,$y)
    if stringinstr($x,"%") Then
        $realX=stringreplace($x,"%","") * (@DesktopWidth / 100)
        $realy=stringreplace($y,"%","") * (@DesktopHeight / 100)
        
        mousemove($realX ,$realy)
    EndIf
EndFunc

 

Link to comment
Share on other sites

  • 2 weeks later...
On 12/7/2017 at 4:14 PM, junkew said:

As far as I am aware you can allways move your mouse and click with either

https://www.autoitscript.com/autoit3/docs/functions/MouseMove.htm

https://www.autoitscript.com/autoit3/docs/functions/MouseClick.htm

https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_Keybd_Event.htm

  • most likely you have to click position image based as controls in itself not recognizable
  • Below you could also base on the size of your dialog
mousemove_perc("50%","50%")

func mousemove_perc($x,$y)
    if stringinstr($x,"%") Then
        $realX=stringreplace($x,"%","") * (@DesktopWidth / 100)
        $realy=stringreplace($y,"%","") * (@DesktopHeight / 100)
        
        mousemove($realX ,$realy)
    EndIf
EndFunc

 

Some quick test. When the Windows Security Dialog box is the active window, MouseMove() has no effect, even if you use absolute coordinates not related to the active Windows Security Dialog. You may test the following with and without the dialog being the active window:

AutoItSetOption("MouseCoordMode",1)
mouseMove(16,129,5)

 

Edited by autolyl
Link to comment
Share on other sites

As I do not know how to reproduce easily that popup I cannot help you fully but these are all commands I learned over the years from win32 api that can do things with mouse and keyboard

  • postmessage
  • sendmessage
  • mouse_event
  • keybd_event
  • sendinput 

Alternatives never used

  • The one I never used or further investigated (not worth the effort) to write a specific keyboard/mouse input driver  https://docs.microsoft.com/en-us/windows-hardware/drivers/samples/input-driver-samples.
  • Maybe start an RDP session to the windows machine (not sure if you can do that to your own machine) and then send the mouseclick based on position.
  • As you can highlight the elements (try also with simplespy, see faq 31) I would be surprised if you cannot click, invoke the elements.
  • There definitely should be a way as people with dissabilities allways have alternatives in windows however in a base install it could be that Microsoft has protected this.
    https://msdn.microsoft.com/en-us/library/windows/desktop/ee671610(v=vs.85).aspx
    To use UIAccess, an assistive technology application needs to:
    • Be signed with a certificate to interact with applications running at a higher privilege level.
    • Be trusted by the system. The application must be installed in a secure location that requires a user account control (UAC) prompt for access. For example, the Program Files folder.
    • Be built with a manifest file that includes the uiAccess flag.

 

 

 

Link to comment
Share on other sites

  • 9 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...