Skip to content

Conversation

jcrussell
Copy link

Summary

Based on suggestion from @qkaiser. This will make it easier to integrate with unblob (see onekey-sec/unblob#1244).

Proposed changes

Add mmap as possible input to Package and add test cases.

I marked it as WIP to see if it makes sense to use typing.BinaryIO as the type hint (which sounds like it might work from its description). I also left a TODO for actually testing something about the parsed MSI (I didn't have powertoys.msi so I just used 7z).

jcrussell and others added 3 commits August 25, 2025 09:07
Based on suggestion from @qkaiser. This will make it easier to integrate
with unblob (see onekey-sec/unblob#1244).
Should probably think of a better test...
jcrussell added a commit to jcrussell/unblob that referenced this pull request Sep 3, 2025
Requires this PR to (almost) work properly:

nightlark/pymsi#81
@jcrussell jcrussell changed the title WIP: support mmap as source for package support mmap as source for package Sep 3, 2025
self.path = None
self.file = path_or_bytesio
else:
# TODO: consider typing.BinaryIO
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did typing.BinaryIO work?

Copy link
Owner

@nightlark nightlark Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting discussion typing.*IO: python/typing#829

Leaning towards the current list of type options being fine for now, with the option to change it later if needed for e.g. integration with unblob.


size = (msi.package.ole.nb_sect * msi.package.ole.sector_size) + 512

print(size)
Copy link
Owner

@nightlark nightlark Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it would probably be good to pick a specific version of powertoys.msi eventually so that we know what size to expect here. (Doesn't need to be part of this PR though)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants