Skip to content

Commit f7596aa

Browse files
committed
fix: types are now properly applied to functions
1 parent 7142784 commit f7596aa

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

apply.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import Optional
33

44
import binaryninja as bn
5-
from binaryninja import BinaryView, typelibrary
5+
from binaryninja import BinaryView, TypeLibrary
66

77

88
def get_library_path() -> Optional[str]:
@@ -15,13 +15,13 @@ def get_library_path() -> Optional[str]:
1515
return None
1616

1717

18-
def apply_library(bv: BinaryView, typelib_handle: typelibrary.TypeLibrary):
18+
def apply_library(bv: BinaryView, typelib_handle: TypeLibrary):
1919
exported_objs = typelib_handle.named_objects
2020
for qualified_name, exported_type in exported_objs.items():
2121
for func in bv.functions:
22-
if func.name == qualified_name.name[0]:
23-
bn.log_debug(f"Found func: {qualified_name.name}")
24-
func.apply_imported_types(func.symbol, exported_type)
22+
if func.name == qualified_name:
23+
bn.log_debug(f"Found func: {qualified_name}")
24+
func.set_user_type(exported_type)
2525

2626

2727
def load_library(bv: BinaryView):
@@ -30,7 +30,7 @@ def load_library(bv: BinaryView):
3030
bn.log_error(f"Supplied path was invalid")
3131
return
3232
bn.log_debug(f"lib_path: {lib_path}")
33-
typelib_handle = typelibrary.TypeLibrary.load_from_file(lib_path)
33+
typelib_handle = TypeLibrary.load_from_file(lib_path)
3434
bv.add_type_library(typelib_handle)
3535
apply_library(bv, typelib_handle)
3636
bv.update_analysis()

0 commit comments

Comments
 (0)