Search code examples
c++windowsregistryatl

ATLGetDacl accessing 64bit reg keys from a 32bit process


I am trying to get DACL information of a 64bit registry key from a 32bit process.

AtlGetDacl("Machine\Software\Somekey", SE_REGISTRY_KEY, &dacl)

This redirects to "Machine\Software\Wow6432Node\Somekey" , since I am running a 32bit process.

What I need is something like the samDesired flag which is available in Windows Registry functions (like RegOpenKeyEx), do you know if ATL has such a thing and how I can pass that to ATLGetDacl and ATLSetDacl?

Thanks.


Solution

  • Another overload of AtlGetDacl can take a registry key as an argument.

    inline bool AtlGetDacl(
        _In_ HANDLE hObject,
        _In_ SE_OBJECT_TYPE ObjectType,
        _Inout_ CDacl *pDacl) throw(...)
    

    You can use it for a key you already know how to open with RegOpenKeyEx.