Skip to content

Commit

Permalink
Changes for Custom Destinations Jump Lists
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Mar 10, 2024
1 parent 90aebf6 commit 8f90348
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion winspsrc/data/observed_properties.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ format_identifier: 49691c90-7e17-101a-a91c-08002b2ecda9
name: System.Search.QueryPropertyHits
property_identifier: 21
shell_property_key: PKEY_Search_QueryPropertyHits
value_type: 0x0001
value_type: [0x0001, 0x101f]
---
format_identifier: 560c36c0-503a-11cf-baa1-00004c752a9a
name: System.Search.AutoSummary
Expand Down
21 changes: 7 additions & 14 deletions winspsrc/jump_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,23 +242,15 @@ def _ReadCategoryHeader(self, file_object, file_offset):
file_offset += bytes_read
total_bytes_read = bytes_read

if category_header.category_type == 0:
data_type_map_name = 'custom_category_header_type_0'
else:
data_type_map_name = 'custom_category_header_type_1_or_2'

data_type_map = self._GetDataTypeMap(data_type_map_name)
data_type_map = self._GetDataTypeMap(
f'custom_category_header_type_{category_header.category_type:d}')

category_header_value, bytes_read = self._ReadStructureFromFileObject(
file_object, file_offset, data_type_map, 'category header values')

if category_header.category_type == 0:
setattr(category_header, 'number_of_characters',
category_header_value.number_of_characters)
setattr(category_header, 'title', category_header_value.title)

setattr(category_header, 'number_of_entries',
category_header_value.number_of_entries)
if category_header.category_type in (0, 2):
setattr(category_header, 'number_of_entries',
category_header_value.number_of_entries)

total_bytes_read += bytes_read

Expand Down Expand Up @@ -313,7 +305,8 @@ def ReadFileObject(self, file_object):

file_offset += bytes_read

for entry_index in range(category_header.number_of_entries):
number_of_entries = getattr(category_header, 'number_of_entries', 0)
for entry_index in range(number_of_entries):
if self._file_size - file_offset < 16:
break

Expand Down
12 changes: 10 additions & 2 deletions winspsrc/jump_list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,23 @@ attributes:
members:
- name: number_of_characters
data_type: uint16
- name: title
- name: category_name
type: string
encoding: utf-16-le
element_data_type: wchar16
number_of_elements: custom_category_header_type_0.number_of_characters
- name: number_of_entries
data_type: uint32
---
name: custom_category_header_type_1_or_2
name: custom_category_header_type_1
type: structure
attributes:
byte_order: little-endian
members:
- name: category_identifier
data_type: uint32
---
name: custom_category_header_type_2
type: structure
attributes:
byte_order: little-endian
Expand Down

0 comments on commit 8f90348

Please sign in to comment.