Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Handle/BNBinaryView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,38 @@ public ulong Length
return result;
}

/// <summary>Loads a binary view from a file stored in a Binary Ninja project.</summary>
/// <param name="projectFile">The project file to load.</param>
/// <param name="updateAnalysis">Whether to update analysis before returning.</param>
/// <param name="options">JSON load options accepted by the core.</param>
/// <param name="progress">Optional progress callback.</param>
/// <returns>The loaded view, or null when the core cannot load the project file.</returns>
public static BinaryView? LoadFile(
ProjectFile projectFile,
bool updateAnalysis = false,
string options = "",
ProgressDelegate? progress = null
)
{
if (null == projectFile)
{
throw new ArgumentNullException(nameof(projectFile));
}

ProgressCallbackContext progressContext = new ProgressCallbackContext(progress);
NativeDelegates.BNProgressFunction nativeProgress = progressContext.Invoke;
IntPtr result = NativeMethods.BNLoadProjectFile(
projectFile.DangerousGetHandle(),
updateAnalysis,
options ?? string.Empty,
Marshal.GetFunctionPointerForDelegate<NativeDelegates.BNProgressFunction>(nativeProgress),
IntPtr.Zero
);
GC.KeepAlive(nativeProgress);
progressContext.ThrowIfFailed();
return BinaryView.TakeHandle(result);
}

public static BinaryView? OpenExisting(string filename , ProgressDelegate? progress = null)
{
FileMetadata file = new FileMetadata(filename);
Expand Down
10 changes: 10 additions & 0 deletions Handle/BNType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ public BinaryNinja.Type Duplicate()
NativeMethods.BNDuplicateType(this.handle)
);
}

/// <summary>
/// Marks whether this type is expected to remain resident so the core can omit it from
/// memory-usage accounting. The type itself is returned for fluent use.
/// </summary>
public BinaryNinja.Type SetIgnored(bool ignored)
{
NativeMethods.BNTypeSetIgnored(this.handle, ignored);
return this;
}


public static string GetNameTypeString( NameType classFunctionType )
Expand Down
Loading