Add support for dword registry keys

This commit is contained in:
Mathieu Comandon 2016-10-25 13:00:53 -07:00
parent 01e3c5f637
commit 6ad63c45da
2 changed files with 10 additions and 0 deletions

View file

@ -153,5 +153,7 @@ class WineRegistryKey(object):
value = self.values[name]
if value.startswith("\"") and value.endswith("\""):
return value[1:-1]
elif value.startswith('dword:'):
return int(value[6:], 16)
else:
raise ValueError("TODO: finish handling other types")

View file

@ -28,3 +28,11 @@ class TestWineRegistry(TestCase):
def test_can_get_meta(self):
key = self.registry.get_key('Control Panel/Sound')
self.assertEqual(key.get_meta('time'), '1d21cc468677196')
def test_can_get_string_value(self):
key = self.registry.get_key('Control Panel/Desktop')
self.assertEqual(key.get_value('DragFullWindows'), '0')
def test_can_get_dword_value(self):
key = self.registry.get_key('Control Panel/Desktop')
self.assertEqual(key.get_value('CaretWidth'), 1)