Is it possible to click on Windows UAC dialog using java.awt.Robot? -
i'm working on custom remote desktop in java using java.awt.robot
on windows 7. works apart running command prompt administrator. uac dialog appears, button clicks not accepted on yes button using mousepress()
/mouserelease()
, neither key presses keypress()
/keyrelease()
. application launched via launch4j launcher in launcher rather wrap mode.
things i've done far
disabled secure desktop uac. allowed screen grabber part of application @ least 'see' prompt
- changed group policy disable promptonsecuredesktop uac group policy settings , registry key settings
followed security considerations assistive technologies - has allowed remote desktop interact command prompt once launched not allowed pressing yes button.
- added manifest launch4j specifying uiaccess=true
- signed .exe using signtool.exe using self signed certificate generated makecert.exe
- installed certificate trusted root certificate
- verified .exe marked trusted via right click properties, digital signatures
- ensured .exe in trusted location, c:\program files (x86)\ in case.
- tried run part of app service administrator - not windows service ran admin , allowed access desktop - seems localsystem can that...?
questions
- is possible?
- does javaw.exe being child process of launch4j wrapper effect things? i've read through windows integrity mechanism design don't know how effects launch4j.
launch4j manifest file
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestversion="1.0"> <trustinfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedprivileges> <requestedexecutionlevel level="asinvoker" uiaccess="true" /> </requestedprivileges> </security> </trustinfo> </assembly>
short answer, yes.
understanding problem
- the uiaccess flag in executable manifest appears apply exe not child executions, i.e. if foo-launcher.exe uiaccess enabled , starts javaw.exe not mean javaw.exe uiaccess enabled.
- the reason saw working correctly when running foo-launcher.exe administrator foo-launcher.exe starts javaw.exe administrator allows enough integrity not require uiaccess check.
- javaw.exe has own internal manifest contains uiaccess true
- internal manifests prefered on external - see uac: manifest file ignored ,
- a registry key exists toggle behaviour of preferring internal on external manifests - see how prevent embedded manifest being used?
- launch4j generated executables uses createprocess means executables launched without manifest data, apparently shellexecuteex should used instead - see how can run child process requires elevation , wait?
working around problem
- extract internal manifest javaw.exe , place in same directory filename javaw.exe.manifest - can done manually plain text - used notepad++. various 3rd party tools exist if need automation.
- edit manifest uiaccess="true"
apply registry fix registry fix
[hkey_local_machine\software\microsoft\windows\currentversion\sidebyside] "preferexternalmanifest"=dword:00000001
touch javaw.exe update modification timestamp - otherwise changes not picked - can done "copy /b javaw.exe +,," see windows equivalent of linux command 'touch'?
- double check javaw.exe installed in c:\program files, c:\program files (x86) or other trusted location
- double check javaw.exe signed trusted certificate.
- don't use launch4j generated executables - don't support launching javaw.exe uiaccess enabled, use shortcut files (.lnk) or other method built on shellexecuteex
Comments
Post a Comment