Check HKCU before HKLM for registry policies
This commit is contained in:
parent
184b67098f
commit
c64ea07d0b
|
@ -28,11 +28,27 @@
|
||||||
|
|
||||||
KIPLATFORM::POLICY::STATE KIPLATFORM::POLICY::GetPolicyState( const wxString& aKey )
|
KIPLATFORM::POLICY::STATE KIPLATFORM::POLICY::GetPolicyState( const wxString& aKey )
|
||||||
{
|
{
|
||||||
wxRegKey key( wxRegKey::HKLM, POLICY_KEY_ROOT );
|
wxRegKey* keyToUse = nullptr;
|
||||||
if( key.Exists() )
|
wxRegKey userKey( wxRegKey::HKCU, POLICY_KEY_ROOT );
|
||||||
|
wxRegKey compKey( wxRegKey::HKLM, POLICY_KEY_ROOT );
|
||||||
|
|
||||||
|
// we have user level policies take precedence over computer level policies
|
||||||
|
if( userKey.Exists() && userKey.HasValue( aKey ) )
|
||||||
|
{
|
||||||
|
keyToUse = &userKey;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( compKey.Exists() && compKey.HasValue( aKey ) )
|
||||||
|
{
|
||||||
|
keyToUse = &compKey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( keyToUse != nullptr )
|
||||||
{
|
{
|
||||||
long value;
|
long value;
|
||||||
if( key.HasValue( aKey ) && key.QueryValue( aKey, &value ) )
|
if( keyToUse->QueryValue( aKey, &value ) )
|
||||||
{
|
{
|
||||||
if( value == 1 )
|
if( value == 1 )
|
||||||
return POLICY::STATE::ENABLED;
|
return POLICY::STATE::ENABLED;
|
||||||
|
|
Loading…
Reference in New Issue