chrome/updater/test/service/win/uac.py
def _QueryPolicyValue(value_name, expected_type=winreg.REG_DWORD):
  """Queries the system policy value from registry.

  Args:
    value_name: Registry value name for the policy.
    expected_type: Expected registry value data type.

  Returns:
    The policy value in its desired data type, or None if no such policy or
    data type is not expected.
  """
  system_policy_path = (r'Software\Microsoft\Windows'
                        r'\CurrentVersion\Policies\System')

  try:
    hklm = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
    policy_key = winreg.OpenKeyEx(hklm, system_policy_path)
    value, data_type = winreg.QueryValueEx(policy_key, value_name)
    return value if data_type == expected_type else None
  except FileNotFoundError:
    return None
Queries the system policy value from registry.

  Args:
    value_name: Registry value name for the policy.
    expected_type: Expected registry value data type.

  Returns:
    The policy value in its desired data type, or None if no such policy or
    data type is not expected.
  
Queries the system policy value from registry.
Queries the system policy value from registry .
def _QueryPolicyValue(value_name, expected_type=winreg.REG_DWORD):
  system_policy_path = (r'Software\Microsoft\Windows'
                        r'\CurrentVersion\Policies\System')
  try:
    hklm = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
    policy_key = winreg.OpenKeyEx(hklm, system_policy_path)
    value, data_type = winreg.QueryValueEx(policy_key, value_name)
    return value if data_type == expected_type else None
  except FileNotFoundError:
    return None
def _QueryPolicyValue ( value_name , expected_type = winreg . REG_DWORD ) : system_policy_path = ( r'Software\Microsoft\Windows' r'\CurrentVersion\Policies\System' ) try : hklm = winreg . ConnectRegistry ( None , winreg . HKEY_LOCAL_MACHINE ) policy_key = winreg . OpenKeyEx ( hklm , system_policy_path ) value , data_type = winreg . QueryValueEx ( policy_key , value_name ) return value if data_type == expected_type else None except FileNotFoundError : return None
Queries the system policy value from registry.
Queries the system policy value from registry .
"""Queries the system policy value from registry.

  Args:
    value_name: Registry value name for the policy.
    expected_type: Expected registry value data type.

  Returns:
    The policy value in its desired data type, or None if no such policy or
    data type is not expected.
  """
The policy value in its desired data type, or None if no such policy or
data type is not expected.
The policy value in its desired data type or None if no such policy or data type is not expected .
value_name
Registry value name for the policy.
Registry value name for the policy .
expected_type
Expected registry value data type.
Expected registry value data type .