none
SetWindowsHookEx, UIAccess and Local Security Policy

    Question

  • hi,

    I've developed an application which uses global hooks through a dynamic library (this one call SetWindowsHookEx function).

    To work on Windows 7 workstation, i've created a manifest file for the executable and the dynamic library including following tags :

                       <security>
                               <requestedPrivileges>
                                       <requestedExecutionLevel level="highestAvailable" uiAccess="true"/>
                               </requestedPrivileges>
                       </security>

    Then, i've desactivate "User Account Control: Only elevate UIAccess applications that are installed in secure locations" and "User Account Control: Only elevate executables that are signed and validated" from Local Security Policy.

    But it seems that is not sufficient to give access to that application for hooking. Call to SetWindowsHookEx function on global hook always return "Access Denied" (error code 5).
    The only workaround i found is to totaly desactivate UAC from security settings.
    Have you a solution to give access to an application approved on a domain without desactivate UAC (and avoid security vulnerability) ?

    Thanks in adavance.
    Emmanuel.

    Friday, February 22, 2013 10:59 AM