-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathBNDisassemblyTextLineTypeInfo.cs
More file actions
73 lines (58 loc) · 1.72 KB
/
Copy pathBNDisassemblyTextLineTypeInfo.cs
File metadata and controls
73 lines (58 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
namespace BinaryNinja
{
[StructLayout(LayoutKind.Sequential)]
public unsafe struct BNDisassemblyTextLineTypeInfo
{
/// <summary>
/// bool hasTypeInfo
/// </summary>
[MarshalAs(UnmanagedType.I1)] internal bool hasTypeInfo;
/// <summary>
/// BNType* parentType
/// </summary>
internal IntPtr parentType;
/// <summary>
/// uint64_t fieldIndex
/// </summary>
internal ulong fieldIndex;
/// <summary>
/// uint64_t offset
/// </summary>
internal ulong offset;
}
public sealed class DisassemblyTextLineTypeInfo
{
public bool HasTypeInfo { get; set; } = false;
public BinaryNinja.Type? ParentType { get; set; } = null;
public ulong FieldIndex { get; set; } = ulong.MaxValue;
public ulong Offset { get; set; } = 0;
public DisassemblyTextLineTypeInfo()
{
}
internal DisassemblyTextLineTypeInfo(BNDisassemblyTextLineTypeInfo native)
{
this.HasTypeInfo = native.hasTypeInfo;
this.ParentType = ( IntPtr.Zero == native.parentType ? null : BinaryNinja.Type.MustNewFromHandle(native.parentType) );
this.FieldIndex = native.fieldIndex;
this.Offset = native.offset;
}
internal static DisassemblyTextLineTypeInfo FromNative(BNDisassemblyTextLineTypeInfo native)
{
return new DisassemblyTextLineTypeInfo(native);
}
internal BNDisassemblyTextLineTypeInfo ToNative()
{
return new BNDisassemblyTextLineTypeInfo()
{
hasTypeInfo = this.HasTypeInfo ,
parentType = ( null == this.ParentType ? IntPtr.Zero : this.ParentType.DangerousGetHandle() ) ,
fieldIndex = this.FieldIndex ,
offset = this.Offset
};
}
}
}