24#include <wx/tokenzr.h>
25#include <wx/msw/registry.h>
29#define POLICY_KEY_ROOT "Software\\Policies\\KiCad\\KiCad"
35 wxRegKey* keyToUse =
nullptr;
39 wxStringTokenizer tokenizer( aKey,
"\\" );
40 while( tokenizer.HasMoreTokens() )
42 wxString token = tokenizer.GetNextToken();
44 if( tokenizer.HasMoreTokens() )
46 keyPath.Append(
"\\" );
47 keyPath.Append( token );
53 std::unique_ptr<wxRegKey> userKey = std::make_unique<wxRegKey>( wxRegKey::HKCU, keyPath );
56 if( userKey->Exists() && userKey->HasValue( key ) )
58 keyToUse = userKey.release();
62 std::unique_ptr<wxRegKey> compKey = std::make_unique<wxRegKey>( wxRegKey::HKLM, keyPath );
64 if( compKey->Exists() && compKey->HasValue( key ) )
66 keyToUse = compKey.release();
80 if( keyToUse !=
nullptr )
83 if( keyToUse->QueryValue( key, &value ) )
86 return POLICY::PBOOL::ENABLED;
88 return POLICY::PBOOL::DISABLED;
92 return PBOOL::NOT_CONFIGURED;
101 if( keyToUse !=
nullptr )
104 if( keyToUse->QueryValue( key, &value ) )
static wxRegKey * GetPolicyRegKey(wxString &aKey)