mirror of
https://github.com/AssetRipper/Capstone.NET.git
synced 2026-11-13 20:05:44 -10:00
32 lines
992 B
C#
32 lines
992 B
C#
using Microsoft.Win32.SafeHandles;
|
|
using System;
|
|
|
|
namespace Gee.External.Capstone {
|
|
/// <summary>
|
|
/// Native Instruction Handle.
|
|
/// </summary>
|
|
internal sealed class NativeInstructionHandle : SafeHandleZeroOrMinusOneIsInvalid {
|
|
/// <summary>
|
|
/// Create an Instruction Handle.
|
|
/// </summary>
|
|
/// <param name="pInstruction">
|
|
/// A pointer to an instruction.
|
|
/// </param>
|
|
internal NativeInstructionHandle(IntPtr pInstruction) : base(true) {
|
|
this.handle = pInstruction;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Release Handle.
|
|
/// </summary>
|
|
/// <returns>
|
|
/// A boolean true if the handle was released. A boolean false otherwise.
|
|
/// </returns>
|
|
protected override bool ReleaseHandle() {
|
|
NativeCapstoneImport.FreeInstructions(this.handle, (IntPtr) 1);
|
|
this.handle = IntPtr.Zero;
|
|
|
|
return true;
|
|
}
|
|
}
|
|
} |