From efa49ca6d23530b5e1ececccea4a2dc0bbe3406b Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Fri, 2 Feb 2024 16:34:06 -0500 Subject: Fix import_com_type_for_guid for windows x64 --- python/binaryview.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'python') diff --git a/python/binaryview.py b/python/binaryview.py index 0e508cbf..9b391cf5 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -7503,7 +7503,11 @@ class BinaryView: if not isinstance(guid, str): guid = str(guid) - tl = self.get_type_library("win32common") + if self.arch is None: + return None + + tl_name = "winX64common" if self.arch.name == "x86_64" else "win32common" + tl = self.get_type_library(tl_name) if tl is None: return None @@ -7514,7 +7518,7 @@ class BinaryView: return None return self.import_library_type(type_name, tl) - def import_library_object(self, name: str, lib: Optional[typelibrary.TypeLibrary] = None) -> Optional['_types.Type']: + def import_library_object(self, name: str, lib: Optional[typelibrary.TypeLibrary] = None) -> Optional[Tuple['typelibrary.TypeLibrary', '_types.Type']]: """ ``import_library_object`` recursively imports an object from the specified type library, or, if \ no library was explicitly provided, the first type library associated with the current :py:class:`BinaryView` \ -- cgit v1.3.1