reg: Fix QDWORD

This commit is contained in:
Oleksii Shevchuk 2019-03-13 17:53:08 +02:00
parent 1141583c00
commit bd8da73684
2 changed files with 7 additions and 1 deletions

View File

@ -8,7 +8,7 @@ from pupylib.PupyOutput import Color, List, Table, MultiPart, TruncateToTerm
TYPES = (
'NONE', 'SZ', 'EXPAND_SZ', 'BINARY', 'LE32', 'BE32',
'LINK', 'MULTI_SZ', 'RESOURCE', 'RESOURCE_DESCRIPTOR',
'RESOURCE_REQUIREMENTS_LIST'
'RESOURCE_REQUIREMENTS_LIST', 'LE64'
)
TYPE_COLORS = {

View File

@ -8,6 +8,7 @@ __all__ = [
import _winreg
import re
import sys
import struct
WELL_KNOWN_KEYS = {
'HKEY_LOCAL_MACHINE': _winreg.HKEY_LOCAL_MACHINE,
@ -30,6 +31,9 @@ WELL_KNOWN_TYPES = {
unicode: _winreg.REG_SZ,
}
if not hasattr(_winreg, 'REG_QWORD'):
setattr(_winreg, 'REG_QWORD', 11)
WELL_KNOWN_TYPES_NAMES = {
_winreg.REG_DWORD: 'DWORD',
_winreg.REG_QWORD: 'LE64',
@ -94,6 +98,8 @@ class Value(object):
if type(value) == str and ktype in (_winreg.REG_SZ, _winreg.REG_MULTI_SZ):
value = value.decode(sys.getfilesystemencoding())
elif type(value) == str and ktype == _winreg.REG_QWORD:
value, = struct.unpack('<q', value)
self.parent = parent
self.name = name