how to detect Windows UAC UI dialog

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • janiv
    New Member
    • Sep 2010
    • 1

    how to detect Windows UAC UI dialog

    Hi All,

    I'm creating an automation program that run other programs, I need to detect if the Windows UAC UI dialog is appears.
    I didn't find anything that can help me detect the dialog elevation itself.
    Any ideas ??
    Please help.....
  • Aimee Bailey
    Recognized Expert New Member
    • Apr 2010
    • 197

    #2
    Unless you run the application using elevated privileges, the application will be ran in user-land (a sandbox in which windows applications run), which is governed by UAC (unless disabled), not the other way round, so no you can't detect it. UAC is designed to protect a system from user-land applicationss changing things when they shouldn’t, ideally, you should program your app to not need to get past UAC in the first place.

    Comment

    • Subin Ninan
      New Member
      • Sep 2010
      • 91

      #3
      Embed an application manifest within your program with "requireAdminis trator" attribute.

      Edit "Secure Folder" with your ProjectName in following manifest file.
      Save it as "YourAppName.ex e.manifest" in your project directory.
      To embed this manifest in VS 2008 go to:
      Project Properties > "Applicatio n" tab > in "Manifest" comboBox select this manifest file.
      (if this manifest file is not shown in this comboBox, open solution explorer and right-click on this manifest file and select "Include in project".


      <?xml version="1.0" encoding="UTF-8" standalone="yes "?>
      <assembly xmlns="urn:sche mas-microsoft-com:asm.v1" manifestVersion ="1.0">
      <assemblyIdenti ty version="1.0.0. 0" processorArchit ecture="X86" name="SecureFol der" type="win32" />
      <description>Se cureFolder</description>
      <trustInfo xmlns="urn:sche mas-microsoft-com:asm.v2">
      <security>
      <requestedPrivi leges>
      <requestedExecu tionLevel level="requireA dministrator" uiAccess="false " />
      </requestedPrivil eges>
      <applicationReq uestMinimum>
      <defaultAssembl yRequest permissionSetRe ference="Custom " />
      <PermissionSe t class="System.S ecurity.Permiss ionSet" version="1.3" Unrestricted="t rue" ID="Custom" SameSite="site" />
      </applicationRequ estMinimum>
      </security>
      </trustInfo>
      </assembly>



      You need to have administrative rights to edit registry.

      Comment

      Working...