2
2
from typing import Optional
3
3
4
4
import binaryninja as bn
5
- from binaryninja import BinaryView , typelibrary
5
+ from binaryninja import BinaryView , TypeLibrary
6
6
7
7
8
8
def get_library_path () -> Optional [str ]:
@@ -15,13 +15,13 @@ def get_library_path() -> Optional[str]:
15
15
return None
16
16
17
17
18
- def apply_library (bv : BinaryView , typelib_handle : typelibrary . TypeLibrary ):
18
+ def apply_library (bv : BinaryView , typelib_handle : TypeLibrary ):
19
19
exported_objs = typelib_handle .named_objects
20
20
for qualified_name , exported_type in exported_objs .items ():
21
21
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 )
25
25
26
26
27
27
def load_library (bv : BinaryView ):
@@ -30,7 +30,7 @@ def load_library(bv: BinaryView):
30
30
bn .log_error (f"Supplied path was invalid" )
31
31
return
32
32
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 )
34
34
bv .add_type_library (typelib_handle )
35
35
apply_library (bv , typelib_handle )
36
36
bv .update_analysis ()
0 commit comments