williballenthin / python-registry

Pure Python parser for Windows Registry hives.
Apache License 2.0
426 stars 101 forks source link

Long RegBinary value cause str(bytearray) #89

Open Tiaonmmn opened 5 years ago

Tiaonmmn commented 5 years ago

When I use library to parse Windows AppCompatCache which is a RegBinary item in Python 3.7 environemnt,it returns a strd bytearray. For example:

reg = open=Registry.Registry("/tmp/tempfile/im_3_k5cdo_p4_/Windows/System32/config/SYSTEM").open("ControlSet001\\Control\\Session Manager\\AppCompatCache")
value1=open.value("AppCompatCache")
print("AppCompatCache is %s" % value1.value())
print("type is %s"%open.value("AppCompatCache").value_type_str())

value1 is "bytearray(b'\xee)".... it's a string not a true bytearray object. And it appears on all long RegBinary values.Short values are returning bytes objects well.

williballenthin commented 5 years ago

what type would you like to see here? a bytes (not bytearray)?

Tiaonmmn commented 5 years ago

Too long RegBinary would return a str(bytearray()),I think just return a bytes object would be nice.