[Enterprise, GPO] gpo.h: Fixes wrong function use and code order improvements (#35002)

* changes and fixes

* spell fix

* spell fix

* improve comments
This commit is contained in:
Heiko
2024-09-23 14:33:12 +02:00
committed by GitHub
parent da212b9fb9
commit f7932af806

View File

@@ -83,6 +83,8 @@ namespace powertoys_gpo {
const std::wstring POLICY_MWB_DISABLE_USER_DEFINED_IP_MAPPING_RULES = L"MwbDisableUserDefinedIpMappingRules"; const std::wstring POLICY_MWB_DISABLE_USER_DEFINED_IP_MAPPING_RULES = L"MwbDisableUserDefinedIpMappingRules";
const std::wstring POLICY_MWB_POLICY_DEFINED_IP_MAPPING_RULES = L"MwbPolicyDefinedIpMappingRules"; const std::wstring POLICY_MWB_POLICY_DEFINED_IP_MAPPING_RULES = L"MwbPolicyDefinedIpMappingRules";
// Methods used for reading the registry
#pragma region ReadRegistryMethods
inline std::optional<std::wstring> readRegistryStringValue(HKEY hRootKey, const std::wstring& subKey, const std::wstring& value_name, const bool is_multi_line_text = false) inline std::optional<std::wstring> readRegistryStringValue(HKEY hRootKey, const std::wstring& subKey, const std::wstring& value_name, const bool is_multi_line_text = false)
{ {
// Set value type // Set value type
@@ -250,7 +252,11 @@ namespace powertoys_gpo {
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES); return getConfiguredValue(POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES);
} }
} }
#pragma endregion ReadRegistryMethods
// Utility enabled state policies
// (Always use 'getUtilityEnabledValue()'.)
#pragma region UtilityEnabledStatePolicies
inline gpo_rule_configured_t getConfiguredAlwaysOnTopEnabledValue() inline gpo_rule_configured_t getConfiguredAlwaysOnTopEnabledValue()
{ {
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP); return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP);
@@ -431,6 +437,25 @@ namespace powertoys_gpo {
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ENVIRONMENT_VARIABLES); return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ENVIRONMENT_VARIABLES);
} }
inline gpo_rule_configured_t getConfiguredQoiPreviewEnabledValue()
{
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_QOI_PREVIEW);
}
inline gpo_rule_configured_t getConfiguredQoiThumbnailsEnabledValue()
{
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_QOI_THUMBNAILS);
}
inline gpo_rule_configured_t getConfiguredNewPlusEnabledValue()
{
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_NEWPLUS);
}
#pragma endregion UtilityEnabledStatePolicies
// Individual module setting policies
// (Never use 'getUtilityEnabledValue()'!)
#pragma region IndividualModuleSettingPolicies
inline gpo_rule_configured_t getDisablePerUserInstallationValue() inline gpo_rule_configured_t getDisablePerUserInstallationValue()
{ {
return getConfiguredValue(POLICY_DISABLE_PER_USER_INSTALLATION); return getConfiguredValue(POLICY_DISABLE_PER_USER_INSTALLATION);
@@ -501,59 +526,44 @@ namespace powertoys_gpo {
} }
} }
inline gpo_rule_configured_t getConfiguredQoiPreviewEnabledValue()
{
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_QOI_PREVIEW);
}
inline gpo_rule_configured_t getConfiguredQoiThumbnailsEnabledValue()
{
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_QOI_THUMBNAILS);
}
inline gpo_rule_configured_t getAllowedAdvancedPasteOnlineAIModelsValue() inline gpo_rule_configured_t getAllowedAdvancedPasteOnlineAIModelsValue()
{ {
return getUtilityEnabledValue(POLICY_ALLOW_ADVANCED_PASTE_ONLINE_AI_MODELS); return getConfiguredValue(POLICY_ALLOW_ADVANCED_PASTE_ONLINE_AI_MODELS);
}
inline gpo_rule_configured_t getConfiguredNewPlusEnabledValue()
{
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_NEWPLUS);
} }
inline gpo_rule_configured_t getConfiguredMwbClipboardSharingEnabledValue() inline gpo_rule_configured_t getConfiguredMwbClipboardSharingEnabledValue()
{ {
return getUtilityEnabledValue(POLICY_MWB_CLIPBOARD_SHARING_ENABLED); return getConfiguredValue(POLICY_MWB_CLIPBOARD_SHARING_ENABLED);
} }
inline gpo_rule_configured_t getConfiguredMwbFileTransferEnabledValue() inline gpo_rule_configured_t getConfiguredMwbFileTransferEnabledValue()
{ {
return getUtilityEnabledValue(POLICY_MWB_FILE_TRANSFER_ENABLED); return getConfiguredValue(POLICY_MWB_FILE_TRANSFER_ENABLED);
} }
inline gpo_rule_configured_t getConfiguredMwbUseOriginalUserInterfaceValue() inline gpo_rule_configured_t getConfiguredMwbUseOriginalUserInterfaceValue()
{ {
return getUtilityEnabledValue(POLICY_MWB_USE_ORIGINAL_USER_INTERFACE); return getConfiguredValue(POLICY_MWB_USE_ORIGINAL_USER_INTERFACE);
} }
inline gpo_rule_configured_t getConfiguredMwbDisallowBlockingScreensaverValue() inline gpo_rule_configured_t getConfiguredMwbDisallowBlockingScreensaverValue()
{ {
return getUtilityEnabledValue(POLICY_MWB_DISALLOW_BLOCKING_SCREENSAVER); return getConfiguredValue(POLICY_MWB_DISALLOW_BLOCKING_SCREENSAVER);
} }
inline gpo_rule_configured_t getConfiguredMwbSameSubnetOnlyValue() inline gpo_rule_configured_t getConfiguredMwbSameSubnetOnlyValue()
{ {
return getUtilityEnabledValue(POLICY_MWB_SAME_SUBNET_ONLY); return getConfiguredValue(POLICY_MWB_SAME_SUBNET_ONLY);
} }
inline gpo_rule_configured_t getConfiguredMwbValidateRemoteIpValue() inline gpo_rule_configured_t getConfiguredMwbValidateRemoteIpValue()
{ {
return getUtilityEnabledValue(POLICY_MWB_VALIDATE_REMOTE_IP); return getConfiguredValue(POLICY_MWB_VALIDATE_REMOTE_IP);
} }
inline gpo_rule_configured_t getConfiguredMwbDisableUserDefinedIpMappingRulesValue() inline gpo_rule_configured_t getConfiguredMwbDisableUserDefinedIpMappingRulesValue()
{ {
return getUtilityEnabledValue(POLICY_MWB_DISABLE_USER_DEFINED_IP_MAPPING_RULES); return getConfiguredValue(POLICY_MWB_DISABLE_USER_DEFINED_IP_MAPPING_RULES);
} }
inline std::wstring getConfiguredMwbPolicyDefinedIpMappingRules() inline std::wstring getConfiguredMwbPolicyDefinedIpMappingRules()
@@ -575,4 +585,5 @@ namespace powertoys_gpo {
return std::wstring (); return std::wstring ();
} }
} }
#pragma endregion IndividualModuleSettingPolicies
} }