locked
Can a windows hook dll read registry settings when in a Metro app process?

    Question

  • We have an app with a Windows WH_GETMESSAGE hook (using SetWindowsHookEx) that attaches fine to Metro apps, but when the hook function needs to read a user preference setting in HKCU, it gets an ERROR_ACCESS_DENIED error.  Is there any way for the hook to read registry settings while in a Metro app context?  If not, what is the alternative for managing user preferences to be passed to hook functions?

    Friday, March 16, 2012 4:23 AM

Answers

  • No, the hook code will be running as the Metro style app's user and will have the same security restrictions.

    Hooks cannot by default interact with Metro style apps and there are no recommendations for doing so.

    --Rob

    Friday, March 16, 2012 7:14 PM
    Owner
  • Hi Marc,

    Yes, everything running in the process will run within the limits of the process' security. This is true for all applications and is not unique to Metro style apps (for example, if you inject code into low rights IE your code will be subject to the low rights IE restrictions).

    --Rob

    Monday, March 19, 2012 7:01 PM
    Owner

All replies

  • No, the hook code will be running as the Metro style app's user and will have the same security restrictions.

    Hooks cannot by default interact with Metro style apps and there are no recommendations for doing so.

    --Rob

    Friday, March 16, 2012 7:14 PM
    Owner
  • OK. 

    A follow-up question: does this same restriction impact Text Services Framework Text Input Processors (which run as in-process COM objects)?  Presumably it does; I'm just trying to understand the by-design restrictions that we have to work with.

    Sunday, March 18, 2012 9:48 PM
  • Hello,

    Here is all COM and WIN32 functions we can access in metro app. You can try to find if your function is exist in this document.

    http://msdn.microsoft.com/en-us/library/windows/apps/br205762.aspx

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Monday, March 19, 2012 7:04 AM
  • Hi Marc,

    Yes, everything running in the process will run within the limits of the process' security. This is true for all applications and is not unique to Metro style apps (for example, if you inject code into low rights IE your code will be subject to the low rights IE restrictions).

    --Rob

    Monday, March 19, 2012 7:01 PM
    Owner
  • Hi Marc,

      I am trying something similar (hook metro app on win 8).  But, unable to receive messages in hook proc.  You seem to have succeeded in receiving messages.  Would it be possible to share more info on how you could achieve it?

    Related Post: https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/f5df06cb-5054-465b-ae9a-add4b1ad3f95/metro-mode-ie-on-windows-8-setwindowshookex-doesnt-work?forum=windowssecurity


    Thursday, November 6, 2014 8:35 AM