File tree Expand file tree Collapse file tree 7 files changed +29
-22
lines changed Expand file tree Collapse file tree 7 files changed +29
-22
lines changed Original file line number Diff line number Diff line change @@ -739,6 +739,9 @@ bool ElfView::Init()
739
739
m_logger->LogError (" ELF architecture %d is not supported" , m_commonHeader.arch );
740
740
break ;
741
741
}
742
+
743
+ if (!m_parseOnly)
744
+ m_logger->LogWarn (" Unable to determine architecture. Please open the file with options and select a valid architecture." );
742
745
return false ;
743
746
}
744
747
@@ -2944,8 +2947,8 @@ Ref<Settings> ElfViewType::GetLoadSettingsForData(BinaryView* data)
2944
2947
Ref<BinaryView> viewRef = Parse (data);
2945
2948
if (!viewRef || !viewRef->Init ())
2946
2949
{
2947
- m_logger->LogError ( " View type '%s' could not be created " , GetName ().c_str ());
2948
- return nullptr ;
2950
+ m_logger->LogWarn ( " Failed to initialize view of type '%s'. Generating default load settings. " , GetName ().c_str ());
2951
+ viewRef = data ;
2949
2952
}
2950
2953
2951
2954
Ref<Settings> settings = GetDefaultLoadSettingsForData (viewRef);
Original file line number Diff line number Diff line change @@ -3863,8 +3863,8 @@ Ref<Settings> MachoViewType::GetLoadSettingsForData(BinaryView* data)
3863
3863
Ref<BinaryView> viewRef = Parse (data);
3864
3864
if (!viewRef || !viewRef->Init ())
3865
3865
{
3866
- m_logger->LogError ( " View type '%s' could not be created " , GetName ().c_str ());
3867
- return nullptr ;
3866
+ m_logger->LogWarn ( " Failed to initialize view of type '%s'. Generating default load settings. " , GetName ().c_str ());
3867
+ viewRef = data ;
3868
3868
}
3869
3869
3870
3870
Ref<Settings> settings = GetDefaultLoadSettingsForData (viewRef);
Original file line number Diff line number Diff line change @@ -423,8 +423,8 @@ Ref<Settings> Md1romViewType::GetLoadSettingsForData(BinaryNinja::BinaryView* da
423
423
Ref<BinaryView> viewRef = Parse (data);
424
424
if (!viewRef || !viewRef->Init ())
425
425
{
426
- m_logger->LogError ( " View type '%s' could not be created " , GetName ().c_str ());
427
- return nullptr ;
426
+ m_logger->LogWarn ( " Failed to initialize view of type '%s'. Generating default load settings. " , GetName ().c_str ());
427
+ viewRef = data ;
428
428
}
429
429
430
430
Ref<Settings> settings = GetDefaultLoadSettingsForData (viewRef);
Original file line number Diff line number Diff line change @@ -459,6 +459,10 @@ bool COFFView::Init()
459
459
m_logger->LogError (" COFF architecture '0x%x' is not supported" , header.machine );
460
460
break ;
461
461
}
462
+
463
+ if (!m_parseOnly)
464
+ m_logger->LogWarn (" Unable to determine architecture. Please open the file with options and select a valid architecture." );
465
+
462
466
return false ;
463
467
}
464
468
@@ -1662,8 +1666,8 @@ Ref<Settings> COFFViewType::GetLoadSettingsForData(BinaryView* data)
1662
1666
Ref<BinaryView> viewRef = Parse (data);
1663
1667
if (!viewRef || !viewRef->Init ())
1664
1668
{
1665
- m_logger->LogError ( " View type '%s' could not be created " , GetName ().c_str ());
1666
- return nullptr ;
1669
+ m_logger->LogWarn ( " Failed to initialize view of type '%s'. Generating default load settings. " , GetName ().c_str ());
1670
+ viewRef = data ;
1667
1671
}
1668
1672
1669
1673
Ref<Settings> settings = GetDefaultLoadSettingsForData (viewRef);
Original file line number Diff line number Diff line change @@ -640,6 +640,10 @@ bool PEView::Init()
640
640
m_logger->LogError (" PE architecture '0x%x' is not supported" , header.machine );
641
641
break ;
642
642
}
643
+
644
+ if (!m_parseOnly)
645
+ m_logger->LogWarn (" Unable to determine architecture. Please open the file with options and select a valid architecture." );
646
+
643
647
return false ;
644
648
}
645
649
@@ -3086,8 +3090,8 @@ Ref<Settings> PEViewType::GetLoadSettingsForData(BinaryView* data)
3086
3090
Ref<BinaryView> viewRef = Parse (data);
3087
3091
if (!viewRef || !viewRef->Init ())
3088
3092
{
3089
- m_logger->LogError ( " View type '%s' could not be created " , GetName ().c_str ());
3090
- return nullptr ;
3093
+ m_logger->LogWarn ( " Failed to initialize view of type '%s'. Generating default load settings. " , GetName ().c_str ());
3094
+ viewRef = data ;
3091
3095
}
3092
3096
3093
3097
Ref<Settings> settings = GetDefaultLoadSettingsForData (viewRef);
Original file line number Diff line number Diff line change @@ -257,16 +257,12 @@ bool TEView::Init()
257
257
break ;
258
258
default :
259
259
LogError (" TE platform '0x%x' is not supported" , header.machine );
260
+ if (!m_parseOnly)
261
+ m_logger->LogWarn (" Unable to determine architecture. Please open the file with options and select a valid architecture." );
260
262
return false ;
261
263
}
262
264
}
263
265
264
- if (!platform)
265
- {
266
- LogError (" Platform not supported by this version of Binary Ninja" );
267
- return false ;
268
- }
269
-
270
266
m_arch = platform->GetArchitecture ();
271
267
if (!m_arch)
272
268
{
@@ -371,13 +367,13 @@ bool TEViewType::IsTypeValidForData(BinaryView* bv)
371
367
return false ;
372
368
}
373
369
374
- Ref<Settings> TEViewType::GetLoadSettingsForData (BinaryView *bv )
370
+ Ref<Settings> TEViewType::GetLoadSettingsForData (BinaryView* data )
375
371
{
376
- Ref<BinaryView> viewRef = Parse (bv );
372
+ Ref<BinaryView> viewRef = Parse (data );
377
373
if (!viewRef || !viewRef->Init ())
378
374
{
379
- m_logger->LogError ( " View type '%s' could not be created " , GetName ().c_str ());
380
- return nullptr ;
375
+ m_logger->LogWarn ( " Failed to initialize view of type '%s'. Generating default load settings. " , GetName ().c_str ());
376
+ viewRef = data ;
381
377
}
382
378
383
379
// specify default load settings that can be overridden
Original file line number Diff line number Diff line change @@ -769,8 +769,8 @@ Ref<Settings> DSCViewType::GetLoadSettingsForData(BinaryView* data)
769
769
Ref<BinaryView> viewRef = Parse (data);
770
770
if (!viewRef || !viewRef->Init ())
771
771
{
772
- LogError ( " View type '%s' could not be created " , GetName ().c_str ());
773
- return nullptr ;
772
+ LogWarn ( " Failed to initialize view of type '%s'. Generating default load settings. " , GetName ().c_str ());
773
+ viewRef = data ;
774
774
}
775
775
776
776
Ref<Settings> settings = GetDefaultLoadSettingsForData (viewRef);
You can’t perform that action at this time.
0 commit comments