parameters: (key)
return_statement: return dout
docstring: Convert a registry key's values to a dictionary.
docstring_summary: Convert a registry key's values to a dictionary.
docstring_tokens: Convert a registry key s values to a dictionary .
function: def valuestodict(key):
      """Convert a registry key's values to a dictionary."""
      dout = {}
      size = winreg.QueryInfoKey(key)[1]
      tz_res = None
  
      for i in range(size):
          key_name, value, dtype = winreg.EnumValue(key, i)
          if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN:
              # If it's a DWORD (32-bit integer), it's stored as unsigned - convert
              # that to a proper signed integer
              if value & (1 << 31):
                  value = value - (1 << 32)
          elif dtype == winreg.REG_SZ:
              # If it's a reference to the tzres DLL, load the actual string
              if value.startswith('@tzres'):
                  tz_res = tz_res or tzres()
                  value = tz_res.name_from_string(value)
  
              value = value.rstrip('\x00')    # Remove trailing nulls
  
          dout[key_name] = value
  
      return dout
function_tokens: def valuestodict ( key ) : dout = { } size = winreg . QueryInfoKey ( key ) [ 1 ] tz_res = None for i in range ( size ) : key_name , value , dtype = winreg . EnumValue ( key , i ) if dtype == winreg . REG_DWORD or dtype == winreg . REG_DWORD_LITTLE_ENDIAN : # If it's a DWORD (32-bit integer), it's stored as unsigned - convert # that to a proper signed integer if value & ( 1 << 31 ) : value = value - ( 1 << 32 ) elif dtype == winreg . REG_SZ : # If it's a reference to the tzres DLL, load the actual string if value . startswith ( '@tzres' ) : tz_res = tz_res or tzres ( ) value = tz_res . name_from_string ( value ) value = value . rstrip ( '\x00' ) # Remove trailing nulls dout [ key_name ] = value return dout