def valuestodict(key):
dout = {}<EOL>size = winreg.QueryInfoKey(key)[<NUM_LIT:1>]<EOL>tz_res = None<EOL>for i in range(size):<EOL><INDENT>key_name, value, dtype = winreg.EnumValue(key, i)<EOL>if dtype == winreg.REG_DWORD or dtype == winreg.REG_DWORD_LITTLE_ENDIAN:<EOL><INDENT>if value & (<NUM_LIT:1> << <NUM_LIT>):<EOL><INDENT>value = value - (<NUM_LIT:1> << <NUM_LIT:32>)<EOL><DEDENT><DEDENT>elif dtype == winreg.REG_SZ:<EOL><INDENT>if value.startswith('<STR_LIT>'):<EOL><INDENT>tz_res = tz_res or tzres()<EOL>value = tz_res.name_from_string(value)<EOL><DEDENT>value = value.rstrip('<STR_LIT:\x00>')    <EOL><DEDENT>dout[key_name] = value<EOL><DEDENT>return dout<EOL>
Convert a registry key's values to a dictionary.