Skip to content

Commit 8aec1fa

Browse files
authored
Merge pull request #38 from Spectre5/target-bitmask
Use 0x70 bitmask for TargetID
2 parents e756544 + d5f1738 commit 8aec1fa

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

LnkParse3/target_factory.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,11 @@ def target_class(self):
7474

7575
# XXX: Move to table
7676
try:
77-
if 0x20 < item_type <= 0x2F:
78-
target = classes[0x20]
79-
elif 0x30 < item_type <= 0x3F:
80-
target = classes[0x30]
81-
elif 0x40 < item_type <= 0x4F:
82-
target = classes[0x40]
77+
# 0x20, 0x30, and 0x40 should have an 0x70 bitmask applied per
78+
# https://github.com/libyal/libfwsi/blob/main/documentation/Windows%20Shell%20Item%20format.asciidoc
79+
masked_item_type = item_type & 0x70
80+
if masked_item_type in [0x20, 0x30, 0x40]:
81+
target = classes[masked_item_type]
8382
else:
8483
target = classes[item_type]
8584
except KeyError:

0 commit comments

Comments
 (0)