Skip to content

Commit a2a2350

Browse files
author
Willi Ballenthin
committed
RegistryParse: fix file_type datatype
thanks to John Ormonde and Tim Heaney!
1 parent 8bc8d13 commit a2a2350

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

Registry/RegistryParse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ def file_type(self):
385385
"""
386386
Get the file type.
387387
"""
388-
return self.unpack_dword(0x1C)
388+
return FileType(self.unpack_dword(0x1C))
389389

390390
def is_primary_file(self):
391391
"""

tests/fixtures.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import os.path
2+
3+
import pytest
4+
5+
from Registry import Registry
6+
7+
8+
@pytest.fixture
9+
def hive():
10+
path = os.path.join(os.path.dirname(__file__), "reg_samples", "issue22.hive")
11+
return Registry.Registry(path)

tests/test_parse.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import Registry
2+
3+
from fixtures import *
4+
5+
6+
def test_file_type(hive):
7+
assert hive._regf.file_type() == Registry.RegistryParse.FileType.FILE_TYPE_PRIMARY

0 commit comments

Comments
 (0)