Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose References via VBA Parser object #839

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

AndrewJLockhart
Copy link

@AndrewJLockhart AndrewJLockhart commented Feb 9, 2024

Closes #838

@@ -1858,12 +1860,12 @@ def __init__(self, ole, vba_root, project_path, dir_path, relaxed=True):
break

if check == 0x0016:
# REFERENCENAME
REFERENCENAME = "REFERENCENAME"
Copy link
Author

Choose a reason for hiding this comment

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

Changed the comments to constants because further down I didn't want to duplicate a string. But does have the side effect of changing the log output slightly. Is this OK?

# Specifies a reference to an Automation type library.
referenceregistered_id = check
referenceregistered_size = struct.unpack("<L", dir_stream.read(4))[0]
referenceregistered_sizeof_libid = struct.unpack("<L", dir_stream.read(4))[0]
referenceregistered_libid = dir_stream.read(referenceregistered_sizeof_libid)
log.debug('REFERENCE registered lib id: %s' % unicode2str(self.decode_bytes(referenceregistered_libid)))
referenceregistered_libid = unicode2str(self.decode_bytes(dir_stream.read(referenceregistered_sizeof_libid)))
Copy link
Author

Choose a reason for hiding this comment

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

Only wanted to call the decode once. Result is used in the log and also sent to the references list

referenceproject_majorversion = struct.unpack("<L", dir_stream.read(4))[0]
referenceproject_minorversion = struct.unpack("<H", dir_stream.read(2))[0]
unused = referenceproject_id
unused = referenceproject_size
unused = referenceproject_libidabsolute
unused = referenceproject_libidrelative
Copy link
Author

Choose a reason for hiding this comment

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

Actually, I think I need to leave the assignment unused = referenceproject_libidrelative because it isn't being used anywhere else.

Copy link
Author

@AndrewJLockhart AndrewJLockhart left a comment

Choose a reason for hiding this comment

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

Appreciate comments on approach before I go further and add test cases.

@AndrewJLockhart AndrewJLockhart changed the title Initial version for feedback on approach Expose References via VBA Parser object Feb 9, 2024
# Specifies a reference to a twiddled type library and its extended type library.
referencecontrol_id = check
referencecontrol_sizetwiddled = struct.unpack("<L", dir_stream.read(4))[0] # ignore
referencecontrol_sizeof_libidtwiddled = struct.unpack("<L", dir_stream.read(4))[0]
referencecontrol_libidtwiddled = dir_stream.read(referencecontrol_sizeof_libidtwiddled)
log.debug('REFERENCE control twiddled lib id: %s' % unicode2str(self.decode_bytes(referencecontrol_libidtwiddled)))
Copy link
Author

Choose a reason for hiding this comment

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

Still can't find an example of a twiddled library

@decalage2 decalage2 self-requested a review February 12, 2024 15:16
@decalage2 decalage2 self-assigned this Feb 12, 2024
@decalage2 decalage2 added this to the Next Release milestone Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make VBA Tools->References Information available
2 participants