File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ walkdir = "2.5"
2323dashmap = " 6.1"
2424
2525# For TBD parsing
26- serde-saphyr = { version = " 0.0.18 " , default-features = false , features = [] }
26+ serde-saphyr = { version = " 0.0.19 " , default-features = false , features = [] }
2727
2828# For reports
2929minijinja = " 2.10.2"
Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ Examples:
3434 - Downloads and processes all files in the project, placing potentially multiple ` .bntl ` files in the ` output ` directory.
3535- ` ./bntl_cli create sqlite3.dll "windows-x86_64" ./winmd/ ./output/ `
3636 - ` winmd ` files are also supported as input, they will be processed together. You also probably want to provide some apiset schema files as well.
37+ - ` ./bntl_cli create sqlite3.dll "windows-x86_64" ./headers/ ./output/ --include-directories ./system_headers/ `
38+ - You can also specify additional include directories to search for referenced headers.
3739
3840#### Dump
3941
@@ -45,7 +47,7 @@ Examples:
4547
4648#### Diff
4749
48- Compare two type libraries and generate a .diff file containing a similarity ratio .
50+ Compare two type libraries and generate a .diff file.
4951
5052Examples:
5153
Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ pub struct CreateArgs {
1414 pub platform : String ,
1515 pub input : Input ,
1616 pub output_directory : Option < PathBuf > ,
17+ /// A list of directories to use for include paths when parsing C header files.
18+ #[ clap( long) ]
19+ pub include_directories : Vec < PathBuf > ,
1720 #[ clap( long) ]
1821 pub dry_run : bool ,
1922}
@@ -37,7 +40,8 @@ impl CreateArgs {
3740 }
3841 std:: fs:: create_dir_all ( & output_path) . expect ( "Failed to create output directory" ) ;
3942
40- let processor = TypeLibProcessor :: new ( & self . name , & self . platform ) ;
43+ let processor = TypeLibProcessor :: new ( & self . name , & self . platform )
44+ . with_include_directories ( self . include_directories . clone ( ) ) ;
4145 // TODO: Need progress indicator here, when downloading files.
4246 let resolved_input = self . input . resolve ( ) . expect ( "Failed to resolve input" ) ;
4347
Original file line number Diff line number Diff line change 11use crate :: command:: { InputDirectoryField , OutputDirectoryField } ;
22use crate :: helper:: path_to_type_libraries;
33use crate :: validate:: TypeLibValidater ;
4- use binaryninja:: binary_view:: { BinaryView , BinaryViewExt } ;
4+ use binaryninja:: binary_view:: BinaryView ;
55use binaryninja:: command:: Command ;
66use binaryninja:: interaction:: Form ;
77use binaryninja:: platform:: Platform ;
Original file line number Diff line number Diff line change @@ -354,12 +354,12 @@ impl ProcessedData {
354354 ( QualifiedName , CoreArchitecture ) ,
355355 Vec < Ref < TypeLibrary > > ,
356356 > = HashMap :: new ( ) ;
357- for merged_type_library in & self . type_libraries {
358- for named_type in & merged_type_library . named_types ( ) {
357+ for tl in & self . type_libraries {
358+ for named_type in & tl . named_types ( ) {
359359 mapped_named_types
360- . entry ( ( named_type. name . clone ( ) , merged_type_library . arch ( ) ) )
360+ . entry ( ( named_type. name . clone ( ) , tl . arch ( ) ) )
361361 . or_default ( )
362- . push ( merged_type_library . clone ( ) ) ;
362+ . push ( tl . clone ( ) ) ;
363363 }
364364 }
365365
@@ -1093,13 +1093,13 @@ pub fn is_parsable(path: &Path) -> bool {
10931093 if path. extension ( ) == Some ( OsStr :: new ( "pdb" ) ) {
10941094 return false ;
10951095 }
1096- let mut metadata = FileMetadata :: with_file_path ( path) ;
1097- let Ok ( view) = BinaryView :: from_path ( & metadata, path ) else {
1096+ let metadata = FileMetadata :: with_file_path ( path) ;
1097+ let Ok ( view) = BinaryView :: from_metadata ( & metadata) else {
10981098 return false ;
10991099 } ;
11001100 // If any view type parses this file, consider it for this source.
11011101 // All files will have a "Raw" file type, so we account for that.
1102- BinaryViewType :: list_valid_types_for ( & view) . len ( ) > 1
1102+ BinaryViewType :: valid_types_for_data ( & view) . len ( ) > 1
11031103}
11041104
11051105#[ cfg( test) ]
Original file line number Diff line number Diff line change 1+ //! Parse Apples TBD file format, which gives information about where source symbols are located.
2+
13use binaryninja:: architecture:: CoreArchitecture ;
24use binaryninja:: platform:: Platform ;
35use binaryninja:: rc:: Ref ;
You can’t perform that action at this time.
0 commit comments