diff --git a/Function/BNSetAutoFunctionInlinedDuringAnalysis.cs b/Function/BNSetAutoFunctionInlinedDuringAnalysis.cs
index f7a2baa..1627943 100644
--- a/Function/BNSetAutoFunctionInlinedDuringAnalysis.cs
+++ b/Function/BNSetAutoFunctionInlinedDuringAnalysis.cs
@@ -8,7 +8,7 @@ namespace BinaryNinja
internal static partial class NativeMethods
{
///
- /// void BNSetAutoFunctionInlinedDuringAnalysis(BNFunction* func, BNBoolWithConfidence inlined)
+ /// void BNSetAutoFunctionInlinedDuringAnalysis(BNFunction* func, BNInlineDuringAnalysisWithConfidence inlined)
///
[DllImport(
"binaryninjacore",
@@ -21,9 +21,9 @@ internal static extern void BNSetAutoFunctionInlinedDuringAnalysis(
// BNFunction* func
IntPtr func ,
- // BNBoolWithConfidence inlined
- BoolWithConfidence inlined
+ // BNInlineDuringAnalysisWithConfidence inlined
+ BNInlineDuringAnalysisWithConfidence inlined
);
}
-}
\ No newline at end of file
+}
diff --git a/Function/BNSetUserFunctionInlinedDuringAnalysis.cs b/Function/BNSetUserFunctionInlinedDuringAnalysis.cs
index cbebfde..a27ac62 100644
--- a/Function/BNSetUserFunctionInlinedDuringAnalysis.cs
+++ b/Function/BNSetUserFunctionInlinedDuringAnalysis.cs
@@ -8,7 +8,7 @@ namespace BinaryNinja
internal static partial class NativeMethods
{
///
- /// void BNSetUserFunctionInlinedDuringAnalysis(BNFunction* func, BNBoolWithConfidence inlined)
+ /// void BNSetUserFunctionInlinedDuringAnalysis(BNFunction* func, BNInlineDuringAnalysisWithConfidence inlined)
///
[DllImport(
"binaryninjacore",
@@ -21,9 +21,9 @@ internal static extern void BNSetUserFunctionInlinedDuringAnalysis(
// BNFunction* func
IntPtr func ,
- // BNBoolWithConfidence inlined
- BoolWithConfidence inlined
+ // BNInlineDuringAnalysisWithConfidence inlined
+ BNInlineDuringAnalysisWithConfidence inlined
);
}
-}
\ No newline at end of file
+}
diff --git a/Handle/BNBasicBlock.cs b/Handle/BNBasicBlock.cs
index f61fc6f..6bf87bc 100644
--- a/Handle/BNBasicBlock.cs
+++ b/Handle/BNBasicBlock.cs
@@ -262,6 +262,12 @@ public byte[] GetInstructionData(ulong address)
return data;
}
+
+ /// Gets whether instruction data has been attached to this block.
+ public bool HasInstructionData
+ {
+ get { return NativeMethods.BNBasicBlockHasInstructionData(this.handle); }
+ }
public void AddInstructionData(byte[] data)
{
diff --git a/Handle/BNBinaryView.cs b/Handle/BNBinaryView.cs
index 3f6fd8b..eb22495 100644
--- a/Handle/BNBinaryView.cs
+++ b/Handle/BNBinaryView.cs
@@ -1615,6 +1615,11 @@ public bool IsOffsetWritableSemantics(ulong offset)
return NativeMethods.BNIsOffsetWritableSemantics(this.handle , offset);
}
+ public bool IsOffsetReadOnlySemantics(ulong offset)
+ {
+ return NativeMethods.BNIsOffsetReadOnlySemantics(this.handle, offset);
+ }
+
public bool SaveToFile(FileAccessor accessor)
{
return NativeMethods.BNSaveToFile(this.handle , accessor.ToNative());
diff --git a/Handle/BNFileMetadata.cs b/Handle/BNFileMetadata.cs
index 85f9e0e..758fc2d 100644
--- a/Handle/BNFileMetadata.cs
+++ b/Handle/BNFileMetadata.cs
@@ -119,6 +119,24 @@ public string Filename
}
}
+ /// Gets or sets the user-facing display name for this file.
+ public string DisplayName
+ {
+ get
+ {
+ return UnsafeUtils.TakeUtf8String(NativeMethods.BNGetDisplayName(this.handle));
+ }
+ set
+ {
+ if (null == value)
+ {
+ throw new ArgumentNullException(nameof(value));
+ }
+
+ NativeMethods.BNSetDisplayName(this.handle, value);
+ }
+ }
+
public string OriginalFilename
{
get
diff --git a/Handle/BNFunction.cs b/Handle/BNFunction.cs
index 282260f..bcbd440 100644
--- a/Handle/BNFunction.cs
+++ b/Handle/BNFunction.cs
@@ -2176,8 +2176,17 @@ public void SetAutoPure(BoolWithConfidence value)
///
public void SetAutoFunctionInlinedDuringAnalysis(BoolWithConfidence inlined)
{
- // pass the struct directly (by value), matching the P/Invoke signature
- NativeMethods.BNSetAutoFunctionInlinedDuringAnalysis(this.handle , inlined);
+ if (null == inlined)
+ {
+ throw new ArgumentNullException(nameof(inlined));
+ }
+
+ InlineDuringAnalysis value = inlined.Value
+ ? InlineDuringAnalysis.InlinePreservingTargetInstructionAddresses
+ : InlineDuringAnalysis.DoNotInlineCall;
+ this.SetAutoInlinedDuringAnalysis(
+ new InlineDuringAnalysisWithConfidence(value, inlined.Confidence)
+ );
}
///
@@ -2185,8 +2194,17 @@ public void SetAutoFunctionInlinedDuringAnalysis(BoolWithConfidence inlined)
///
public void SetUserFunctionInlinedDuringAnalysis(BoolWithConfidence inlined)
{
- // pass the struct directly (by value), matching the P/Invoke signature
- NativeMethods.BNSetUserFunctionInlinedDuringAnalysis(this.handle , inlined);
+ if (null == inlined)
+ {
+ throw new ArgumentNullException(nameof(inlined));
+ }
+
+ InlineDuringAnalysis value = inlined.Value
+ ? InlineDuringAnalysis.InlinePreservingTargetInstructionAddresses
+ : InlineDuringAnalysis.DoNotInlineCall;
+ this.SetUserInlinedDuringAnalysis(
+ new InlineDuringAnalysisWithConfidence(value, inlined.Confidence)
+ );
}
///
@@ -2203,6 +2221,58 @@ public BoolWithConfidence IsFunctionInlinedDuringAnalysis
}
}
+ /// Gets the function's current inline-during-analysis mode and confidence.
+ public InlineDuringAnalysisWithConfidence InlinedDuringAnalysis
+ {
+ get
+ {
+ return InlineDuringAnalysisWithConfidence.FromNative(
+ NativeMethods.BNGetFunctionInlinedDuringAnalysis(this.handle)
+ );
+ }
+ set { this.SetUserInlinedDuringAnalysis(value); }
+ }
+
+ public void SetAutoInlinedDuringAnalysis(InlineDuringAnalysisWithConfidence inlined)
+ {
+ if (null == inlined)
+ {
+ throw new ArgumentNullException(nameof(inlined));
+ }
+
+ NativeMethods.BNSetAutoFunctionInlinedDuringAnalysis(
+ this.handle,
+ inlined.ToNative()
+ );
+ }
+
+ public void SetAutoInlinedDuringAnalysis(InlineDuringAnalysis inlined)
+ {
+ this.SetAutoInlinedDuringAnalysis(
+ new InlineDuringAnalysisWithConfidence(inlined, byte.MaxValue)
+ );
+ }
+
+ public void SetUserInlinedDuringAnalysis(InlineDuringAnalysisWithConfidence inlined)
+ {
+ if (null == inlined)
+ {
+ throw new ArgumentNullException(nameof(inlined));
+ }
+
+ NativeMethods.BNSetUserFunctionInlinedDuringAnalysis(
+ this.handle,
+ inlined.ToNative()
+ );
+ }
+
+ public void SetUserInlinedDuringAnalysis(InlineDuringAnalysis inlined)
+ {
+ this.SetUserInlinedDuringAnalysis(
+ new InlineDuringAnalysisWithConfidence(inlined, byte.MaxValue)
+ );
+ }
+
// ===================================================================
// Clobbered registers (get / set auto / set user)
// ===================================================================
@@ -5030,4 +5100,4 @@ private unsafe VariableReferenceSource[] MarshalVariableReferenceSources(IntPtr
}
}
-}
\ No newline at end of file
+}
diff --git a/Handle/BNLinearViewCursor.cs b/Handle/BNLinearViewCursor.cs
index c7bdd49..8472540 100644
--- a/Handle/BNLinearViewCursor.cs
+++ b/Handle/BNLinearViewCursor.cs
@@ -276,37 +276,9 @@ public LinearViewObject? CurrentObject
{
get
{
- IntPtr arrayPointer = NativeMethods.BNGetLinearViewCursorPathObjects(
- this.handle,
- out ulong arrayLength
+ return LinearViewObject.TakeHandle(
+ NativeMethods.BNGetLinearViewCursorCurrentObject(this.handle)
);
-
- LinearViewObject? view = null;
-
- if (( IntPtr.Zero != arrayPointer ) && ( 0 != arrayLength ))
- {
- for (ulong i = 0; i < arrayLength; i++)
- {
- int offset = checked((int)(i * (ulong)IntPtr.Size));
-
- IntPtr addressOfElement = IntPtr.Add(arrayPointer, offset);
-
- IntPtr element = Marshal.ReadIntPtr(addressOfElement);
-
- if (element != IntPtr.Zero)
- {
- // object chain
- view = LinearViewObject.MustNewFromHandle(element, view);
- }
- }
- }
-
- if (arrayPointer != IntPtr.Zero )
- {
- NativeMethods.BNFreeLinearViewCursorPathObjects(arrayPointer ,arrayLength);
- }
-
- return view;
}
}
@@ -456,4 +428,4 @@ out ulong arrayLength
}
}
}
-}
\ No newline at end of file
+}
diff --git a/Handle/BNLowLevelILFunction.cs b/Handle/BNLowLevelILFunction.cs
index 41fa54d..0161ace 100644
--- a/Handle/BNLowLevelILFunction.cs
+++ b/Handle/BNLowLevelILFunction.cs
@@ -879,6 +879,12 @@ public void ClearIndirectBranches()
NativeMethods.BNLowLevelILClearIndirectBranches(this.handle);
}
+ /// Gets whether this LLIL function contains unresolved indirect branches.
+ public bool HasIndirectBranches
+ {
+ get { return NativeMethods.BNLowLevelILFunctionHasIndirectBranches(this.handle); }
+ }
+
public void SetIndirectBranches(ArchitectureAndAddress[] branches)
{
NativeMethods.BNLowLevelILSetIndirectBranches(
diff --git a/Struct/BNInlineDuringAnalysisWithConfidence.cs b/Struct/BNInlineDuringAnalysisWithConfidence.cs
index 46f529f..74080f7 100644
--- a/Struct/BNInlineDuringAnalysisWithConfidence.cs
+++ b/Struct/BNInlineDuringAnalysisWithConfidence.cs
@@ -18,4 +18,37 @@ internal unsafe struct BNInlineDuringAnalysisWithConfidence
///
internal byte confidence;
}
+
+ public sealed class InlineDuringAnalysisWithConfidence
+ {
+ public InlineDuringAnalysis Value { get; set; } = InlineDuringAnalysis.DoNotInlineCall;
+
+ public byte Confidence { get; set; } = 0;
+
+ public InlineDuringAnalysisWithConfidence()
+ {
+ }
+
+ public InlineDuringAnalysisWithConfidence(InlineDuringAnalysis value, byte confidence = 0)
+ {
+ this.Value = value;
+ this.Confidence = confidence;
+ }
+
+ internal static InlineDuringAnalysisWithConfidence FromNative(
+ BNInlineDuringAnalysisWithConfidence native
+ )
+ {
+ return new InlineDuringAnalysisWithConfidence(native.value, native.confidence);
+ }
+
+ internal BNInlineDuringAnalysisWithConfidence ToNative()
+ {
+ return new BNInlineDuringAnalysisWithConfidence()
+ {
+ value = this.Value,
+ confidence = this.Confidence,
+ };
+ }
+ }
}