How should I deal with value
?
def add():
ts = "Software\\Test\\ti"
try:
key = _winreg.CreateKeyEx(_winreg.HKEY_CURRENT_USER, ts, 0, _winreg.KEY_ALL_ACCESS)
except:
return False
else:
value = hex(int(time.time()))[2::].decode('hex')[::-1].encode('hex')
"""TODO: I should do what?"""
_winreg.SetValueEx(key, "test", 0, _winreg.REG_BINARY, 3, value)
_winreg.CloseKey(key)
return True
the right result in registry like this (I hope):
test REG_BINARY 29 96 98 52 00 00 00 00
You should pass binary string; Use
struct.pack
with<Q
(unsigned long long: 8 bytes) as format:Complete code example: